/*********************************************************************** CS177/477 C++ Programming Lab 4: The Bouncing Ball 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 below I am giving you the exact main function for your program, minus the code necessary to input the initial height, the ratio and the cutoff height (all in feet). You should leave this EXACTLY as it is, and just write the class, with its data members and methods bounce and display. Run the program several times 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 mail your source code file to me also. Points to note: o use float variables for the ball's atttributes, except the number of bounces o use a constructor with parameters to create a ball with the correct initial attributes o use the math library function sqrt to calculate the time taken to drop from a height h: time = sqrt(h / HALFG) where HALFG is half of the acceleration due to gravity, which you may take as 16.1 ft./sec./sec. You need to use #include to be able to use this function. o do not count the final drop as a bounce - only include the number of times the ball rises o write the method bounce to return either true or false (type bool) according to whether the ball bounces or not. e.g. bool bounce() { ... return true; // (or false) } see pg. 150 for details on the bool type Assigment due: September 24th., before 5pm. ***********************************************************************/ //////////////////////////////////////////////////////////////////////// // The Bouncing Ball: (put short description here) // // Author: (put your name here) // // Date: (put the date here) // //////////////////////////////////////////////////////////////////////// #include #include using namespace std; class Ball { (put your model of the ball in here, with private data variables and public functions) }; (put any external member function definitions here) int main() { float height, ratio, cutoff; (put your input of values for the variables here) Ball ball(height, ratio, cutoff); // create a ball // make the ball bounce while (ball.bounce()) cout << "the ball is bouncing..." << endl; // ask the ball to display its total distance traveled and time // taken ball.display(); return 0; }