发布网友
共2个回答
热心网友
......
热心网友
public class Rectangle {
public double len;
public double width;
public double getArea(double len,double width){
return len*width;
}
public double getLen() {
return len;
}
public void setWidth(double len) {
this.len = len;
}
public double getWidth() {
return width;
}
public void setWidth(double width) {
this.width = width;
}
public static void main(String[] args) {
Rectangle r = new Rectangle(40, 10);
System.out.println(r.getArea(r.getLen(), r.getWidth()));
}
}
热心网友
......
热心网友
public class Rectangle {
public double len;
public double width;
public double getArea(double len,double width){
return len*width;
}
public double getLen() {
return len;
}
public void setWidth(double len) {
this.len = len;
}
public double getWidth() {
return width;
}
public void setWidth(double width) {
this.width = width;
}
public static void main(String[] args) {
Rectangle r = new Rectangle(40, 10);
System.out.println(r.getArea(r.getLen(), r.getWidth()));
}
}