You’re a programmer working for a large aerospace company. One of the aerospace engineers comes to you asking for help in setting up some data that is needed for a simulation. They have a vehicle that flies through the air and knows what direction its moving in, but can only measure its speed in reference to the ground. The engineers always know the direction and speed of the wind when their vehicle is flying because they can measure it from a ground station. They want to know the speed of the vehicle as it moves through the air. If this seems like a hard concept to grasp, that’s ok – the engineers have provided you with the following equation to calculate airspeed: airspeed = (windSpeed * cosine(absoluteValue(vehicleDirection – windDirection)) + vehicleSpeed The engineers give you the following vehicle speeds and directions: Vehicle speeds: 1, 3, 5, 11, 16, 18, 22, 26, 30, 34 Vehicle directions: 10, 30, 50, 110, 160, 185, 260, 280, 315, 330 They want you to come up with a random value of wind speed between 10 and 30 along with a random value of wind direction between 0 and 359 for each of the 10 vehicle speed and direction pairs (i.e. at vehicle speed 1, it is moving in direction 10). Then they want to see the airspeed calculation based on those four numbers. You should output a table that looks like this (negative airspeeds are allowed): NOTE: Your Wind Speed, Wind Direction, and Airspeed values will probably be different since your Wind Speed and Wind Direction values will be random! You will need a total of five arrays. These all need to be of type double! Two of those arrays will be created as initialized arrays using the given vehicle speeds and vehicle directions (which you can conveniently copy and paste into your code). The other three will be created using an array-creation expression as shown in slide 10 of this weeks PowerPoint. To fill your wind speed and wind direction arrays you will need to use a for loop and the .Length property of one of those arrays (all the arrays are the same size, so it doesnt matter however, you have to use .Length in case you change the array size later). Since your wind speeds and directions need to be random, you need to look in your text (page 252, section 7.8) to see how to use the Random class. This means youll need two Random number generators 1 each for wind speed and direction, and both combining “shifting” and “scaling” (see 7.8.5). You will also need to use a for loop to calculate and fill the airspeed array using the equation above. Outputting your final table will also require a for loop. Again, make sure youre using the .Length property of one of your arrays so that you dont go out of bounds. Some hints to help get you started. Youll need to use some methods from the Math library: Math.Cos and Math.Abs. Also, the vehicle directions are given in degrees, while Math.Cos takes a number in radians. This means youll have to convert from degrees to radians, but dont worry its a simple conversion. Radians = degrees * (Pi / 180). C# makes this easy by providing you with Math.PI, so somewhere in your code you need to convert the vehicle direction and wind directions into radians. It might look like this: windRadians = windDirection * (Math.PI / 180); As a reminder your output table should still show the degree values NOT the radian values. There are several ways to accomplish this task, but here is one algorithm that might help: -Declare your variables -Fill the wind speed and wind direction arrays with the appropriate random values -Convert your vehicle direction and wind direction values to radians -Calculate airspeed values -Output the table The provided shell also has these steps. MUST USE SHELL BELOW AS A GUIDE: //Name //Data //Assignment using System; using System.Collections.Generic; using System.Linq; using System.Text; namespace assignment8 { class assignment8 { static void Main(string[] args) { //Declare your variables and array…
Looking for solution of this Assignment?
WHY CHOOSE US?
We deliver quality original papers |
Our experts write quality original papers using academic databases. |
Free revisions |
We offer our clients multiple free revisions just to ensure you get what you want. |
Discounted prices |
All our prices are discounted which makes it affordable to you. Use code FIRST15 to get your discount |
100% originality |
We deliver papers that are written from scratch to deliver 100% originality. Our papers are free from plagiarism and NO similarity |
On-time delivery |
We will deliver your paper on time even on short notice or short deadline, overnight essay or even an urgent essay |