You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
35 lines
723 B
35 lines
723 B
public class Circle extends Shape{
|
|
private double radius;
|
|
|
|
public Circle() {
|
|
super();
|
|
this.radius = 1.0;
|
|
}
|
|
|
|
public Circle(double radius) {
|
|
super();
|
|
this.radius = radius;
|
|
}
|
|
|
|
public Circle(double radius,boolean isFilled,String color){
|
|
super(isFilled, color);
|
|
this.radius = radius;
|
|
}
|
|
|
|
public void setRadius(double radius){
|
|
this.radius = radius;
|
|
}
|
|
|
|
public double getRadius() {
|
|
return this.radius;
|
|
}
|
|
|
|
public String toString() {
|
|
String ret = "";
|
|
ret += "Radius: " + this.radius + "\n";
|
|
double area = Math.PI * Math.pow(this.radius,2);
|
|
ret += "Area: " + area + "\n";
|
|
ret += super.toString();
|
|
return ret;
|
|
}
|
|
}
|