// UEBUNG 10 AUFGABE 3 import gdi.util.*; public class u10a1c { public static void main(String[] args) { Reise_2 reise = new Reise_2(); // s. A2 while(true) { ReiseStation_3 station = new ReiseStation_3(); Out.print("Name: "); station.name = In.readWord(); if (!In.done()) break; Out.print("Kommentar: "); station.kommentar = In.readString(); station.datum = new Datum(); Out.print("Tag: "); station.datum.tag = In.readInt(); Out.print("Monat: "); station.datum.monat = In.readInt(); Out.print("Jahr: "); station.datum.jahr = In.readInt(); if (reise.ersteStation == null) { reise.ersteStation = station; } else { ReiseStation_3 x = reise.ersteStation; while(x.naechsteStation != null) x = x.naechsteStation; // x.naechsteStation == null ==> x ist letzte Station x.naechsteStation = station; } } Out.println("Die Reise:"); ReiseStation_3 x = reise.ersteStation; while(x != null) { Out.println("Station: " + x.name + ", Kommentar: " + x.kommentar + " Datum: " + x.datum.tag + "." + x.datum.monat + "." + x.datum.jahr); x = x.naechsteStation; } } }