/* ÜBUNG 11 AUFGABE 18 */ // Da wir uns hier die Klassenmethoden zum Setzen und Auslesen zunächst // sparen, sind hier alle Variablen ausnahmsweise public. // Statt "int" können wir hier für "bestellt/nicht bestellt" // den Datentyp "boolean" verwenden, und anstelle // "char *" die Java-Klasse "String". class ItalienischesGericht { public String name; public float preis_euro; public ItalienischesGericht() { // Konstruktor, Aufgabe 19 System.out.println("Italienisches Gericht bestellt."); } } class Pasta extends ItalienischesGericht { public boolean ueberbacken; public boolean extra_kaese; public Pasta() { // Konstruktor, Aufgabe 19 System.out.println("Pasta bestellt."); } } class Lasagne extends Pasta { public boolean bolognese; public boolean spinat; public Lasagne() { // Konstruktor, Aufgabe 19 System.out.println("Hole Lasagne."); } } class Pizza extends ItalienischesGericht { public boolean salami; public boolean extra_scharf; public boolean pilze; public boolean pepperoni; public boolean paprika; public boolean artischocken; public boolean extra_kaese; public Pizza() { // Konstruktor, Aufgabe 19 System.out.println("Hole Pizza."); } } public class u11 { public static void main(String[] args) { Lasagne spinacci = new Lasagne(); spinacci.preis_euro = 4.50F; System.out.println("Der Preis beträgt jetzt " + spinacci.preis_euro + " Euro."); } }