Question: Instructions Program in C + + Suppose that we drop a ball on the ground and see how high it bounces. As you know from
Instructions
Program in C
Suppose that we drop a ball on the ground and see how high it bounces. As you know from experience, it never bounces to the s height from which you drop it Instead, its height is reduced. We can model that reduction with what we could call a "coefficient rebound."
If a ball dropped from a height of meters bounces m high, then we say that the coefficient of rebound is and the total distance traveled by the ball is m after one bounce. After a second bounce, the ball will have traveled mathrm~mmathrm~mmathrm~mmathrm~m you can see, the distance traveled for each bounce is the distance down to the floor, plus of that as the ball comes back up:
beginarrayc
mathrm~mtext down mathrm~mmathrmupmathrm~mtext down mathrm~mtext up
text bounce text bounce
endarray
Write a program that will calculate the total distance traveled by the ball over a number of bounces input by the user. Assu that it is dropped from meters and that the coefficient of rebound is Is a for loop or a while loop more appropriat for this problem, and why? Write your answer as comments in the code.
Write a similar program that will tell how many bounces it took for the ball to travel a distance specified by the user. For instance, if the user inputs for meters the program will report bounces. The first bounce covers m so m requires part of a second bounce too. Is a for loop or a while loop more appropriate for this problem, and why?
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
