-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathplate.java
More file actions
51 lines (44 loc) · 1.39 KB
/
Copy pathplate.java
File metadata and controls
51 lines (44 loc) · 1.39 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
import java.util.*;
class plate {
int length, width;
plate(int l, int w) {
length = l;
width = w;
System.out.println("Dimensions of the plate \nLength : " + length + " Width : " + width);
}
}
class box extends
plate {
int height;
box(int l, int w, int h) {
super(l, w);
height = h;
System.out.println("Dimensions of the box \nLength : " + length + " Width : " + width + " Height : " + height);
}
}
class woodbox extends box {
int thick;
woodbox(int l, int w, int h, int t) {
super(l, w, h);
thick = t;
System.out.println("Dimensions of the wood box \nLength : " + length + " Width : " + width + " Height : "
+ height + " Thickness : " + thick);
}
}
class Plate1 {
public static void main(String args[]) {
Scanner sc = new Scanner(System.in);
System.out.println("Enter the dimensions of plate");
System.out.print("Enter length :");
int l = sc.nextInt();
System.out.print("Enter width :");
int w = sc.nextInt();
System.out.println("Enter the dimensions of box");
System.out.print("Enter height :");
int h = sc.nextInt();
System.out.println("Enter the dimensions of wood box");
System.out.print("Enter thickness :");
int t = sc.nextInt();
woodbox wb = new woodbox(l, w, h, t);
}
}