CODE:
class Roomarea 
{ 
protected double l, b;
Roomarea(double len, double br)
{
l=len;
b=br;
}
void putdata()
{
System.out.println("Area of Room:
"+(l*b));
}
} 
class Roomvol extends Roomarea  
{
double h;
Roomvol(double len, double br, double he)
{
super(len, br);
h=he;  
}
void putdata()
{
super.putdata();
System.out.println("Volume of Room:
"+(l*b*h));
}
} 
public class EXP18Q4 
{ 
public static void main(String[] args)
{ 
Roomvol r1 = new Roomvol(10, 20, 10); 
r1.putdata(); 
} }
Comments
Post a Comment