Question: Convert that program into a recursive version. Label the following with a comment Stop condition Size - n problem Size - n - 1 problem

Convert that program into a recursive version.
Label the following with a comment
Stop condition
Size-n problem
Size-n-1 problem (smaller problem)
Where the program unwinds the solution
from "top to top" is 17 meters after one bounce (10 DOWN, 7 UP). If the ball were to continue bouncing, the distance is after 2 bounces is would be (in meters)10+7+7+4.9=28.9m. Note that distance for each successive bounce is the distance to the floor plus 0.6 of that distance as the ball comes back up. Write a program that lets the user enter the (1) initial height from which the ball is dropped, (2) the bounciness index, and (3) the number of times the ball is allowed to continue bouncing. Output should be the total distance traveled by the ball. [Enhance the output by printing the equation as it is being bounced (calculated). i.e., print out 10+6+6+3.6=25.6 and not just 25.6]. Submit

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Programming Questions!