This Project will cover the coding of a Ball class to Model a moving ball.
The class will contain the following members
-
Four private data members (x, y, xSpeed, ySpeed) to maintain the position and speed of the ball.
-
A constructor, public getter and setter for the private data members created.
-
A function move() that increases the 'x' and 'y' by 'xSpeed' and 'ySpeed' respectively
-
A function print() to print the statement " Ball @ (x, y) with speed (xSpeed, ySpeed)" onto the screen.
Note: Values are set to 2 decimal places.
While creating the Ball class, I am suposed to cover the following areas.
- Overload the operator+ for increasing the xSpeed of the ball object
- Overload the operator > for comparing the ySpeed of the two Ball objects
- Overload the operator ++ for increasing the ySpeed of the Ball objects by 1(one).
- Overload the operator << for printing the information of the Ball objects in the format "Ball @ (x, y) with speed (xSpeed, ySpeed)