rendered paste bodyclass Wohnung{ private double flaecheInnen; private double flaecheBalkon; public Wohnung(double innen, double balkon){ this.setInnen(innen); this.setBalkon(balkon); } public Wohnung(){ this(100.0, 10.0); } public void setInnen(double innen){ this.flaecheInnen = innen; } public double getInnen(){ return this.flaecheInnen; } public void setBalkon(double balkon){ this.flaecheBalkon = balkon; } public double getBalkon(){ return this.flaecheBalkon; } public double getGesamt(){ return this.getInnen() + this.getBalkon() / 2; } public String toString(){ String result = ""; result = "Wohnung\n"; result = result + "\tInnenraum: " + this.getInnen() + "\n"; result = result + "\tBalkon: " + this.getBalkon() + "\n"; result = result + "\tGesamt: " + this.getGesamt() + "\n"; return result; }}class Dachwohnung extends Wohnung { private double flaecheSchraegen; public Dachwohnung() { this(100.0, 10.0, 15.0); } public Dachwohnung(double innen, double balkon, double schraegen) { super(innen, balkon); this.flaecheSchraegen = schraegen; } public void setSchraegen(double schraegen){ this.flaecheSchraegen = schraegen; } public double getSchraegen(){ return this.flaecheSchraegen; } public double getGesamt(){ return this.getInnen() + this.getBalkon() / 2 - this.getSchraegen() / 2; } public String toString(){ String result = ""; result = "Dachwohnung\n"; result = result + "\tInnenraum: " + this.getInnen() + "\n"; result = result + "\tBalkon: " + this.getBalkon() + "\n"; result = result + "\tSchraegen: " + this.getSchraegen() + "\n"; result = result + "\tGesamt: " + this.getGesamt() + "\n"; return result; }} public class Start{ public static void main (String[] args) { Wohnung w1 = new Wohnung(40.0, 10.0); Wohnung w2 = new Wohnung(80.0, 15.0); System.out.println(w1.toString()); System.out.println(w2.toString()); System.out.println(w1.getGesamt() + w2.getGesamt()); System.out.println("\n \n"); Dachwohnung d1 = new Dachwohnung(40.0, 10.0, 8.0); Dachwohnung d2 = new Dachwohnung(80.0, 15.0, 4.0); System.out.println(d1.toString()); System.out.println(d2.toString()); System.out.println(d1.getGesamt() + d2.getGesamt()); }}