Question: You are an engineer assigned to a program to develop a relatively cheap vehicle to deliver satellites to earth orbit. During launch of the vehicle,

You are an engineer assigned to a program to develop a relatively cheap vehicle to deliver satellites to earth orbit. During launch of the vehicle, the rocket must reach a vertical velocity larger than 1000 m/s during the first 40 seconds after launch. The rockets instruments include an altimeter. Your job is to write a program to take the numerical derivative of the altitude data to find the velocity. A sample file containing time and altitude data from the last launch is available to you (on the course web site) to test your program. Your program should: a) Use doubles for all variables used in the derivative calculation. b) Read in the time and altitude data from the sample file. c) Make use of any appropriate loops to find the velocity. You should use the central difference equation to find the velocity for all time points, except for the first and last time points. d) For each time point, save the time, altitude, and velocity to a data file in table format so that they can be read into a graphing program. To help you, Ive developed pseudocode for the program below: 1) Declare an object of type ifstream, and use it to open alt_data.dat (the input file). 2) Declare an object of type ofstream, and use it to open a file for output. (A good way to do this might be to prompt the user for a filename.) 3) Read the first time and altitude data from alt_data.dat into variables time1 and alt1. 4) Read the second time and altitude into time2 and alt2. 5) Read the third time and altitude into time3 and alt3. 6) While not at the end of the file, a) v2 = (alt3 - allt1)/(time3 - time1) b) Write time2, alt2, and v2 to the output file. c) Set time1 = time2, time2 = time3 d) Set alt1 = alt2, alt2 = alt3 e) Read new time3 and alt3 from the file 7) Close both the input and the output files

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!