public class MainVererbung3{
	public static void main(String[] args){
		Rechteck m = new Rechteck(10,20);
		Quader g = new Quader(2,3,4);
		double w1, w2;
	  
		w1= m.getInhalt();
		w2= g.getInhalt(); 
		System.out.println(w1+" "+w2+" ");
	}
}

/*
Spezifikation der Methode public double getInhalt():
Berechnet den Inhalt eines Rechtecks oder Quaders:
Quader:   Volumeninhalt
Rechteck: Flächeninhalt
*/

class Rechteck{  
	private double l;
	private double b;
	
	public Rechteck(double pl, double pb){
		l = pl;
	    b = pb;
    }

	public void setL(double pl){
		l = pl;
    }

	public void setB(double pb){
		b = pb;
	}

	public double getL(){
		return(l);
    }

	public double getB(){
		return(b);
	}

	public double getInhalt(){
		return(l*b);
	}
};

class Quader extends  Rechteck{  
	private double h;

	public Quader(double pl, double pb, double hh){
		super(pl,pb);
		setH(hh);
	}
	
	public void setH(double ph){
		h = ph;
	}

	public double getH(){
		return(h);
	}

	public double getInhalt(){
		return(getB()*getL()*h);
	}
	
	public double getOberFlaecheninhalt(){
		return(2*(h*getB()+h*getL()+getL()*getB()));
	}
}





  
	
