/**
*  Creates a circle
*
*  @author  unknown   Modified by: Glenn Young
*  @version 1.0  Date: 17 September 2008
*/

public class Circle
{
  //create a radius attribute that cannot be changed once initialized
  private double radius;
  
  /**
  *  Constructor for a Circle.
  *
  *  @param  r  The radius of the circle
  */
  public Circle  (double r)
  {
    //sets the radius to r
    radius = r;
  }//end Circle()
  
  /**
  *  Returns the are of the circle
  *
  *  @return  The area.
  */
  public double getArea()
  { 
    return Math.PI * radius * radius;  
  }//end getArea()
  
  /**
  *  Returns the radius of the circle
  *
  *  @return  The radius
  */
  public double getRadius()
  {
     return radius;
  }//end getRadius()
  
  /**
  *  Returns a String displaying the radius and area of
  *  the circle.
  *
  *  @return  circle   The String displaying the radius
  *                    and area of the circle 
  */
  public String toString()
  {
     String circle;
	  circle = String.format
	  ("Radius: %3.4f\nArea: %3.4f\n", getRadius(), getArea());
	  return circle;
  }//end toString()
  
  /**
  *  Compares this circle to another circle, and returns a value of
  *  'true' if they are the same circle
  *
  *  @param   circle   The circle being compared.
  *  @return  equal    Returns true if the two circles are the same
  */
  public boolean equals(Circle circle)
  {
      boolean equal;
		//determines if the two circles have the same radius,
		//and if so, sets 'equal' to true
		if(this.radius == circle.getRadius())
		    equal = true;
		else
		    equal = false;
		return equal;
  }//end equals
  
  /**
  *  Compares the area of this circle to the area of another circle,
  *  and determines which is larger.  Returns true if the argument
  *  object is larger.
  *
  *  @return larger   True if the argument object is larger
  *
  */
  public boolean greaterThan(Circle circle)
  {
      boolean larger;
		//determine which circle has the greater area
		if(circle.getArea() > this.getArea())
		    larger = true;
		else
		    larger = false;
		return larger;
  }//end greaterThan()
 }//end Circle