// Aaron Tan
// BallV2 class:
//   Data members: colour, radius and centre (new).
//   Updated constructors.
//   New methods: equals(), toString().

import java.util.*;
import java.awt.*;

public class BallV2 {

   private String colour;
   private double radius;
   private Point  centre; 

   /**************************************************/

   // Construct a defall BallV2 object with yellow colour,
   // 1.0 radius, and centre at (0, 0).
   public BallV2(){
      this("yellow", 1.0, new Point());
   }

   public BallV2(String newColour, double newRadius, Point newCentre) {
      setColour(newColour); 
      setRadius(newRadius); 
      setCentre(newCentre);
   }

   /**************************************************/

   public String getColour() {
      return this.colour;
   }

   public double getRadius() {
      return this.radius;
   }

   public Point getCentre() {
      return this.centre;
   }

   /**************************************************/

   public void setColour(String colour) {
      this.colour = colour;
   }

   public void setRadius(double radius) {
      this.radius = radius;
   }

   public void setCentre(Point centre) {
      this.centre = centre;
   }

   /**************************************************/

   /**************************************************
    * This method compares two BallV2 objects
    * to see if their data are identical
    **************************************************/
   public boolean equals(BallV2 ball) {
      String colour1 = this.getColour();
      double radius1 = this.getRadius();
      Point  centre1 = this.getCentre();

      String colour2 = ball.getColour();
      double radius2 = ball.getRadius();
      Point  centre2 = ball.getCentre();

      return (colour1.equals(colour2)) && (radius1 == radius2)
             && (centre1.equals(centre2));
   }

   /**************************************************
    * This method returns the string 
    * representation of a BallV2 object
    **************************************************/
   public String toString() {
      return "[" + this.getColour() + ", " 
                 + this.getRadius() + ", "
                 + this.getCentre() + "]";
   }

}

