2022-12-08 14:58:44 +01:00
|
|
|
package domain;
|
|
|
|
|
2022-12-08 23:13:22 +01:00
|
|
|
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;
|
|
|
|
}
|
2022-12-08 14:58:44 +01:00
|
|
|
}
|