Skip to content

Commit 54061ec

Browse files
committed
added DeepDive05 w/Jim
1 parent 58a5eef commit 54061ec

4 files changed

Lines changed: 32 additions & 21 deletions

File tree

0 Bytes
Binary file not shown.

TeachingKidsProgramming/src/org/teachingkidsprogramming/section02methods/DeepDive02Variables.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -138,6 +138,7 @@ public String prepareForBed()
138138
*/
139139
public String ___ = "You need to fill in the blank ___";
140140
public int ____ = 10000;
141+
public int numberOfHarryPotterBooks;
141142
public String ___()
142143
{
143144
return ___;

TeachingKidsProgramming/src/org/teachingkidsprogramming/section05recursion/DeepDive05Recursion.java

Lines changed: 30 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -2,14 +2,17 @@
22

33
import java.awt.Color;
44
import java.awt.Cursor;
5+
import java.util.Arrays;
56
import java.util.HashMap;
7+
import java.util.List;
68

79
import org.junit.Assert;
10+
import org.junit.Ignore;
811
import org.junit.Test;
912
import org.teachingextensions.logo.Colors;
1013
import org.teachingextensions.logo.Tortoise;
1114

12-
//
15+
1316
public class DeepDive05Recursion
1417
{
1518
// How to do deep dive:
@@ -22,24 +25,6 @@ public class DeepDive05Recursion
2225
// Step 5: Advance to the next method
2326
// Do not change anything except the blank (___)
2427
//
25-
// collections (hashmaps and more...)
26-
//Hashmap = C# Dictionary
27-
// HashMap<K,V>
28-
//Array = C# Array
29-
// Integer [ ] = {1,2,3};
30-
// Integer [ ] = new Integer [3];
31-
// List = C# ArrayList
32-
// List = new ArrayLIst( );
33-
// concepts to cover: recursion
34-
// possible recursive ideas from lisp/clojure
35-
// (defn is-even? [n] (if (= n 0) (___ (is-even? (dec n)))))
36-
// (defn recursive-reverse [coll] __)
37-
@Test
38-
public void gettingStarted() throws Exception
39-
{
40-
int number = 2;
41-
Assert.assertEquals(number, ____);
42-
}
4328
@Test
4429
public void changeThePointer() throws Exception
4530
{
@@ -82,14 +67,39 @@ public void getColorUsingHashKey() throws Exception
8267
Assert.assertEquals(_______, colors.get(30));
8368
}
8469
@Test
70+
public void getWhatsSecond() throws Exception
71+
{
72+
//get the second item on the list
73+
List<String> messages = Arrays.asList("Hello", "World!", "How", "Are", "You");
74+
String result = messages.get(____);
75+
Assert.assertEquals("World!", result);
76+
}
77+
@Test
78+
public void getWhatsLast() throws Exception
79+
{
80+
//get the last item on the list
81+
List<String> messages = Arrays.asList("Hello", "World!", "How", "Are", "You");
82+
String result = messages.get(4);
83+
Assert.assertEquals(___, result);
84+
}
85+
@Test
86+
public void whatIsLastNow() throws Exception
87+
{
88+
//get the last item on the list now
89+
List<String> messages = Arrays.asList("Hello", "World!", "How", "Are", "You");
90+
messages.set(4, ___);
91+
String result = messages.get(4);
92+
Assert.assertEquals("The rest of them", result);
93+
}
94+
@Test
8595
public void getThirdArrayItem() throws Exception
8696
{
8797
//get the third item from the right spot using the key
8898
int[] numbers = {1, 5, 10, 25};
8999
Assert.assertEquals(10, numbers[____]);
90100
}
91101
@Test
92-
public void whatDoesItStartWith() throws Exception
102+
public void whatIsThird() throws Exception
93103
{
94104
//put 25 at the third position
95105
int[] numbers = {1, 5, 10, ____};

TeachingKidsProgramming/src/org/teachingkidsprogramming/section08tdd/FizzBuzzTDD.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ public class FizzBuzzTDD
66
//if that number is evenly divisible by 3, then print the word 'Fizz',
77
//if that number is evenly divisible by 5, then print the word 'Buzz',
88
//if that number is evenly divisible by either 3 or 5, then print the word 'FizzBuzz'
9-
//write tests using the Assert object
9+
//write tests using the Assert object via the TDD style
1010
//for more complete directions see this page
1111
//https://www.penflip.com/lynnlangit/tkp-lesson-plans/blob/master/course09.txt
1212
}

0 commit comments

Comments
 (0)