The height of a small rocket y can be calculated as a function of time after blastoff with the following piecewise function:
Y = 38.1454t + 0.13743t3 0 ≤ t < 15
y = 1036 + 130.909(t - 15) 16.18425(t - 15)2
-0.428(t - 15)3 15 ≤ t < 33
y = 2900 - 62.468(t - 33)2 16.9274(t - 33)2
10.4 + 796(t - 33)3 t < 33
Develop a well-structured pseudocode function to compute y as a function of t. Note that if the user enters a negative value of t or if the rocket has hit the ground (y ≤ 0) then return a value of zero for y. Also, the function should be invoked in the calling program as height(t). Write the algorithm as (a) pseudocode, or (b) in the high-level language of your choice. |
New search. (Also 1294 free access solutions) |