GithubHelp home page GithubHelp logo

bouncing_ball's Introduction

Bouncing Balls Kata

A child is playing with a ball on the nth floor of a tall building. The height of this floor, h, is known.

He drops the ball out of the window. The ball bounces (for example), to two-thirds of its height (a bounce of 0.66).

His mother looks out of a window 1.5 meters from the ground.

How many times will the mother see the ball pass in front of her window (including when it's falling and bouncing?

Three conditions must be met for a valid experiment: Float parameter "h" in meters must be greater than 0 Float parameter "bounce" must be greater than 0 and less than 1 Float parameter "window" must be less than h. If all three conditions above are fulfilled, return a positive integer, otherwise return -1.

Note: The ball can only be seen if the height of the rebounding ball is stricty greater than the window parameter.

Example:

1- h = 3, bounce = 0.66, window = 1.5, result is 3

2- h = 3, bounce = 1, window = 1.5, result is -1

(Condition 2) not fulfilled as bounce is not less than 1!

Acceptance Criteria:

bouncingBall(3, 0.66, 1.5) => 3

bouncingBall(30, 0.66, 1.5) => 15

bouncingBall(30, 0.75, 1.5) => 21

bouncingBall(30, 0.4, 10) => 3

bouncingBall(40, 1, 10) => -1

bouncingBall(-5, 0.66, 1.5) => -1

Github Repo:

https://github.com/Shendidy/bouncing_ball.git

Youtube link:

https://youtu.be/Lc5ANLBvjGg

bouncing_ball's People

Contributors

shendidy avatar

Watchers

James Cloos avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.