Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 9 additions & 2 deletions 2. Inside Classes/exercises/Cat.java
Original file line number Diff line number Diff line change
Expand Up @@ -32,12 +32,19 @@ else if (lives < 0)

public static void main(String[] args) {
/* Do the following things without changing the Cat class */

Cat Czar = new Cat("Czar");

// 1. Make the Cat meow
Czar.meow();

// 2. Get the Cat to print it's name

Czar.printName();
// 3. Kill the Cat!
for (int i = 0; i < 11; i++) {
Czar.kill();
}



}
}
Expand Down
10 changes: 10 additions & 0 deletions 2. Inside Classes/exercises/Harry.java
Original file line number Diff line number Diff line change
Expand Up @@ -27,10 +27,20 @@ void spyOnSnape() {

public static void main(String[] args) {
// 1. make harry potter
Harry harry = new Harry();

// 2. become invisible
harry.makeInvisible(true);

// 3. spy on professor snape
harry.spyOnSnape();

// 4. become visible again
harry.makeInvisible(false);

// 5. cast a “stupefy” spell
harry.castSpell("stupefy");

}

}
6 changes: 3 additions & 3 deletions 3. Getters and Setters/examples/DiseaseSorter.java
Original file line number Diff line number Diff line change
Expand Up @@ -9,13 +9,13 @@ public static void main(String[] args) {
Disease polio = new Disease("polio", false);
Disease flu = new Disease("influenza", true);
Disease malaria = new Disease("malaria", true);
Disease cancer = new Disease("cancer", false);
//Disease cancer = new Disease("cancer", false);
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

remove comment


List<Disease> diseases = new ArrayList<Disease>();
diseases.add(polio);
diseases.add(flu);
diseases.add(malaria);
diseases.add(cancer);
//diseases.add(cancer);
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

remove comment


/*
* Options for setting the value of "curable":
Expand All @@ -24,7 +24,7 @@ public static void main(String[] args) {
* 3. create a setter
*/

cancer.setCurable(true);
//cancer.setCurable(true);
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

remove comment


System.out.println("Curable diseases: ");
for (Disease disease : diseases) {
Expand Down