Professional Documents
Culture Documents
{
float length,width,height;
byte nWindows;
static int totWindows;
Room(){};
Room (float l,float w,float h,byte n)
{
length=1;width=w;height=h;
nWindows=n;totWindows+=n;
}
Room(float 1,float w)
{
length=l;width=w;height=10;
nWindows=2; totWindows++;
}
double area()
{
return(length*height);
void display()
{
system.out.println("\nLength:"+length+"\nWidth"+width);
system.out.println("Heigth:"+heigth);
system.out.println("Windows:"+nwindows);
}
}
}
class inheritance
{
public static void main(String args[])
{
Room r1=new Room(20,15,10,(byte)2);
r1.display();
Classroom cr1=new Classroom(30,20,12,(byte)3,21,3);
cr1.show();
system.out.println("Area of classroom1 is "+cr1.area()+"square feet");
cr2.display();
system.out.println("\nTotal number of Windows:"+Room.totWindows);
}