Hi I just recently got this program for my class, and I'm having a hard time understanding how to even start the program itself. We want to use a loop to output the values of acceleration velocity and distance for each value of t. the basis is t<=100 & distance >= 50 any help would be appreciated.
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)\
Acceleration = in ft/sec^2 = 4.25 - .015t^2 + (6.07t^2.751)/(9995)
Velocity = in ft/sec = 4.25t - (.015t^3)/(3) + (6.07t^3.751)/(3.751(9995))
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 50 feet of ground level. Below 50 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.
Start with implementing functions which would take time and return acceleration/velocity/distance
Then create variable to hold increment.
Create a loop like: for(double time = 0.0; time <= 100.0; time += increment)
Inside a loop do calculations, output them on screen.
Check for impact. break from the loop if needed
Check if below 50 feet. Set increment to 0.05 if so.
Add other things as needed.
No, sorry if I misled you. I didn't check them. I did notice you are making a blooper with the pow function. ct^x translates as c*pow(t,x) not pow(c*t,x)
This would make the equation line clearer if you had 'real' physical names for the coefficients (rather than my poor example of 'coeff1', 'coeff2' and 'coeff3').