Advertisement
TheRedRover

Untitled

Apr 5th, 2020
304
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Scala 0.22 KB | None | 0 0
  1. object BouncingBall {
  2.   def bouncingBall(h: Double, bounce: Double, window: Double): Int = {
  3.     if ((h > 0)&&(bounce > 0)&&(bounce < 1)&&(window < h))
  4.       2 + bouncingBall(h*bounce, bounce, window)
  5.     else (-1)
  6.   }
  7. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement