From f36108bc3cbb49b6c9b6c1756c1735e24977e3ab Mon Sep 17 00:00:00 2001 From: Christian Baltzer Date: Tue, 16 Jul 2019 17:00:20 +0200 Subject: [PATCH] =?UTF-8?q?alle=20tests=20gr=C3=BCn?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../java/ugsbo/com/notenSpeicher/Auswertung.java | 11 ++++++++--- .../java/ugsbo/com/notenSpeicher/NotenKette.java | 15 +++++++++++++++ 2 files changed, 23 insertions(+), 3 deletions(-) diff --git a/src/main/java/ugsbo/com/notenSpeicher/Auswertung.java b/src/main/java/ugsbo/com/notenSpeicher/Auswertung.java index 57b3a61..09ce0fc 100644 --- a/src/main/java/ugsbo/com/notenSpeicher/Auswertung.java +++ b/src/main/java/ugsbo/com/notenSpeicher/Auswertung.java @@ -3,8 +3,13 @@ package ugsbo.com.notenSpeicher; public class Auswertung { public static void main(String[] args) { - // TODO Auto-generated method stub - + NotenKette Work = new NotenKette("Prog 1", 1); + Work.add("Prog 2", 2); + Work.add("Wi", 3); + + System.out.println(Work.durchschnitt() + "\n"); + + System.out.print(Work.toString()); } -} +} \ No newline at end of file diff --git a/src/main/java/ugsbo/com/notenSpeicher/NotenKette.java b/src/main/java/ugsbo/com/notenSpeicher/NotenKette.java index 41912bc..d749bbd 100644 --- a/src/main/java/ugsbo/com/notenSpeicher/NotenKette.java +++ b/src/main/java/ugsbo/com/notenSpeicher/NotenKette.java @@ -19,5 +19,20 @@ public class NotenKette { Workingobjekt = newWorkingObjekt; } + public String toString() { + String erg = ""; + Noten temp = Workingobjekt; + + while (true) { + erg += temp.getFach() + "\t"+ temp.getNote() +"\n"; + + temp = temp.getVorher(); + + if (temp == null) { + return erg; + } + + } + } }