66import org .junit .Test ;
77import org .teachingextensions .logo .Tortoise ;
88import org .teachingextensions .logo .Turtle ;
9+ import org .teachingextensions .logo .Turtle .Animals ;
910//This deepdive is in progress!
1011
1112//
@@ -22,9 +23,9 @@ public class DeepDive07Events
2223 // Do not change anything except the blank (___)
2324 //
2425 // concepts:
25- // events / multiple event listeners - right click
2626 // 'this' - instance(s) - multiple Tortoises
2727 // exploring Object methods other than Tortoise---Circle (TKP)...methods
28+ // events / multiple event listeners - right click - move events to new section?
2829 @ Test
2930 public void stringsCanBeArrays () throws Exception
3031 {
@@ -57,15 +58,25 @@ public void twoTortoisesYetAgain() throws Exception
5758 boolean result = michealangelo .equals (anonymousNinja );
5859 Assert .assertEquals (true , result );
5960 }
60- //"this" Tortoise belongs here ( to this Object)
61+ //Turtle Leonardo belongs to " this"
6162 private Turtle leonardo ;
6263 @ Test
63- public void sadTortoise () throws Exception
64+ public void fatTrailTurtle () throws Exception
6465 {
65- this ._______ = new Turtle ();
66- //sorry, leonardo must die now - joking
67- this .leonardo .getPenWidth ();
68- Assert .assertEquals (2 , this .leonardo .getPenWidth ());
66+ Turtle ninja = new Turtle ();
67+ this .leonardo = _______ ;
68+ ninja .setPenWidth (30 );
69+ Assert .assertEquals (30 , this .leonardo .getPenWidth ());
70+ }
71+ //Turtle Donatello belongs to "this"
72+ private Turtle donatello ;
73+ @ Test
74+ public void explodingTurtle () throws Exception
75+ {
76+ Turtle ninja = new Turtle ();
77+ this ._______ = ninja ;
78+ this .donatello .setAnimal (Animals .ExplodedTurtle );
79+ Assert .assertTrue ("The ninja is still alive!" , ninja .isDead ());
6980 }
7081 /**
7182 * Ignore the following, It's needed to run the homework
@@ -80,11 +91,11 @@ public void sadTortoise() throws Exception
8091 *
8192 *
8293 */
83- public boolean _____ = false ;
84- public boolean ______ = true ;
85- public String ___ = "You need to fill in the blank ___" ;
86- public int ____ = 0 ;
87- public Turtle _______ ;
94+ public boolean _____ = false ;
95+ public boolean ______ = true ;
96+ public String ___ = "You need to fill in the blank ___" ;
97+ public int ____ = 0 ;
98+ public Turtle _______ = new Turtle () ;
8899 public Tortoise ________ ;
89100 public String ___ ()
90101 {
@@ -95,4 +106,9 @@ private Cursor getCursor()
95106 Cursor cursor = Tortoise .getBackgroundWindow ().getCursor ();
96107 return cursor ;
97108 }
109+ public DeepDive07Events ()
110+ {
111+ this .leonardo = new Turtle ();
112+ this .donatello = new Turtle ();
113+ }
98114}
0 commit comments