public class Ball extends Sphere {
  private String theName;  // the ball's name

  // constructors:
  public Ball() {
  // Creates a ball with radius 1.0 and 
  // name "unknown".
    setName("unknown");
  }  // end default constructor

  public Ball(double initialRadius, String initialName) {
  // Creates a ball with radius initialRadius and 
  // name initialName.
    super(initialRadius);
    setName(initialName);
  }  // end constructor

  // additional or revised operations:
  public boolean equals(Object rhs) {
    return ((rhs instanceof Ball) && 
            (radius() == ((Ball)rhs).radius()) &&
            (theName.compareTo(((Ball)rhs).theName)==0) );
  }  // end equals

  public String name() {
  // Determines the name of a ball.
    return theName;
  }  // end name

  public void setName(String newName) {
  // Sets (alters) the name of an existing ball.
    theName = newName;
  }  // end setName

  public void resetBall(double newRadius, String newName) {
  // Sets (alters) the radius and name of an existing
  // ball to newRadius and newName, respectively.
    setRadius(newRadius);
    setName(newName);
  }  // end resetBall

  public void displayStatistics() {
  // Displays the statistics of a ball.
    System.out.print("\nStatistics for a "+ name());
    super.displayStatistics();
  }  // end displayStatistics

}  // end Ball
