JavaDoc
Class Circle
java.lang.Object
|
+--JavaDoc.Circle
- public class Circle
- extends java.lang.Object
Simple circle class to do basic circle arithmetic
- Version:
- 1.0
- Author:
- Adrian Colyer
Field Summary |
protected java.awt.Point |
centre
The centre of the circle |
protected int |
radius
The radius of the circle |
Constructor Summary |
Circle(java.awt.Point centre,
int radius)
Circle constructor to create a new instance of the circle class passing in
a radius and centre. |
Method Summary |
double |
area()
Calculate the area of the circle. |
double |
circumference()
Calculate the circumference of the circle |
void |
setCentre(int x,
int y)
Set the centre of the circle. |
void |
setRadius(int r)
Set the radius of the circle. |
Methods inherited from class java.lang.Object |
, clone, equals, finalize, getClass, hashCode, notify, notifyAll, registerNatives, toString, wait, wait, wait |
radius
protected int radius
- The radius of the circle
centre
protected java.awt.Point centre
- The centre of the circle
Circle
public Circle(java.awt.Point centre,
int radius)
- Circle constructor to create a new instance of the circle class passing in
a radius and centre.
circumference
public double circumference()
- Calculate the circumference of the circle
- Returns:
- the circumference
- See Also:
area()
area
public double area()
- Calculate the area of the circle.
- Returns:
- the area
- See Also:
circumference()
setCentre
public void setCentre(int x,
int y)
- Set the centre of the circle.
- Parameters:
x
- the x co-ordinatey
- the y co-ordinate
setRadius
public void setRadius(int r)
- Set the radius of the circle.