From 4e712da0507320cf25049d2d605c5dcdd9dada0b Mon Sep 17 00:00:00 2001 From: Milan Lukic <2122158@stud.hs-mannheim.de> Date: Tue, 3 Jan 2023 16:48:10 +0100 Subject: [PATCH] RobotType in R2D2 angelegt und Enum RobotType erstellt --- Roboterfabrik/src/Domäne/R2D2.java | 17 +++++++++++++++-- Roboterfabrik/src/Domäne/RobotType.java | 5 +++++ 2 files changed, 20 insertions(+), 2 deletions(-) create mode 100644 Roboterfabrik/src/Domäne/RobotType.java diff --git a/Roboterfabrik/src/Domäne/R2D2.java b/Roboterfabrik/src/Domäne/R2D2.java index 1b771ec..ea293f4 100644 --- a/Roboterfabrik/src/Domäne/R2D2.java +++ b/Roboterfabrik/src/Domäne/R2D2.java @@ -1,29 +1,42 @@ package Domäne; +import java.util.Arrays; + import tpe.exceptions.roboter.Robot; import tpe.exceptions.roboter.RobotException; public class R2D2 extends Roboter { int id; static int idZähler = 0; + RobotType robotType; R2D2 (String name){ super (name); + this.robotType = RobotType.R2D2; this.id = idZähler; idZähler++; } @Override public String speak(int[] zahlen) throws RobotException { + String ausgabe = ""; + for (int i = 0; i < zahlen.length; i++) { + ausgabe = ausgabe + zahlen[i] +","; + } + return ausgabe; + } + + @Override + public int[] think(int[] zahlen) throws RobotException { return null; } @Override - public int[] think(int[] zahlen) throws RobotException { + public int getId() { // TODO Auto-generated method stub - return null; + return 0; } diff --git a/Roboterfabrik/src/Domäne/RobotType.java b/Roboterfabrik/src/Domäne/RobotType.java new file mode 100644 index 0000000..6a89699 --- /dev/null +++ b/Roboterfabrik/src/Domäne/RobotType.java @@ -0,0 +1,5 @@ +package Domäne; + +public enum RobotType { + R2D2, C3PO +}