第七次java作业

public class fff {
     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 fff {
 
    public static void main(String[] args) {
        Rectangle R=new Rectangle();
        R.length=3;
        R.width=2;
         
        R.showAll();
        R.getArea();
        R.getPer();
    }
}

 

posted @ 2020-04-19 15:58  啪啪怪  阅读(105)  评论(0编辑  收藏  举报