diff --git a/src/main/java/Cannon.java b/src/main/java/Cannon.java new file mode 100644 index 0000000..7b0b252 --- /dev/null +++ b/src/main/java/Cannon.java @@ -0,0 +1,11 @@ +public class Cannon extends Equipment { + + public Cannon(int purchasePrice) { + super(purchasePrice); + } + + @Override + public int getValue() { + return purchasePrice / 3; + } +} diff --git a/src/main/java/Equipment.java b/src/main/java/Equipment.java new file mode 100644 index 0000000..6ef8ffc --- /dev/null +++ b/src/main/java/Equipment.java @@ -0,0 +1,11 @@ +public abstract class Equipment { + protected int purchasePrice; + + public Equipment(int purchasePrice) { + this.purchasePrice = purchasePrice; + } + + public int getValue() { + return purchasePrice; + } +} diff --git a/src/main/java/Ladder.java b/src/main/java/Ladder.java new file mode 100644 index 0000000..d26ca7a --- /dev/null +++ b/src/main/java/Ladder.java @@ -0,0 +1,11 @@ +public class Ladder extends Equipment { + + public Ladder(int purchasePrice) { + super(purchasePrice); + } + + @Override + public int getValue() { + return purchasePrice / 2; + } +}