//  Author:  Nancy Harris - Modefied by Mohamed Aboutabl
//  Modification:  10/12/04
//  Assignment - Class Methods

/** Circle:  contains methods to calculate common values related to circles based
             on the value of the radius.
 */


import java.util.Random;

public class Circle
{
 	// This variable is available to all methods.  It holds the radius of the 
	// circle object.  
	private double radius;
	private final double DEFAULT_RADIUS = 1.0 ;
	private static final Random GEN = new Random() ;
  
	/** Circle
	    input:  size of the radius of the circle
		 output: none
		 The value in the size parameter is stored in the attribute, radius 
	 */     
	public Circle(double size)
	{
		if ( size <= 0 )
		{
			radius = DEFAULT_RADIUS;
			System.out.println("\n## Error creating a Circle object! The non-positive value " +
				size + " is rejected. A radius of " + DEFAULT_RADIUS + " is used instead." );
		}
		else
			radius = size;
	}
	
	public Circle()
	{
		radius = 50 * Math.random() + 1 ;
		System.out.println("\nA Circle object has been created with a random radius of " +
			radius ) ;
	}
	
	/** calcArea
		 input:  none
		 output: the calculated area of this circle based on radius
		 describe behavior here.
	 */
	public double calcArea()
	{
	 
		double area ;
		
		area = radius * radius * Math.PI ;		
		
		return area ;
	}
	
	/** calcCircumference
		 input:  none
		 output: the calculated circumference of this circle based on radius
		 describe behavior here.
	 */
	public double calcCircumference()
	{
		double circum ;
		
		circum = 2 * radius * Math.PI ;
				
		return circum ;
	}
		/** getRadius
		 input:  none
		 output: the radius of the circle
		 describe behavior here.
	 */
	public double getRadius()
	{
	 
		return radius;
	}

} // end Circle