-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path_51Cuboid.java
47 lines (42 loc) · 1.12 KB
/
_51Cuboid.java
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
class Cuboid{
//setters
private int length,breath,height;
public void setLength(int l){
length=l;
}
public void setBreath(int b){
breath=b;
}
public void setHeight(int h){
height=h;
}
//getters- it returns the value
public int getLength(){
return length;
}
public int getBreath(){
return breath;
}
public int getHeight(){
return height;
}
public int getVolume(){
return length*breath*height;
}
public int getSurfaceArea(){
return 2*(length*breath+breath*height+height*length);
}
}
public class _51Cuboid{
public static void main(String []args){
Cuboid obj=new Cuboid();
obj.setLength(45);
obj.setBreath(34);
obj.setHeight(12);
System.out.println("Length="+obj.getLength());
System.out.println("Breath="+obj.getBreath());
System.out.println("Height="+obj.getHeight());
System.out.println("Volume="+obj.getVolume());
System.out.println("Surface Area="+obj.getSurfaceArea());
}
}