From 33613a85afc4b1481367fbe92a17ee59c240250b Mon Sep 17 00:00:00 2001 From: Sven Eisenhauer Date: Fri, 10 Nov 2023 15:11:48 +0100 Subject: add new repo --- .../hjp5/examples/Listing0905.java | 27 ++++++++++++++++++++++ 1 file changed, 27 insertions(+) create mode 100644 Master/Reference Architectures and Patterns/hjp5/examples/Listing0905.java (limited to 'Master/Reference Architectures and Patterns/hjp5/examples/Listing0905.java') diff --git a/Master/Reference Architectures and Patterns/hjp5/examples/Listing0905.java b/Master/Reference Architectures and Patterns/hjp5/examples/Listing0905.java new file mode 100644 index 0000000..8f84d86 --- /dev/null +++ b/Master/Reference Architectures and Patterns/hjp5/examples/Listing0905.java @@ -0,0 +1,27 @@ +/* Listing0905.java */ + +public class Listing0905 +{ + public static long grundflaeche(Groesse g) + { + return (long)g.laenge() * g.breite(); + } + + public static void main(String[] args) + { + //Zuerst erzeugen wir ein Auto2... + Auto2 auto = new Auto2(); + auto.laenge = 4235; + auto.hoehe = 1650; + auto.breite = 1820; + //Nun ein DIN A4-Blatt... + PapierBlatt blatt = new PapierBlatt(); + blatt.format = 4; + //Und zum Schluß einen Fußballplatz... + FussballPlatz platz = new FussballPlatz(); + //Nun werden sie ausgegeben + System.out.println("Auto: " + grundflaeche(auto)); + System.out.println("Blatt: " + grundflaeche(blatt)); + System.out.println("Platz: " + grundflaeche(platz)); + } +} \ No newline at end of file -- cgit v1.2.3