Class Circle

java.lang.Object
  extended by Circle

public class Circle
extends java.lang.Object


Field Summary
static double PI
          Contains the value of pi to four decimal places.
 
Constructor Summary
Circle()
          Creates a circle at the origin with radius 1.
Circle(MutablePoint p, double radius)
          Creates a circle with center at the given point, with the given radius.
 
Method Summary
static double area(double radius)
          Calculates the area of a circle with the given radius.
static double circum(double radius)
          Calculates the circumference of a circle with the given radius.
 boolean equals(java.lang.Object obj)
          Determines whether this circle is equal to a provided object.
 MutablePoint getPoint()
          Returns the circle's center.
 double getRadius()
          Returns the radius of the circle.
static int numCircles()
          Returns the number of circle objects that have been created.
 java.lang.String toString()
          Converts the object to a string.
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

PI

public static final double PI
Contains the value of pi to four decimal places.

See Also:
Constant Field Values
Constructor Detail

Circle

public Circle(MutablePoint p,
              double radius)
Creates a circle with center at the given point, with the given radius.

Parameters:
p - MutablePoint containing the circle's center.
radius - Radius of the circle

Circle

public Circle()
Creates a circle at the origin with radius 1.

Method Detail

area

public static double area(double radius)
Calculates the area of a circle with the given radius.

Parameters:
radius - Radius of the circle.
Returns:
Area of the circle.

circum

public static double circum(double radius)
Calculates the circumference of a circle with the given radius.

Parameters:
radius - Radius of the circle.
Returns:
Circumference of the circle.

getPoint

public MutablePoint getPoint()
Returns the circle's center.

Returns:
Circle's center point.

getRadius

public double getRadius()
Returns the radius of the circle.

Returns:
Radius of the circle.

toString

public java.lang.String toString()
Converts the object to a string.

Overrides:
toString in class java.lang.Object
Returns:
String representation of the object.

equals

public boolean equals(java.lang.Object obj)
Determines whether this circle is equal to a provided object. Two circles are equal if they have the same center and radius.

Overrides:
equals in class java.lang.Object
Parameters:
obj - Object to be compared for equality
Returns:
True if equal, false otherwise

numCircles

public static int numCircles()
Returns the number of circle objects that have been created.

Returns:
Number of created circles.