|
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.ObjectCircle
public class Circle
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(Circle otherCircle)
Copy constructor: Creates a copy of the given circle. |
|
Circle(double x,
double y,
double radius)
Creates a circle with center at the given x-y position, 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. |
double |
getRadius()
Returns the radius of the circle. |
double |
getX()
Returns the X coordinate of the circle's center. |
double |
getY()
Returns the Y coordinate of the circle's center. |
boolean |
overlap(Circle otherCircle)
Determines whether this circle overlaps with another given circle. |
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 |
---|
public static final double PI
Constructor Detail |
---|
public Circle(double x, double y, double radius)
x
- X coordinate of the circle's centery
- Y coordinate of the circle's centerradius
- Radius of the circlepublic Circle(Circle otherCircle)
otherCircle
- Circle to be copied.public Circle()
Method Detail |
---|
public static double area(double radius)
radius
- Radius of the circle.
public static double circum(double radius)
radius
- Radius of the circle.
public double getX()
public double getY()
public double getRadius()
public boolean overlap(Circle otherCircle)
otherCircle
- Other circle for comparison of overlap.
public java.lang.String toString()
toString
in class java.lang.Object
public boolean equals(java.lang.Object obj)
equals
in class java.lang.Object
obj
- Object to be compared for equality
|
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |