Lab4 : Modeling objects

The Bouncing Ball

Download the skeleton source code .

Your task is to model the bouncing of a rubber ball, in terms of the  total distance traveled until it stops bouncing, the total elapsed time and the number of times the ball bounces.

 The main features of the ball you need to model are:

  1.  the initial height from which it is dropped;

  2.  the bounce ratio, which is the ratio of the height the ball bounces as a fraction of its previous height;

  3. the cutoff height below which it loses all its energy and stops bouncing.

 The aim is to encapsulate both the relevant features of the ball AND its  behavior in a class description, leaving the public interface very simple. In fact I am giving you the exact main function for your program, with a skeleton class declaration, but minus the code necessary to input the initial height, the ratio and the cutoff height (all in feet). You should leave the main function code EXACTLY as it is, and just write the class, with its data members and methods bounce and display.

 Run the program several times with different values to test it, and run it once more with these values:
   initial height = 10 ft.
   bounce ratio = 0.6
   cutoff height = 0.1 ft.
 Submit your program's results with the source code in the usual manner, to me (RTH) and send your source code through the assignment submitter web page.

 Points to note:

 Assignment due: February 16th., before 5pm.