Section 12: Subroutines193
Daredevil test pilot Trigo Skywalker is diving in a wingless R2DART experimental aircraft at an angle of 45 degrees and a velocity of 745 meters/second. Suddenly, at an altitude of 7460 meters, the R2 loses power and Skywalker parachutes to safety. How long after the R2 loses power does it fly before crashing? (Effects of atmospheric drag and variation in the gravitational acceleration are ignored.)
    Solution: The equation describing the fall of the plane is:
  y = – (g ÷ 2) t2 – vt + yi
Where y is the altitude. (in our problem y = 0 when the plane crashes.
  g is the acceleration of gravity, 9.80655 m/s2
  v is the vertical component of the velocity when power was lost. It is found by multiplying the velocity by the sine of the flight angle.
  yi is the initial altitude.
  t is the time in flight after power failure (seconds).
    (Answer: 12.6675 seconds.)
Method: Modify the QROOT program that you loaded earlier in this section (page 182) so that it no longer prompts for the input a, b, and c. Write a second program, based on the following flowchart, that finds the values of a (– g ÷ 2), b (– v), and c (yi). The a should be stored into R01, b into R02 and c into R03. The second program should use QROOT as a subroutine. The following flowchart will help you write the program. (Only the positive root is valid as an answer to the problem.)