From 495a5a7ac8918ea3a12a8ff30aab353ebb874e49 Mon Sep 17 00:00:00 2001 From: Drees Date: Mon, 9 Jan 2023 15:24:30 +0100 Subject: [PATCH] UI verbessert --- Roboter/Main.java | 14 ++++++++++++++ Roboter/tpe/ui/UI.java | 17 +++++++++++++---- 2 files changed, 27 insertions(+), 4 deletions(-) create mode 100644 Roboter/Main.java diff --git a/Roboter/Main.java b/Roboter/Main.java new file mode 100644 index 0000000..398c56e --- /dev/null +++ b/Roboter/Main.java @@ -0,0 +1,14 @@ +import tpe.facade.FactorySystem; +import tpe.ui.UI; + +public class Main { + + public static void main(String[] args) throws Exception { + + FactorySystem fs = new FactorySystem("Roboterfabrik"); + UI ui = new UI(fs); + + + } + +} diff --git a/Roboter/tpe/ui/UI.java b/Roboter/tpe/ui/UI.java index 9beaf3b..cc07870 100644 --- a/Roboter/tpe/ui/UI.java +++ b/Roboter/tpe/ui/UI.java @@ -3,6 +3,7 @@ package tpe.ui; import java.util.ArrayList; import java.util.Scanner; +import tpe.exceptions.RobotException; import tpe.exceptions.roboter.RobotFactory; import tpe.facade.FactorySystem; @@ -116,7 +117,10 @@ private void menu() { } - + /** + * Gibt den Status des Roboters an + * @param id + */ private void robotStatus(int id) { boolean status = fs.powerStatus(id); if (status == true) @@ -131,6 +135,8 @@ private void menu() { System.out.println("Der Roboter wurde eingeschaltet."); else System.out.println("Der Roboter wurde ausgeschaltet."); + + System.out.println(); } private void robotSpeak(int id) { @@ -163,9 +169,12 @@ private void menu() { int [] numbers = arrayNumbers.stream().mapToInt(j -> j).toArray(); String output; -// try { -// output = fs. hier muss noch eine Verknüpfung zur sprechmethode in Factory System rein -// } + try { + output = fs.robotInstructions(id, numbers); + System.out.println("Der Roboter gibt folgendes aus: " + output); + } catch (RobotException e) { + System.out.println("Fehler!"); + } } }