forked from nus-cs2113-AY2223S2/Circus
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
create packages create Asset interface use Asset to print value update Circus class to relfect the changes.
- Loading branch information
Showing
15 changed files
with
84 additions
and
39 deletions.
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
package circus; | ||
|
||
public interface Asset { | ||
int getValue(); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
package circus.animal; | ||
|
||
import circus.Asset; | ||
|
||
public abstract class Animal implements Asset { | ||
|
||
public abstract String speak(); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
package circus.animal; | ||
|
||
public abstract class Bird extends Animal { | ||
public String speak() { | ||
return "tweet tweet"; | ||
} | ||
|
||
public void fly() { | ||
System.out.println("Whee ..."); | ||
} | ||
} |
7 changes: 7 additions & 0 deletions
7
src/main/java/Duck.java → src/main/java/circus/animal/Duck.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
7 changes: 7 additions & 0 deletions
7
src/main/java/Parrot.java → src/main/java/circus/animal/Parrot.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 2 additions & 0 deletions
2
src/main/java/Cannon.java → src/main/java/circus/stuff/Cannon.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,5 @@ | ||
package circus.stuff; | ||
|
||
public class Cannon extends Equipment { | ||
|
||
public Cannon(int purchasePrice) { | ||
|
10 changes: 5 additions & 5 deletions
10
src/main/java/Equipment.java → src/main/java/circus/stuff/Equipment.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,11 +1,11 @@ | ||
public abstract class Equipment { | ||
package circus.stuff; | ||
|
||
import circus.Asset; | ||
|
||
public abstract class Equipment implements Asset { | ||
protected int purchasePrice; | ||
|
||
public Equipment(int purchasePrice) { | ||
this.purchasePrice = purchasePrice; | ||
} | ||
|
||
public int getValue() { | ||
return purchasePrice; | ||
} | ||
} |
2 changes: 2 additions & 0 deletions
2
src/main/java/Ladder.java → src/main/java/circus/stuff/Ladder.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,5 @@ | ||
package circus.stuff; | ||
|
||
public class Ladder extends Equipment { | ||
|
||
public Ladder(int purchasePrice) { | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters