+ 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
4 Réponses
+ 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.
+ 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
+ 2
okay thnx
+ 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