This week (week 8) we learn about arrays which will completely change our approach to programming. Our program is a rewrite of our previous program exercise (rockfile) which should be modified in structure to include arrays.
In the main function we declare three arrays having a maximum size of 100 values each - for the time values (time), for the upward velocity values (vel) and for the height values (height). The main function should then invoke three new methods associated with the Rocket class to do the following tasks:
A new function minmax is invoked to determine the respective minimum and maximum values in the vel and height arrays, which are then displayed on the screen.
All this is shown in the flow diagram below:
Consider the output of a typical execution of program rockarray. Notice that in spite of the significant structural change the program output is almost identical to that of our previous program exercise (rockfile). Recall that since the input data defining the rocket is read from the input data file, only two data items are input by the user, as shown in italics. Once again your program will be separated into two files, the program file rockarray.cpp and the header file rockarray.h. Both of these files together with the input data file should all be in your home directory before 10:00am of the due date.
get rocket data from the "urieli.data" file data read: 43, 591, 0.4, 0.3 4, 0.3, 8 ################################################ The small urieli root beer water rocket -10/16/06 The above data items are (in sequence): mass [gm] - solid mass (rocket + payload) vtotal [cc] - total volume (water + air) dnoz [cm] - diameter of nozzle fill - fill ratio (water/total volume) pgage [atm] - charge gage pressure [atmospheres] cdrag - Coefficient of drag dbottle [cm] - outside diameter of bottle ################################################ Water rocket initialized as follows: Solid mass[gm]: 43, total volume[liters]: 0.591 absolute charge pressure[kPa]: 500 initial air charge volume[liters]: 0.4137 Nozzle free flow area [sq.cm]: 0.125664 Bottle cross sect. area [sq.cm]: 50.2655 Density - water: 1000kg/m^3, outside air: 1.2kg/m^3 Ratio of specific heat capacities for air (k): 1.4 Drag coefficient: 0.3 gravity acceleration: 9.807m/s^2 enter the max time to test (sec) 6 value entered is 6(s) enter the number of points to evaluate 21 number of points is 21 time(s) velocity(m/s) height(m) 0.00 0.00 0.00 0.30 11.66 1.68 0.60 29.60 7.61 0.90 22.44 15.36 1.20 17.02 21.23 1.50 12.72 25.71 1.80 9.05 29.00 2.10 5.70 31.09 2.40 2.69 32.46 2.70 -0.30 32.71 3.00 -3.21 32.21 3.30 -6.01 30.85 3.60 -8.60 28.69 3.90 -10.97 25.59 4.20 -13.01 21.92 4.50 -14.69 18.13 4.80 -16.10 13.77 5.10 -17.33 8.09 5.40 -18.24 3.27 5.70 -19.00 -2.52 6.00 -19.58 -8.02 min velocity: -19.58(m/s), max velocity: 29.60(m/s) min height: -8.02(m), max height: 32.71(m) 21 rows of data written to "rocket.out" file |