Skip to content

Commit 84781e8

Browse files
committed
Deep Dive 4 w/lynn
1 parent cae735e commit 84781e8

2 files changed

Lines changed: 167 additions & 0 deletions

File tree

212 Bytes
Binary file not shown.
Lines changed: 167 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,167 @@
1+
package org.teachingkidsprogramming.section04mastery;
2+
3+
import org.junit.Assert;
4+
import org.junit.Ignore;
5+
import org.junit.Test;
6+
7+
import you.need.to.fill.in.the.______;
8+
9+
10+
public class DeepDive04Mastery
11+
{
12+
// How to do deep dive:
13+
// Step 1: Select the method name (doesABear on line 20) Press the Run Button
14+
// PC: Ctrl+F11
15+
// Mac: Command+fn+F11
16+
// Step 2: Read the name of the method that failed
17+
// Step 3: Fill in the blank (___) to make it pass
18+
// Step 4: Consider at least one thing you just learned
19+
// Step 5: Advance to the next method
20+
// Do not change anything except the blank (___)
21+
//
22+
// concepts to cover: types, scope
23+
// no inheritance,no new, int->double, int->string
24+
// primitive types
25+
// possible auto-boxing
26+
@Test
27+
public void theseNumbersCount() throws Exception
28+
{
29+
Integer number = 2;
30+
Assert.assertEquals(number.getClass(), ______.class);
31+
}
32+
@Test
33+
public void textTypes() throws Exception
34+
{
35+
String text = "Beans";
36+
Assert.assertEquals(text.getClass(), ______.class);
37+
}
38+
@Test
39+
public void theNumbersAfterTheDot() throws Exception
40+
{
41+
Double number = 2.3;
42+
Assert.assertEquals(number.getClass(), ______.class);
43+
}
44+
@Test
45+
public void everythingIsAnObject() throws Exception
46+
{
47+
Object number = 2.3;
48+
Assert.assertEquals(number.getClass(), ______.class);
49+
}
50+
@Test
51+
public void iMeanEverythingIsAnObject() throws Exception
52+
{
53+
Object number = 2;
54+
Assert.assertEquals(number.getClass(), ______.class);
55+
}
56+
@Test
57+
public void iMeanEverySinglethingIsAnObject() throws Exception
58+
{
59+
Object number = "Everything";
60+
Assert.assertEquals(number.getClass(), ______.class);
61+
}
62+
@Test
63+
public void integersAreATypeOfNumber() throws Exception
64+
{
65+
Number number = 2;
66+
Assert.assertEquals(number.getClass(), ______.class);
67+
}
68+
@Test
69+
public void doublesAreATypeOfNumber() throws Exception
70+
{
71+
Number number = 2.0;
72+
Assert.assertEquals(number.getClass(), ______.class);
73+
}
74+
@Test
75+
public void addingIntegers() throws Exception
76+
{
77+
Number number = 2 + 3;
78+
Assert.assertEquals(number.getClass(), ______.class);
79+
}
80+
@Test
81+
public void addingDoubles() throws Exception
82+
{
83+
Number number = 2.1 + 3.2;
84+
Assert.assertEquals(number.getClass(), ______.class);
85+
}
86+
@Test
87+
public void addingMixedTypes() throws Exception
88+
{
89+
Number number = 2 + 0.1;
90+
Assert.assertEquals(number.getClass(), ______.class);
91+
Assert.assertEquals(number, ____);
92+
}
93+
@Test
94+
public void addingMixingMoreTypes() throws Exception
95+
{
96+
Object number = "19 fought 20, " + 21;
97+
Assert.assertEquals(number.getClass(), ______.class);
98+
Assert.assertEquals(number, ____);
99+
}
100+
@Test
101+
public void convertingToText() throws Exception
102+
{
103+
Integer number = 21;
104+
String text = number.toString();
105+
Assert.assertEquals(text.getClass(), ______.class);
106+
Assert.assertEquals(text, ____);
107+
}
108+
@Test
109+
public void convertingToText2() throws Exception
110+
{
111+
Integer number = 21;
112+
String text = "" + number;
113+
Assert.assertEquals(text.getClass(), ______.class);
114+
Assert.assertEquals(text, ____);
115+
}
116+
@Test
117+
public void dividing() throws Exception
118+
{
119+
Number number = 1.0 / 5;
120+
Assert.assertEquals(number.getClass(), ______.class);
121+
Assert.assertEquals(number, .2);
122+
}
123+
@Test
124+
public void dividingIntegers() throws Exception
125+
{
126+
Number number = 1 / 5;
127+
Assert.assertEquals(number.getClass(), ______.class);
128+
Assert.assertEquals(number, ____);
129+
}
130+
@Test
131+
public void understandingNumbers() throws Exception
132+
{
133+
String text = "42";
134+
Number theAnswer = Integer.parseInt(text);
135+
Assert.assertEquals(theAnswer.getClass(), ______.class);
136+
Assert.assertEquals(theAnswer, ____);
137+
}
138+
@Test
139+
public void understandingDoubleNumbers() throws Exception
140+
{
141+
String text = "42";
142+
Number theAnswer = Double.parseDouble(text);
143+
Assert.assertEquals(theAnswer.getClass(), ______.class);
144+
Assert.assertEquals(theAnswer, ____);
145+
}
146+
/**
147+
* Ignore the following, It's needed to run the homework
148+
*
149+
*
150+
*
151+
*
152+
*
153+
*
154+
*
155+
*
156+
*
157+
*
158+
*/
159+
public boolean _____ = false;
160+
public boolean ______ = true;
161+
public String ___ = "You need to fill in the blank ___";
162+
public Integer ____ = null;
163+
public String ___()
164+
{
165+
return ___;
166+
}
167+
}

0 commit comments

Comments
 (0)