1616public class DeepDive05Recursion
1717{
1818 // How to do deep dive:
19- // Step 1: Select the method name (doesABear on line 20 ) Press the Run Button
19+ // Step 1: Select the method name (changeThePointerToAHand on line 29 ) Press the Run Button
2020 // PC: Ctrl+F11
2121 // Mac: Command+fn+F11
2222 // Step 2: Read the name of the method that failed
@@ -26,99 +26,87 @@ public class DeepDive05Recursion
2626 // Do not change anything except the blank (___)
2727 //
2828 @ Test
29- public void changeThePointer () throws Exception
29+ public void changeThePointerToAHand () throws Exception
3030 {
31- //Set the cursor on the background window to a hand
3231 Tortoise .getBackgroundWindow ().___ ();
3332 Assert .assertEquals (getCursor (), Cursor .getPredefinedCursor (Cursor .HAND_CURSOR ));
3433 }
3534 @ Test
3635 public void getTheWindow () throws Exception
3736 {
38- //Get the correct background window in order to set the cursor
3937 Tortoise .___ ().setCursor (Cursor .CROSSHAIR_CURSOR );
4038 Assert .assertEquals (getCursor (), Cursor .getPredefinedCursor (Cursor .CROSSHAIR_CURSOR ));
4139 }
4240 @ Test
43- public void setPositionUsingHashKey () throws Exception
41+ public void setColorUsingKey () throws Exception
4442 {
45- //set the color Dark Green into the right spot using the key
4643 HashMap <Integer , Color > colors = new HashMap <Integer , Color >();
4744 colors .put (10 , Colors .Greens .Lime );
4845 colors .put (____ , Colors .Greens .DarkGreen );
4946 Assert .assertEquals (Colors .Greens .DarkGreen , colors .get (20 ));
5047 }
5148 @ Test
52- public void getValueUsingHashKey () throws Exception
49+ public void findTheGreenKey () throws Exception
5350 {
54- //get the key from the right spot using the color
5551 HashMap <Integer , Color > colors = new HashMap <Integer , Color >();
5652 colors .put (20 , Colors .Greens .DarkGreen );
5753 colors .put (30 , Colors .Greens .Green );
5854 Assert .assertEquals (Colors .Greens .Green , colors .get (___ ));
5955 }
6056 @ Test
61- public void getColorUsingHashKey () throws Exception
57+ public void findTheColorForTheBananaKey () throws Exception
6258 {
63- //get the color from the right spot using the key
64- HashMap <Integer , Color > colors = new HashMap <Integer , Color >();
65- colors .put (20 , Colors .Greens .DarkGreen );
66- colors .put (30 , Colors .Greens .Green );
67- Assert .assertEquals (_______ , colors .get (30 ));
59+ HashMap <String , Color > colors = new HashMap <String , Color >();
60+ colors .put ("banana" , Colors .Yellows .Yellow );
61+ colors .put ("apple" , Colors .Reds .Red );
62+ Assert .assertEquals (_______ , colors .get ("banana" ));
6863 }
6964 @ Test
70- public void getWhatsSecond () throws Exception
65+ public void findTheNumberPositionOfTheWorld () throws Exception
7166 {
72- //get the second item on the list
7367 List <String > messages = Arrays .asList ("Hello" , "World!" , "How" , "Are" , "You" );
7468 String result = messages .get (____ );
7569 Assert .assertEquals ("World!" , result );
7670 }
7771 @ Test
7872 public void getWhatsLast () throws Exception
7973 {
80- //get the last item on the list
8174 List <String > messages = Arrays .asList ("Hello" , "World!" , "How" , "Are" , "You" );
8275 String result = messages .get (4 );
8376 Assert .assertEquals (___ , result );
8477 }
8578 @ Test
8679 public void whatIsLastNow () throws Exception
8780 {
88- //get the last item on the list now
8981 List <String > messages = Arrays .asList ("Hello" , "World!" , "How" , "Are" , "You" );
9082 messages .set (4 , ___ );
9183 String result = messages .get (4 );
9284 Assert .assertEquals ("The rest of them" , result );
9385 }
9486 @ Test
95- public void getThirdArrayItem () throws Exception
87+ public void putAQuarterAtTheEnd () throws Exception
9688 {
97- //get the third item from the right spot using the key
98- int [] numbers = {1 , 5 , 10 , 25 };
99- Assert .assertEquals (10 , numbers [____ ]);
89+ int [] coins = {1 , 5 , 10 , ____ };
90+ Assert .assertEquals (25 , coins [3 ]);
10091 }
10192 @ Test
102- public void whatIsThird () throws Exception
93+ public void getThirdCoin () throws Exception
10394 {
104- //put 25 at the third position
105- int [] numbers = {1 , 5 , 10 , ____ };
106- Assert .assertEquals (25 , numbers [3 ]);
95+ int [] coins = {1 , 5 , 10 , 25 };
96+ Assert .assertEquals (10 , coins [____ ]);
10797 }
10898 @ Test
109- public void whatIsFirst () throws Exception
99+ public void whichCoinIsSecond () throws Exception
110100 {
111- //get the number at the first position
112- int [] numbers = {1 , 5 , 10 , 25 };
113- Assert .assertEquals (____ , numbers [1 ]);
101+ int [] coins = {1 , 5 , 10 , 25 };
102+ Assert .assertEquals (____ , coins [1 ]);
114103 }
115104 @ Test
116- public void whatIsFirstNow () throws Exception
105+ public void putAFiftyCentPieceFirst () throws Exception
117106 {
118- //change the number at the listed position
119- int [] numbers = {1 , 5 , 10 , 25 };
120- numbers [0 ] = ____ ;
121- Assert .assertEquals (53 , numbers [0 ]);
107+ int [] coins = {1 , 5 , 10 , 25 };
108+ coins [0 ] = ____ ;
109+ Assert .assertEquals (50 , coins [0 ]);
122110 }
123111 /**
124112 * Ignore the following, It's needed to run the homework
0 commit comments