You are on page 1of 1

import java.io.

DataInputStream; class Room { int l,b; Room(int x,int y) { l=x; b=y; } int area() { return(l*b); } } class Bedroom { int h; Bedroom(int x,int y,int z) { super(x,y); h=z; } int volume() { return(l*b*h); } } class Single { public static void main(String[] args) { int ar,vol,x,y,z; try { DataInputStream d=new DataInputStream(System.in); System.out.println("Enter the length, breadth, and height of room:"); x=Integer.parseInt(d.readLine()); y=Integer.parseInt(d.readLine()); z=Integer.parseInt(d.readLine()); Bedroom b=new bedroom(x,y,z); ar=b.area(); vol=b.volume(); } catch(Exception e){} } }

You might also like