-
Notifications
You must be signed in to change notification settings - Fork 64
Expand file tree
/
Copy pathMulticlassDemo.java
More file actions
46 lines (44 loc) · 931 Bytes
/
MulticlassDemo.java
File metadata and controls
46 lines (44 loc) · 931 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
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
class Circle
{
double r;
double circumference()
{
return 2*3.14*r;
}
double area()
{
return (22/7)*r*r;
}
}
class Box
{
double width;
double height;
double depth;
double area()
{
double a;
a=(width*height + height*depth + width*depth)*2;
return a;
}
double volume()
{
double v;
v=width*height*depth;
return v;
}
}
class MulticlassDemo
{
public static void main(String args[])
{
Circle c= new Circle();
Box b=new Box();
c.r=5.0;
b.width=3.0;b.height=4.0;b.depth=5.0;
System.out.println("Circumference Circle: "+c.circumference());
System.out.println("Area circle: "+c.area());
System.out.println("Area of Box: "+b.area());
System.out.println("Volume of Box: "+b.volume());
}
}