From 09dbfc9660f6356a6463f39f4c8ee2fe473c480b Mon Sep 17 00:00:00 2001 From: Joel Baldauf Date: Fri, 11 Dec 2020 16:37:10 +0100 Subject: [PATCH] output Umordnung --- Punkte-in-Noten/src/frame.java | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) diff --git a/Punkte-in-Noten/src/frame.java b/Punkte-in-Noten/src/frame.java index 47a8ff1..1c29a17 100644 --- a/Punkte-in-Noten/src/frame.java +++ b/Punkte-in-Noten/src/frame.java @@ -119,7 +119,7 @@ public class frame extends JFrame { res[1] = String.format("%.2f", percentagePartB); res[2] = String.format("%.2f", totalPercentage); res[3] = String.format("%.0f", totalPercentage); - res[4] = String.format("%.2f", markIHK); + res[4] = String.format("%.1f", markIHK); res[5] = String.format("%.0f", markIHK); return res; //Rückgabe der Ergebnisse als Array } @@ -144,6 +144,15 @@ public class frame extends JFrame { return totalPercentage; //Rückgabe der gesamten erreichten Prozente } + //Methode für das Zusammenbauen der Ausgabe für AP1 + public String buildOutString (String title, String[] res, JSpinner spPartA, JSpinner spPartB) { + String out = String.format("%s \n\nAnzahl der richtig gelösten gebundenen Aufgaben %d:0,5 = %s" + + "Erreichte Punkte bei den ungebundenen Aufgaben %d:1,6 = %s\n" + + "Ergebnis in Punkten (max.100) \t%s \n \t\t\t%s\n" + + "IHK-Note:%s\nganze Note:%s", title, (int)spPartA.getValue(), res[0], (int)spPartB.getValue(), res[1], res[2], res[3], res[4], res[5]); + return out; + } + /** * Create the frame. */ @@ -334,10 +343,7 @@ public class frame extends JFrame { public void actionPerformed(ActionEvent e) { String[] resWiso = calculatePart((int)spAP1_PartA.getValue(), (int)spAP1_PartB.getValue(), pointsAP1PartA, pointsAP1PartB, 50, 50); JTextPane txtpnGesamt = new JTextPane(); - txtpnGesamt.setText("AP1 \n\nAnzahl der richtig gelösten gebundenen Aufgaben " + spAP1_PartA.getValue() + ": 0,5 = " + resWiso[0] + "\n" - + "Erreichte Punkte bei den ungebundenen Aufgaben " + spAP1_PartB.getValue() + ": 1,6 =" + resWiso[1] + "\n" - + "Ergebnis in Punkten (max.100) \t" + resWiso[2] + "\n \t\t\t" + resWiso[3] + "\n" - + "IHK-Note:" + resWiso[4] + "\nganze Note:" + resWiso[5]); + txtpnGesamt.setText(buildOutString("AP1", resWiso, spAP1_PartA, spAP1_PartB)); txtpnGesamt.setEditable(false); txtpnGesamt.setBackground(getBackground()); scrollPane.setViewportView(txtpnGesamt);