Implemented class approach for bouncing ball