ASSIGNMENT #3 A small test rocket is being designed for use in testing a retroro
ID: 3666164 • Letter: A
Question
ASSIGNMENT #3
A small test rocket is being designed for use in testing a retrorocket that is intended to permit “soft” landings. The designers have derived the following equations that they believe will predict the performance of the test rocket.
(t = elapsed time in seconds)
6.07t2.751
Acceleration in ft/sec2 = 4.25 - .015t2 + ------------
9995
.015t3 6.07t3.751
Velocity in ft/sec = 4.25t - -------- + -------------
3 3.751(9995)
4.25t2 .015t4 6.07t4.751
Distance in ft = 90 + -------- - -------- + ------------
2 12 4.751(37491)
Note: The distance equation gives the height above ground level at time t and the first term (90) is the height in feet above ground level of the launch platform that will be used.
In order to check the predicted performance, the rocket will be “flown” on a computer, using the derived equations.
Write a program to cover a maximum flight of 100 seconds. The output should be of the following form:
TIME ACCELERATION VELOCITY DISTANCE
(sec) (ft/sec2) (ft/sec) (ft)
XXX.XX XXX.XX XXX.XX XXXX.XX
(starting with 0.0 sec)
Increments of time are to be 2.0 seconds, from launch through the ascending and descending portions of the trajectory until the rocket descends to within 60 feet of ground level. Below 60 feet the time increments are to be 0.05 seconds. If the rocket impacts prior to 100 seconds, the program is to be stopped immediately after impact.
Your program must include functions for acceleration, velocity, distance and the heading for the output report. .
.
Demonstrate your output in the lab. You are required to demonstrate your program in the lab.
Submit in Blackboard your algorithm or flowchart and a copy of your source code (C++ code).
Documentation will be 20% of your grade.
Your source code must contain the following documentation.
Header information:
Your Name, course & section number, assignment number and due date.
A brief description of your assignment.
Variable dictionary: A brief description of every variable used in your program.
Comments related to input and output of data and all formulas used in your code.
ASSIGNMENT #3
A small test rocket is being designed for use in testing a retrorocket that is intended to permit “soft” landings. The designers have derived the following equations that they believe will predict the performance of the test rocket.
(t = elapsed time in seconds)
6.07t2.751
Acceleration in ft/sec2 = 4.25 - .015t2 + ------------
9995
.015t3 6.07t3.751
Velocity in ft/sec = 4.25t - -------- + -------------
3 3.751(9995)
4.25t2 .015t4 6.07t4.751
Distance in ft = 90 + -------- - -------- + ------------
2 12 4.751(37491)
Note: The distance equation gives the height above ground level at time t and the first term (90) is the height in feet above ground level of the launch platform that will be used.
In order to check the predicted performance, the rocket will be “flown” on a computer, using the derived equations.
Write a program to cover a maximum flight of 100 seconds. The output should be of the following form:
TIME ACCELERATION VELOCITY DISTANCE
(sec) (ft/sec2) (ft/sec) (ft)
XXX.XX XXX.XX XXX.XX XXXX.XX
(starting with 0.0 sec)
Increments of time are to be 2.0 seconds, from launch through the ascending and descending portions of the trajectory until the rocket descends to within 60 feet of ground level. Below 60 feet the time increments are to be 0.05 seconds. If the rocket impacts prior to 100 seconds, the program is to be stopped immediately after impact.
Your program must include functions for acceleration, velocity, distance and the heading for the output report. .
.
Demonstrate your output in the lab. You are required to demonstrate your program in the lab.
Submit in Blackboard your algorithm or flowchart and a copy of your source code (C++ code).
Documentation will be 20% of your grade.
Your source code must contain the following documentation.
Header information:
Your Name, course & section number, assignment number and due date.
A brief description of your assignment.
Variable dictionary: A brief description of every variable used in your program.
Comments related to input and output of data and all formulas used in your code.
Explanation / Answer
main.cpp
// header files
#include <iostream>
#include <iomanip>
#include <cmath>
using namespace std;
// define main function
int main()
{
// declare variables
double t = 0, d = 0, a = 0, v = 0, a1 = 0, a2 = 0, v1 = 0, v2 = 0, d1 = 0, d2 = 0, d3 = 0;
cout << "Time(sec) Acceleration(ft/sec2) Velocity(ft/sec) Distance (ft) " ;
// checking the condition using while loop
while(t<=100 && d >= 0)
{
// calculate acceleration, velocity, distance using formula
a1 = 4.25 - 0.015 * pow(t,2);
a2 = 6.07 * pow(t,2.751) / 9995;
v1 = 4.25 * t - (.015 * pow(t,3) / 3);
v2 = 6.07 * pow(t,3.751) / (3.751 * 9995) ;
d1 = 90 + 4.25 * pow(t,2) / 2 ;
d2 = .015 * pow(t,4) / 12 ;
d3 = 6.07 * pow(t,4.751) / (4.751 * 37491);
d = d1 - d2 + d3 ;
v = v1 + v2 ;
a = a1 + a2 ;
// display output
cout << setprecision(2)<<fixed<< t << " " << a << " " << v << " " << d << " " ;
if (d >= 60)
t += 2 ;
else
t += 0.05;
}
return 0;// return successfully
}
Sample output
Time(sec) Acceleration(ft/sec2) Velocity(ft/sec) Distance (ft)
0.00 4.25 0.00 90.00
2.00 4.19 8.46 98.48
4.00 4.04 16.71 123.70
6.00 3.79 24.55 165.05
8.00 3.48 31.84 221.55
10.00 3.09 38.41 291.92
12.00 2.66 44.17 374.65
14.00 2.17 49.00 467.98
16.00 1.66 52.84 570.00
18.00 1.11 55.62 678.63
20.00 0.55 57.29 791.72
22.00 -0.01 57.83 907.02
24.00 -0.58 57.23 1022.27
26.00 -1.15 55.49 1135.17
28.00 -1.70 52.65 1243.49
30.00 -2.22 48.73 1345.04
32.00 -2.71 43.79 1437.72
34.00 -3.17 37.90 1519.56
36.00 -3.58 31.14 1588.73
38.00 -3.94 23.61 1643.59
40.00 -4.24 15.42 1682.72
42.00 -4.47 6.70 1704.92
44.00 -4.63 -2.41 1709.26
46.00 -4.70 -11.76 1695.13
48.00 -4.69 -21.17 1662.20
50.00 -4.59 -30.47 1610.53
52.00 -4.38 -39.46 1540.53
54.00 -4.07 -47.94 1453.03
56.00 -3.65 -55.68 1349.27
58.00 -3.10 -62.44 1230.98
60.00 -2.42 -67.99 1100.34
62.00 -1.62 -72.05 960.04
64.00 -0.67 -74.36 813.33
66.00 0.42 -74.63 664.00
68.00 1.67 -72.56 516.40
70.00 3.07 -67.85 375.54
72.00 4.64 -60.16 247.02
74.00 6.38 -49.18 137.12
76.00 8.29 -34.54 52.80
76.05 8.34 -34.12 51.08
76.10 8.39 -33.70 49.39
76.15 8.44 -33.28 47.71
76.20 8.49 -32.86 46.06
76.25 8.54 -32.43 44.43
76.30 8.60 -32.00 42.82
76.35 8.65 -31.57 41.23
76.40 8.70 -31.14 39.66
76.45 8.75 -30.70 38.12
76.50 8.80 -30.26 36.59
76.55 8.85 -29.82 35.09
76.60 8.90 -29.38 33.61
76.65 8.95 -28.93 32.16
76.70 9.01 -28.48 30.72
76.75 9.06 -28.03 29.31
76.80 9.11 -27.58 27.92
76.85 9.16 -27.12 26.55
76.90 9.21 -26.66 25.21
76.95 9.27 -26.20 23.89
77.00 9.32 -25.73 22.59
77.05 9.37 -25.27 21.32
77.10 9.42 -24.80 20.06
77.15 9.48 -24.32 18.84
77.20 9.53 -23.85 17.63
77.25 9.58 -23.37 16.45
77.30 9.63 -22.89 15.30
77.35 9.69 -22.41 14.17
77.40 9.74 -21.92 13.06
77.45 9.79 -21.43 11.97
77.50 9.85 -20.94 10.92
77.55 9.90 -20.45 9.88
77.60 9.96 -19.95 8.87
77.65 10.01 -19.45 7.89
77.70 10.06 -18.95 6.93
77.75 10.12 -18.45 5.99
77.80 10.17 -17.94 5.09
77.85 10.23 -17.43 4.20
77.90 10.28 -16.92 3.34
77.95 10.34 -16.40 2.51
78.00 10.39 -15.88 1.70
78.05 10.44 -15.36 0.92
78.10 10.50 -14.84 0.17
78.15 10.55 -14.31 -0.56