public class Abstractor Area{
public abstractor double area();
}
public class RoundArea{
public RoundArea(double ra){this.area=ra}
private double area;
public double area(){
//求圆的面积
}
}
public class RectArea {
private double width;
private double leng;
public RectArea(double width,double leng){this.width = width; this.leng=leng}
public double area(){
//求长方形的面积
}
}
class ImpleArea{
BufferedReader br=new BufferedReader(new InputStreamReader(System.in));
area=br.read();
width= br.read();
leng = br.read();
RoundArea ra = new RoundArea(area);
double area1 = ra.area();
RectArea ra2 = new RectArea(width,leng);
double area2 = ra2.area();
}
大概写了下 参考一下吧
温馨提示:内容为网友见解,仅供参考