第十二次Java作业

public class eee {
     int x;
     int y;
     public eee(int x0,int y0){
         x=x0;
         y=y0;
         
         
     }
        public eee(){
            
        }
        public String movePoint(int dx,int dy){
            x+=dx;
            y+=dy;
            return ("x"+x+" "+"y"+y);
        }
           public static void main(String[] args) {
               eee p1=new eee(1,5);
               System.out.println("p1是"+p1.movePoint(1, 5));
               eee p2=new eee(2,3);
               System.out.println("p2是"+p2.movePoint(2, 3)); 
}
}

public class eee {
          int length;
          int width;
          public int getArea(int length,int width){
              return length*width;
              
          }
            public int getPer(int length,int width){
                return (length+width)*2;
            }
              public void shwAll(){
                  System.out.println("length=" + length + " "+" width=" + width + " "+"周长"+(length+width)*2+" "+"面积"+length*width);
                  
              }
              public eee (int length,int width){
                  this.length=length;
                  this.width=width;
                  
              }
              public static void main(String[] args) {
                  eee a=new eee(7,2);
                 a.shwAll();
              }
}

public class eee {
        char color;
          int cpu;
          public eee(){
              
          }
          public eee(char color,int cpu){
              this.color =color;
              this.cpu=cpu;
          }
          public void show(){
              System.out.println("笔记本颜色是"+color+" "+"型号是"+cpu);
          }

    



       
        public static void main(String[] args) {
            // TODO Auto-generated method stub
            eee a1=new eee ('粉',3);
            eee a2=new eee('红',2);
            a1.show();
            a2.show();
        }

}

posted @ 2021-05-25 17:51  w-j  阅读(32)  评论(0编辑  收藏  举报