-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathBox.java
More file actions
28 lines (20 loc) · 932 Bytes
/
Box.java
File metadata and controls
28 lines (20 loc) · 932 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
package HW_160523e;
public class Box {
// Создайте класс Box, в котором будут три поля:
// ширина, высота, длина этой коробки. Создайте внутри
// этого класса конструктор, который принимает 3 значения
// и определяет их в вышеописанные поля, помимо этого в
// конструкторе подсчитывается объём коробки и печатается на экран.
public double length;
public double height;
public double width;
public Box(double length,double height,double width) {
this.length = length;
this.height = height;
this.width = width;
printSquare();
}
public void printSquare (){
System.out.println("Square = " + length * height * width);
}
}