14 lines
606 B
Java
14 lines
606 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 String.format("Circle of radius %.2f at point %s", radius, super.toString()); }
|
|
} |