+ 2

How to calculate a total distance coverd by a bouncing ball,until it reaches a height that is less then 0.5m in java

plz help guys it is easy with python.am new in java

16th Oct 2017, 8:23 AM
Momelezi Qasana
Momelezi Qasana - avatar
4 Respostas
+ 2
I say 20 meters. Now is up to you to figure out ball's mass, initial ball's speed, inithial ball's height, air drag, impact energy losses etc.... Try adding your python code: it may be clearer than your question.
16th Oct 2017, 9:21 AM
seamiki
seamiki - avatar
+ 2
float bouncingBall(float height, int bounce, float decrease){ distance=height; for (int i=0; i<bounce;i++){ height*=decrease; distance=distance+height*2; } return distance; } Take care that this is just a function: you'll have to call it with its defined arguments inside your program. Hope it helps
16th Oct 2017, 10:43 AM
seamiki
seamiki - avatar
+ 2
okay thnx
16th Oct 2017, 11:06 AM
Momelezi Qasana
Momelezi Qasana - avatar
+ 1
def bouncing ball(height, bounce,decrease): distance=height for I in range(bounce): height=height*decrease distance=distance+height*2 return distance this is python code I want to transfer it to java
16th Oct 2017, 9:34 AM
Momelezi Qasana
Momelezi Qasana - avatar