第七周作业

public class newclass {
     int length;
     int width;
     public void getArea(){
         System.out.println("s="+length*width);
   }
     public void getPer(){
         System.out.println("c="+(length+width)*2);
    }
     public void showAll(){
         System.out.println("s="+length);
         System.out.println("c="+width);
         getArea();
         getPer();
     }

}
public class newclass {
 
    public static void main(String[] args) {
        Rectangle R=new Rectangle();
        R.length=3;
        R.width=2;
         
        R.showAll();
        R.getArea();
        R.getPer();
    }
}
原文地址:https://www.cnblogs.com/rxy2000/p/12751364.html