37 lines
579 B
Java
37 lines
579 B
Java
package domain;
|
|
|
|
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;
|
|
}
|
|
}
|