0
0

                                             

  public class Box {
    double length ;
    double width ;
    double height ;

    Box() {
       length = 0;
       width  = 0;
        height = 0;
    }

     Box(double length ,double width ,double height ) {
          this.length = length;
          this.width = width;
          this.height = height;
     }

     Box(double size) {
        this.length =size;
        this.width  = size;
        this.height = size;
     }

     Box(Box box) {
          this.length = box.length;
          this.width  = box.width;
          this.height = box.height;
     }

     Box(Box box1, Box box2) {
         this.length = box1.length + box2.length;
         this.width  = box1.width  + box2.width;
         this.height = box1.height + box2.height;

        }

       Box sumBox(Box box) {
        return  new Box(this.length,this.width,this.height);
       }



}
    public class Main {
    public static void main(String[] args) {
        Box box1 = new Box(10);
        Box box2 = new Box(2, 5, 4);
        Box box3 = new Box();
        box3.sumBox(box1 );

        

student_lNE2gaYf
3 years ago






Еще нет ответов