File tree Expand file tree Collapse file tree 2 files changed +2
-23
lines changed
src/org/launchcode/java/demos/inheritance Expand file tree Collapse file tree 2 files changed +2
-23
lines changed Original file line number Diff line number Diff line change 11package org .launchcode .java .demos .inheritance ;
22
3- public abstract class Cat {
3+ public class Cat {
44
55 private boolean tired = false ;
66 private boolean hungry = false ;
@@ -13,10 +13,6 @@ public Cat (double aWeight) {
1313 weight = aWeight ;
1414 }
1515
16- public Cat () {
17- weight = 13 ;
18- }
19-
2016 /**** Getters and Setters ****/
2117
2218 public boolean isTired () {
Original file line number Diff line number Diff line change @@ -9,30 +9,13 @@ public HouseCat(String aName, double aWeight) {
99 name = aName ;
1010 }
1111
12- public HouseCat (String aName ) {
13- name = aName ;
14- }
15-
16- public HouseCat (double aWeight ) {
17- super (aWeight );
18- }
19-
2012 public boolean isSatisfied () {
2113 return !isHungry () && !isTired ();
2214 }
2315
24- // @Override
25- // public String noise() {
26- // return "Hello, my name is " + name + "!";
27- // }
28-
2916 @ Override
3017 public String noise () {
31- if (isSatisfied ()) {
32- return "Hello, my name is " + name + "!" ;
33- } else {
34- return super .noise (); // prints "Meeeeeeooooowww!"
35- }
18+ return "Hello, my name is " + name + "!" ;
3619 }
3720
3821 public String purr () {
You can’t perform that action at this time.
0 commit comments