From 77dd5b19f6fb62fe6ed80a40d2cde7c335d887c5 Mon Sep 17 00:00:00 2001 From: Philipp3107 Date: Thu, 8 Dec 2022 23:13:22 +0100 Subject: [PATCH] Updated domain. Further erxplanation in README --- domain/C3PO.java | 35 ++++++++++++++++++++++++++++++++++- domain/R2D2.java | 34 +++++++++++++++++++++++++++++++++- 2 files changed, 67 insertions(+), 2 deletions(-) diff --git a/domain/C3PO.java b/domain/C3PO.java index bde3f4e..ecdee28 100644 --- a/domain/C3PO.java +++ b/domain/C3PO.java @@ -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; + } } diff --git a/domain/R2D2.java b/domain/R2D2.java index f42cf1c..410667c 100644 --- a/domain/R2D2.java +++ b/domain/R2D2.java @@ -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; + } }