Updated domain. Further erxplanation in README

main
Philipp3107 2022-12-08 23:13:22 +01:00
parent 2c9be60703
commit 77dd5b19f6
2 changed files with 67 additions and 2 deletions

View File

@ -1,4 +1,37 @@
package domain;
public class C3PO {
public class C3PO implements Robot{
private int id;
private String name;
private boolean power;
public C3PO(int id, String name){
this.id = id;
this.name = name;
power = false;
}
@Override
public int getId() {
return id;
}
@Override
public String getName() {
return name;
}
@Override
public void triggerPowerSwitch() {
if(power = false){
power = true;
}else{
power = false;
}
}
@Override
public boolean isPowerOn() {
return power;
}
}

View File

@ -1,4 +1,36 @@
package domain;
public class R2D2 {
public class R2D2 implements Robot{
private int id;
private String name;
private boolean power;
public R2D2(int id, String name){
this.id = id;
this.name = name;
power = false;
}
@Override
public int getId() {
return id;
}
@Override
public String getName() {
return name;
}
@Override
public void triggerPowerSwitch() {
if(power = false){
power = true;
}else{
power = false;
}
}
@Override
public boolean isPowerOn() {
return power;
}
}