16 lines
596 B
Java
16 lines
596 B
Java
public class Circle extends Point {
|
|
private double radius;
|
|
|
|
public Circle() { radius = 1; }
|
|
public Circle(double radius) { this.radius = radius; }
|
|
public Circle(int x, int y, double radius) { super(x, y); this.radius = radius; }
|
|
public Circle(int x, int y) { super(x, y); radius = 1; }
|
|
|
|
public double getRadius() { return radius; }
|
|
public void setRadius(double radius) { this.radius = radius; }
|
|
|
|
public double area() { return Math.PI * radius * radius; }
|
|
|
|
public String toString() { return "Circle of radius " + radius + " at point [" + x + "," + y + "]"; }
|
|
}
|