Skip to content

Commit 8056ed0

Browse files
committed
starter code for lsn6 in-book demos
1 parent b4c59d8 commit 8056ed0

File tree

2 files changed

+2
-23
lines changed

2 files changed

+2
-23
lines changed

src/org/launchcode/java/demos/inheritance/Cat.java

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
package 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() {

src/org/launchcode/java/demos/inheritance/HouseCat.java

Lines changed: 1 addition & 18 deletions
Original file line numberDiff line numberDiff 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() {

0 commit comments

Comments
 (0)