Skip to content

Commit df90af7

Browse files
authored
Merge pull request #41 from abhijeet49/main
Added MultiClassDemo.java file
2 parents 2deb06c + d8ad866 commit df90af7

File tree

1 file changed

+46
-0
lines changed

1 file changed

+46
-0
lines changed

MulticlassDemo.java

Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
class Circle
2+
{
3+
4+
double r;
5+
double circumference()
6+
{
7+
return 2*3.14*r;
8+
}
9+
double area()
10+
{
11+
return (22/7)*r*r;
12+
}
13+
}
14+
class Box
15+
{
16+
double width;
17+
double height;
18+
double depth;
19+
double area()
20+
{
21+
double a;
22+
a=(width*height + height*depth + width*depth)*2;
23+
return a;
24+
}
25+
double volume()
26+
{
27+
double v;
28+
v=width*height*depth;
29+
return v;
30+
}
31+
32+
}
33+
class MulticlassDemo
34+
{
35+
public static void main(String args[])
36+
{
37+
Circle c= new Circle();
38+
Box b=new Box();
39+
c.r=5.0;
40+
b.width=3.0;b.height=4.0;b.depth=5.0;
41+
System.out.println("Circumference Circle: "+c.circumference());
42+
System.out.println("Area circle: "+c.area());
43+
System.out.println("Area of Box: "+b.area());
44+
System.out.println("Volume of Box: "+b.volume());
45+
}
46+
}

0 commit comments

Comments
 (0)