Question

In: Computer Science

A standard science experiment is to drop a ball and see how high it bounces. Once...

A standard science experiment is to drop a ball and see how high it bounces. Once the “bounciness” of the ball has been determined, the ratio gives a bounciness index.

For example, if a ball dropped from a height of 10 feet bounces 6 feet high, the index is 0.6, and the total distance traveled by the ball is 16 feet after one bounce. 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 program that lets the user enter the initial height from which the ball is dropped, the bounciness index, and the number of times the ball is allowed to continue bouncing. Output should be the total distance traveled by the ball.

Below is an example of the program input and output:

Enter the height from which the ball is dropped: 25
Enter the bounciness index of the ball: .5
Enter the number of times the ball is allowed to continue bouncing: 3

Total distance traveled is: 65.625 units.

Please explain in Python language. Thanks in advance!

Solutions

Expert Solution

Let us first make you understand the mathematics behind the problem:

Suppose the initial height is 25, the bouncinessIndex = 0.5 and the ball can be dropped 3 times

So initial the ball travelled 25metre while dropping and it jumped to 12.5 metres

now the ball will drop from 12.5-metre height and will bounce to 6.25 metres

now the ball will drop from 6.25 metre and jump to 3.125 metre

So the total distance travelled will be 25.0+ 12.5+ 12.5 +6.25+ 6.25+ 3.125 = 65.625 meter

Here is the code to do so:

if you if the code helped you please upvote it, for any doubts post a comment, I will surely help.

Code:

height = float(input("Enter the height from which the ball is dropped: "))
bouncinessIndex = float(input("Enter the bounciness index of the ball: "))
allowedBounces = int(input("Enter the number of times the ball is allowed to continue bouncing: "))

# For every bounce add the height it was dropped from
# and the height it jumpes to
# Then change the value of height to the height it jumps to
result = 0
for i in range(allowedBounces):
print(height)
print(bouncinessIndex*height)
result += (height + bouncinessIndex*height)
height = bouncinessIndex*height
print(result)


Related Solutions

Ball Drop Experiment 4. You have a class of 20 students who were conducting the ball...
Ball Drop Experiment 4. You have a class of 20 students who were conducting the ball drop experiment. The data for one student, Fernando, is given below. He noticed that his experimental values to not exactly match the expected (calculated) values. He is very concerned that he did not do the experiment correctly and is upset.   Distance (cm) Experimental time (s) SE (s) Expected time (s) 20 0.21 0.10 0.202 40 0.38 0.07 0.286 60 0.45 0.04 0.350 80 0.38...
The height to which a ball bounces after being dropped provides a measure of how much...
The height to which a ball bounces after being dropped provides a measure of how much energy is lost in the collision with the floor or other surface. A small portion of energy is lost to air resistance as the ball is moving, but most is lost in the collision. 1. Trying a number of different balls that you that you may have available, test the height of the bounce using the same height or release for all of the...
How did the oil drop experiment determine the existence of an electron, the mass and charge...
How did the oil drop experiment determine the existence of an electron, the mass and charge of an electron, and the existance of a dense-small nucleus?
The Cash Budget Once we see how the components of the cash budget are calculated, it...
The Cash Budget Once we see how the components of the cash budget are calculated, it is just a matter of putting together an entire cash budget. It almost seems redundant to say, but a cash budget includes only cash items. So if a company makes sales on account, those are not included in the cash budget until cash is received on account. Similarly, a company may have non cash expenses. These are not included in the cash budget. A...
How can you combine standard addition and internal standard techniques in an HPLC experiment?
How can you combine standard addition and internal standard techniques in an HPLC experiment?
where, and/or how, do you, as a Labouré health science student, see yourself being most effective...
where, and/or how, do you, as a Labouré health science student, see yourself being most effective in becoming aware of, and/or responding to, challenges met by marginalized people.
a ball is thrown vertically upward with a speed of 8.0 m/s (a) How high does...
a ball is thrown vertically upward with a speed of 8.0 m/s (a) How high does it rise? (b) how long does it take to reach its highest point? (c) How long does it take to hit the ball to take to hit the ground after it reaches its highest point? (d) What is its velocity when it returns to the level from which it started?
Below you see how many men and women studied sociology and political science. Men Women Political...
Below you see how many men and women studied sociology and political science. Men Women Political science 138 163 Sociology 74 106 Give the p-value associated with the test statistic that indicates whether the proportion of female students in political science is smaller than the proportion of female students in sociology. Please round all values to 5 decimal points.
1.Discuss the possible health effects of a high sodium diet 2.How was your sodium intake? See...
1.Discuss the possible health effects of a high sodium diet 2.How was your sodium intake? See the Nutrition Report and identify the amount consumed. Did you meet or exceed your sodium target? If it was high, identify foods from your Servings Report that contributed the most sodium. If you met the recommendations, discuss the strategies that helped you. 3.Discuss the long-term health consequences of a sedentary lifestyle. 4. How might a deficiency in iron affect a person's health? Discuss the...
A marble with speed 20 cm/s rolls off the edge of a table 80 cm high. How long does it take to drop to the floor?
Problem 1:A marble with speed 20 cm/s rolls off the edge of a table 80 cm high. How long does it take to drop to the floor? How far, horizontally, from the table edge does the marble strike the floor?
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT