Question
4. in python Bouncing Balls A standard science experiment is to drop a ball and see how high it bounces. Once the bounciness of the
4. in python
Bouncing Balls
A standard science experiment is to drop a ball and see how high it bounces. Once the bounciness of the ball has been determined, a ratio gives a bounciness index. For example, if a ball dropped from a height of 10 feet and bounces back to a height of 6 feet, the bounciness index is 0.6 (6 / 10), and the total distance traveled by the ball is 16 feet after one bounce (drop plus bounce back). If the ball were to continue bouncing, the distance after two bounces would be 10 ft + 6 ft + 6 ft + 3.6 ft = 25.6 ft. Note that the distance traveled for each successive bounce is the distance to the floor plus 0.6 of that distance as the ball comes back up. Write a Python program that lets the user enter the initial height of the ball in feet and the bounciness index of that ball and outputs the total distance travelled by the ball in feet until it bounce back height becomes less than 0.1 feet. Your program should output the total distance travelled by the ball to two decimal places and the total number of bounces the ball makes. Your program should continue to perform experiments until a 0 is entered for the initial height. A sample run of the program is given below.
The pseudocode is:
Prompt and input the initial height of the ball
While the height is not equal to zero do
Prompt and input the balls bounciness index
Set total distance travelled to 0
Set the number of bounces to 0
Do the following while the height is greater than 0.1
Add height to total distance (This is the drop distance.)
Compute the rebound distance
Add the rebound distance to the total distance
Set the height to the value of the rebound distance
Add 1 to the number of bounces
Output the total distance and the number of bounces
Prompt and input the initial height of the ball
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started