class room
{
int length;
int breadth;
room(int x,int y)
{
length=x;
breadth=y;
}
int area()
{
return (length*breadth);
}
}
class bedroom extends room
{
int height;
bedroom(int x,int y,int h)
{
super(x,y);
height = h;
}
int volume()
{
return (length*breadth*height);
}
}
class assignment1
{
public static void main(String args[])
{
bedroom O=new bedroom(14,12,10);
int Area=O.area();
int Volume=O.volume();
System.out.println("area=" +Area);
System.out.println("volume=" +Volume);
}
}
No comments:
Post a Comment