RobotType in R2D2 angelegt und Enum RobotType erstellt

master
Milan Lukic 2023-01-03 16:48:10 +01:00
parent d59ee7395f
commit 4e712da050
2 changed files with 20 additions and 2 deletions

View File

@ -1,29 +1,42 @@
package Domäne; package Domäne;
import java.util.Arrays;
import tpe.exceptions.roboter.Robot; import tpe.exceptions.roboter.Robot;
import tpe.exceptions.roboter.RobotException; import tpe.exceptions.roboter.RobotException;
public class R2D2 extends Roboter { public class R2D2 extends Roboter {
int id; int id;
static int idZähler = 0; static int idZähler = 0;
RobotType robotType;
R2D2 (String name){ R2D2 (String name){
super (name); super (name);
this.robotType = RobotType.R2D2;
this.id = idZähler; this.id = idZähler;
idZähler++; idZähler++;
} }
@Override @Override
public String speak(int[] zahlen) throws RobotException { 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; return null;
} }
@Override @Override
public int[] think(int[] zahlen) throws RobotException { public int getId() {
// TODO Auto-generated method stub // TODO Auto-generated method stub
return null; return 0;
} }

View File

@ -0,0 +1,5 @@
package Domäne;
public enum RobotType {
R2D2, C3PO
}