/*
 * This class circle is a class that takes in varibles 
 * From a driver and then calculates area and compares multiple circles
 *@author Daniel Heck heckds@jmu.edu
 *@version 1.1 9/17/08
 */
public class Circle
{
  private double radius;
  
  /*
   *Takes in a double r representing radius and sets
	*it locally to class variable radius
   *@param double r : Recieves a double value
   */
  public Circle  (double r)
  {
    radius = r;
  }//end implicit value contructer
  
  /*
   * Uses the class varible radius and preforms arthimetic
	* Using the Static class math
	*@return double formula for radius calculation
	*/
  public double getArea()
  { 
    return Math.PI * radius * radius; //return pi(r squared) using math class  
  }//end getArea
  
  /*
   * A method holding the radius to be picked up
	*@return double radius : the inputed radius
	*/
  public double getRadius()
  {
     return radius; //returns the current radius
  }//end getRadius
  
  /*
   *A method that returns a string containing both
	* the begining radius set in and the finished area
	*@return String circle : String containing radius and area
	*/
	public String toString()
	{
		String circle;
		
		circle = "The radius is " + getRadius() + ", and the area is " + getArea();
		
		return circle; //returns a string containing circle's radius + area
	}//end toString
	
	/*
	 *This method takes in a circle method and then compares
	 *its contents with the current varibles
	 *@param Circle circle takes in a circle object
	 */
	public boolean equals(Circle circle)
	{
		boolean equal;	//declare local variable equal to return equvilence
		
		equal = false; //initialize equal outside if to avoid initialization error
		
		//if the sent in circle's raidus = the class's radius
		//and if the sent in circles area = the class's area
		if(circle.getRadius() == getRadius() && circle.getArea() == getArea())
		{
			equal = true; //Set equal to true if area + radius are equalivent
		}//end if
		//if either is false boolean will remain false
		
		return equal;
	}//end equals
	 
	/*
	 *This method accepts a Circle object as an argument.
	 *It will return true if the argument object has an area
	 *that is greater than the area of the calling object, or false otherwise
	 *@param Circle circle takes in a circle object
	 */
	public boolean greaterThan(Circle circle)
	{
		boolean greater;//declare local variable greater for returning if greater than
		
		greater = false;//initialize greater outside if to avoid initialization error
		//If the calling objects area is less than the arguments get area return true
		if(circle.getArea() < getArea())
			greater = true;
		//if not greater remains false
		
		return greater;
	}//end greaterThan
}//end class