Hot Air Balloons - 5 (Program: "balarray")

This week we learn about arrays which will completely change our approach to programming. Our program is a rewrite of the previous program exercise balfile which should be modified in structure to include arrays.

In the main function we declare two arrays having a maximum size of 100 values each - one for the altitude values (alt), and one for the payload values (pay). The main function should then invoke three new methods associated with the Balloon class to do the following tasks:

All this is shown in the flow diagram below:

Consider the output of a typical execution of program balarray. Notice that in spite of the significant structural change the program output is almost identical to that of program balfile.

 get balloon data from the "bal500.data" file
data read: 500, 50
################newballoon data:
First item: volume of the balloon [cu.m]
Second item: empty mass of the balloon [kg]
###########################################
balloon initialised as follows:
 balloon volume: 500[cu.m]
 balloon empty mass: 50[kg]
standard atmospheric conditions:
 temperature lapse rate: -0.0065[deg C/m]
 temperature at sea level: 15[deg C]
 standard pressure at sea level: 101325[Pa]
determine a sequence of (altitude,payload) points
enter low and high bounds of altitude [m]:
0 13000
altitude bounds are [0.0,13000.0] [m]
enter the number of points to evaluate
14
number of points is 14
WARNING! Altitude 12000.0[m] out of range
WARNING! Altitude 13000.0[m] out of range
   altitude[m]   payload[kg]
       0.0           89.7
    1000.0           86.4
    2000.0           82.3
    3000.0           77.4
    4000.0           71.9
    5000.0           66.0
    6000.0           59.7
    7000.0           53.1
    8000.0           46.4
    9000.0           39.7
   10000.0           33.0
   11000.0           26.3
   12000.0            0.0
   13000.0            0.0
14 rows of data written to "balloon.out" file
find altitude as a function of required payload
enter the required payload [kg]:
80
required payload entered is 80.0[kg]
enter required accuracy in altitude [m]
1
required accuracy is 1.0[m]
WARNING! Altitude 13000.0[m] out of range
for a required payload of 80.0[kg]
altitude attained is 2486.3[m]

Both the source code file balarray.cpp and the header file balarray.h should be in your home directory by 10:00 am of the due date.