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.
Merge remote-tracking branch 'upstream/master'
- Loading branch information
Showing
8 changed files
with
78 additions
and
19 deletions.
There are no files selected for viewing
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 |
---|---|---|
|
@@ -4,5 +4,6 @@ | |
|
||
public abstract class Animal implements Asset { | ||
|
||
public String name; | ||
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
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,23 @@ | ||
package circus.animal; | ||
|
||
public class Elephant extends Animal { | ||
@Override | ||
public String toString() { | ||
return "My name is " + name + ". I am an Elephant!"; | ||
} | ||
|
||
@Override | ||
public int getValue() { | ||
return 100; | ||
} | ||
|
||
@Override | ||
public String speak() { | ||
return toString() + ". I am the strongest"; | ||
} | ||
|
||
public Elephant(String name) { | ||
this.name = name; | ||
} | ||
|
||
} |
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,22 @@ | ||
package circus.animal; | ||
|
||
public class Tiger extends Animal { | ||
@Override | ||
public String toString() { | ||
return "My name is " + name + ". I am a majestic Tiger!"; | ||
} | ||
|
||
@Override | ||
public int getValue() { | ||
return 100; | ||
} | ||
|
||
@Override | ||
public String speak() { | ||
return toString() + ". I don't speak; I ROARRR!!!!"; | ||
} | ||
|
||
public Tiger(String name) { | ||
this.name = name; | ||
} | ||
} |
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