forked from manibhushan20/OOPs-in-Java
-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathCuboid.java.txt
More file actions
31 lines (24 loc) · 709 Bytes
/
Cuboid.java.txt
File metadata and controls
31 lines (24 loc) · 709 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
29
// Cuboid.java
package geometry;
public class Cuboid {
private int height;
private int width;
private int length;
public Cuboid(int height, int width, int length) {
this.height = height;
this.width = width;
this.length = length;
}
public void display() {
System.out.println("Cuboid Details:");
System.out.println("Height: " + height);
System.out.println("Width: " + width);
System.out.println("Length: " + length);
}
public int calculateVolume() {
return height * width * length;
}
public int calculateSurfaceArea() {
return 2 * (length * width + width * height + height * length);
}
}