package wangku;
public abstract class Shape{
double getCir(){
return 0.0;
}
double getArea(){
return 0.0;
}
}
public class Point extends Shape implements Printable{
double x,y;
Point (){};
Point(double x,double y){
this.x=x;
this.y=y;
}
double setX(double x){
this.x=x;
return x;
}
double setY(double y){
this.y=y;
return y;
}
double getX(){
return x;
}
double getY(){
return y;
}
double getCir(){
return 0.0;
}
double getArea(){
return 0.0;
}
public void PrintItMyWay(){
System.out.println( Double.toString(x)+Double.toString(y)+0.0+0.0);
}
}
public class Circle extends Point{
double r;
Point centre;
Circle(){};
Circle(double x,double y,double r){
super(x,y);
this.r=r;
}
double setR(double r){
this.r=r;
return r;
}
double getR(){
return r;
}
double getCir(){
if(r<0) System.out.println("半径错了");
double l=2*Math.PI*r;
return l;
}
double getArea(){
if(r<0) System.out.println("半径错了");
double s=Math.PI*r*r;
return s;
}
public void PrintItMyWay(){
System.out.println("");
}
}
public interface Printable{
void PrintItMyWay();
}