Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
46 changes: 46 additions & 0 deletions MulticlassDemo.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,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());
}
}