-
Notifications
You must be signed in to change notification settings - Fork 0
/
Areaandvolume.java
48 lines (46 loc) · 922 Bytes
/
Areaandvolume.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
48
import java.util.*;
class room
{
int length,breadth,width,height;
Scanner sc= new Scanner(System.in);
void getdata()
{
System.out.println("Enter Length of room:");
length=sc.nextInt();
System.out.println("Enter Breadth of room:");
breadth=sc.nextInt();
System.out.println("Enter Width of room:");
width=sc.nextInt();
System.out.println("Enter Hight of room:");
height=sc.nextInt();
}
}
class operation extends room
{
int area,volume;
void area()
{
area=(length*breadth);
}
void volume()
{
volume=(length*height*width);
}
void display()
{
System.out.println("Area of Room="+area);
System.out.println("Volume of Room="+volume);
}
}
public class Areaandvolume
{
public static void main(String args[])
{
operation o1=new operation();
o1.getdata();
o1.area();
o1.volume();
System.out.println("***AREA & VOLUME OF ROOM***");
o1.display();
}
}