// Aaron Tan
// BallV2 class:
//   Data members: colour, radius, x- and y-coord of centre.
//   (We have removed the static data member texture and
//    its associated methods.)
// 
// Version 2: Added the x- and y-coordinate of the centre.

class BallV2 {

   /************** Data members **********************/

   private String colour;
   private double radius;
   private int    xCoord;  // x- and y-coordinates of
   private int    yCoord;  // the centre of the ball

   /************** Constructor **********************/
   // only one constructor is created as overloading
   // is introduced later in Chapter 7
   // Default constructor creates a yellow, radius 10.0,
   // centre at (20,20) object.

   public BallV2() {
      setColour("yellow");
      setRadius(10.0);
      setCentre(20, 20);
   }

   /**************** Accessors ***********************/

   public String getColour() {
      return colour;
   }

   public double getRadius() {
      return radius;
   }

   public int getXCoord() {
      return xCoord;
   }

   public int getYCoord() {
      return yCoord;
   }

   /**************** Mutators ************************/

   public void setColour(String c) {
      colour = c;
   }

   public void setRadius(double r) {
      radius = r;
   }

   public void setCentre(int x, int y) {
      xCoord = x;
      yCoord = y;
   }

   /***************** Other methods ******************/

   public void moveVertical(int dist) {
      yCoord += dist; // or: setCentre(getXCoord(), getYCoord() + dist);
   }

   public void moveHorizontal(int dist) {
      xCoord += dist; // or: setCentre(getXCoord() + dist, getYCoord());
   }

}

