Skip to content

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

6 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Model-Ball-Class

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.

  1. Overload the operator+ for increasing the xSpeed of the ball object
  2. Overload the operator > for comparing the ySpeed of the two Ball objects
  3. Overload the operator ++ for increasing the ySpeed of the Ball objects by 1(one).
  4. Overload the operator << for printing the information of the Ball objects in the format "Ball @ (x, y) with speed (xSpeed, ySpeed)

About

Creating a Ball class to Model a moving ball.

Resources

Stars

Watchers

Forks

Releases

Packages

Contributors