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 10 meters bounces 8 m high, then we say that the coefficient of rebound is 0.8, and the total distance traveled by the ball is 18 m after one bounce. After a second bounce, the ball will have traveled \(10\mathrm{~m}+8\mathrm{~m}+8\mathrm{~m}+6.4\mathrm{~m}\). you can see, the distance traveled for each bounce is the distance down to the floor, plus 0.8 of that as the ball comes back up:
\[
\begin{array}{c}
10\mathrm{~m}(\text { down })+8\mathrm{~m}(\mathrm{up})+8\mathrm{~m}(\text { down })+6.4\mathrm{~m}\text {(up)}\\
\text { bounce }1+\text { bounce }2
\end{array}
\]
1. 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 10 meters and that the coefficient of rebound is 0.8. Is a for loop or a while loop more appropriat for this problem, and why? (Write your answer as comments in the code.)
2. 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 20(for 20 meters), the program will report 2 bounces. (The first bounce covers 18 m , so 20 m requires part of a second bounce too.) Is a for loop or a while loop more appropriate for this problem, and why?
Instructions Program in C + + Suppose that we

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!