题目是第十三题
}
第二个代码
public class RoundArea extends Area{
public RoundArea(double radius) {
this.radius=radius;
}
public double area(double radius) {
double s;
s=Math.PI*radius*radius;
return s;
}
}
第三个代码
public class RectArea extends Area {
public RectArea(double len,double wid) {
this.len=len;
this.wid=wid;
}
public void set_len(double l) {
len=l;
}
public double get_len() {
return len;
}
public void set_wid(double w) {
wid=w;
}
public double get_wid() {
return wid;
}
public double area(double s) {
//double s;
s=len*wid;
return s;
}
}
第四个代码
public class ImpleArea {
public static void main(String[] args) {
RoundArea roundArea=new RoundArea(3);
System.out.printf("圆的面积为:"+"s");
System.out.println();
RectArea rectArea=new RectArea(4,5);
System.out.printf("矩形的面积为:"+"s");
}
}
运行结果
不是不想帮你看,代码有点乱