package changfangxing;
public class Rectangle{
double length;
double width;
public Rectangle(int width,int length){
this.length=length;
this.width=width;
}
public double getArea(int length,int width){
return this.length*this.width;
}
public double getPer(int length,int width){
return 2*(this.length+this.width);
}
public void showAll(){
System.out.println("长"+this.length+","+this.width);
System.out.println("面积是"+this.length*this.width);
System.out.println("周长是"+2*(this.length+this.width));
}
}
package changfangxing;
public class Test {
public static void main(String[] args) {
// TODO Auto-generated method stub
Rectangle r=new Rectangle(2,4);
r.showAll();
}
}