Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package Cats;
- public class StreetCat extends Cat {
- /* Properties */
- protected int fights;
- /* Get, Set Methods */
- public void setFights(int fights) {
- if (fights < 0) { fights = 0; }
- this.fights = fights;
- }
- public int getFights() {
- return this.fights;
- }
- /* Constructors */
- public StreetCat(String name, float whiskersLength, String colour, int fights) {
- super(name, whiskersLength, colour);
- this.fights = fights;
- }
- public StreetCat(String name, float whiskersLength, String colour) {
- super(name, whiskersLength, colour);
- }
- public StreetCat(String name, float whiskersLength) {
- super(name, whiskersLength);
- }
- public StreetCat(String name) {
- super(name);
- }
- public StreetCat() {
- super();
- }
- /* Cat class copy constructor */
- public StreetCat(Cat catObj, int fights) {
- super(catObj);
- setFights(fights);
- }
- public StreetCat(Cat catObj) {
- super(catObj);
- setFights(0);
- }
- /* Methods */
- public String toString() {
- return super.toString() + "\tfights="+fights;
- }
- }
Add Comment
Please, Sign In to add comment