-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathclassbox.java
More file actions
57 lines (45 loc) · 1.36 KB
/
classbox.java
File metadata and controls
57 lines (45 loc) · 1.36 KB
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
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
import java.util.*;
public class classbox {
private int length;
private int breadth;
private int height;
classbox(){
int length = 0;
int breadth = 0;
int height = 0;
}
classbox(int length, int breadth, int height){
this.length = length;
this.breadth = breadth;
this.height = height;
}
classbox(classbox b1){
this.length = b1.length;
this.breadth = b1.breadth;
this.height = b1.height;
}
int getlength(){
return length;
}
int getbreadth(){
return breadth;
}
int getheight(){
return height;
}
long getvolume(){
return (long) length * breadth * height;
}
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
int l = sc.nextInt();
int b = sc.nextInt();
int h = sc.nextInt();
classbox b1 = new classbox();
System.out.println(b1.getlength() + " " + b1.getbreadth() + " " + b1.getheight() + " " + b1.getvolume());
classbox b2 = new classbox(l, b, h);
System.out.println(b2.getlength() + " " + b2.getbreadth() + " " + b2.getheight() + " " + b2.getvolume());
classbox b3 = new classbox(b2);
System.out.println(b3.getlength() + " " + b3.getbreadth() + " " + b3.getheight() + " " + b3.getvolume());
}
}