Robotermodellklasse angelegt + Konstruktor der beiden Modelle

Aufsteigende_Sortierung
cedri 2023-01-07 19:29:12 +01:00
parent dc5a7aea2b
commit 4498d916dd
4 changed files with 29 additions and 4 deletions

View File

@ -2,10 +2,14 @@ package domain;
import roboterSystem.Robot;
public class C3PO implements Robot {
public class C3PO extends Robotermodelle implements Robot {
private int zähler = 10000;
public C3PO(String name) {
// TODO Auto-generated constructor stub
setName(name);
setiD(zähler);
zähler++;
}

View File

@ -2,10 +2,14 @@ package domain;
import roboterSystem.Robot;
public class R2D2 implements Robot {
public class R2D2 extends Robotermodelle implements Robot {
private int zähler = 0;
public R2D2(String name) {
// TODO Auto-generated constructor stub
setName(name);
setiD(zähler);
zähler++;
}

View File

@ -12,5 +12,6 @@ public class RobotFactory {
case "R2D2":
return new R2D2(name);
}
return null;
}
}

View File

@ -0,0 +1,16 @@
package domain;
public class Robotermodelle {
private int iD;
private String name;
private boolean power = true;
public void setName(String name) {
this.name = name;
}
public void setiD(int iD) {
this.iD = iD;
}
}