From 6b52a82386473ace677f2b44beab2f0976951b8f Mon Sep 17 00:00:00 2001 From: "Akshay Narayan @ HP360 (MyOfficeThing)" Date: Fri, 3 Feb 2023 10:02:09 +0800 Subject: [PATCH] Add all things in the circus --- src/main/java/Cannon.java | 11 +++++++++++ src/main/java/Equipment.java | 11 +++++++++++ src/main/java/Ladder.java | 11 +++++++++++ 3 files changed, 33 insertions(+) create mode 100644 src/main/java/Cannon.java create mode 100644 src/main/java/Equipment.java create mode 100644 src/main/java/Ladder.java 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; + } +}