Skip to content

Commit 7a3bd54

Browse files
committed
fixed DeepDive06 bug
1 parent 383d86d commit 7a3bd54

2 files changed

Lines changed: 65 additions & 1 deletion

File tree

Lines changed: 63 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,63 @@
1+
package org.teachingkidsprogramming.recipes.completed.section04mastery;
2+
3+
import java.awt.Color;
4+
5+
import org.teachingextensions.logo.Tortoise;
6+
import org.teachingextensions.logo.utils.ColorUtils.ColorWheel;
7+
import org.teachingextensions.logo.utils.ColorUtils.PenColors;
8+
9+
public class DigiFlower
10+
{
11+
public static void main(String[] args)
12+
{
13+
// Show the tortoise --#1
14+
Tortoise.show();
15+
// Make the tortoise move as fast as possible --#7
16+
Tortoise.setSpeed(10);
17+
// Make the background silver (use PenColors) --#8
18+
Tortoise.getBackgroundWindow().setBackground(PenColors.Grays.Silver);
19+
// Make the line the tortoise draws 3 pixels wide --#15
20+
Tortoise.setPenWidth(3);
21+
// CreateColorPalette (recipe below) --#9
22+
createColorPalette();
23+
// Do the following 15 times --#13
24+
for (int i = 0; i < 15; i++)
25+
{
26+
// DrawOctogon (recipe below) --#10
27+
drawOctogon();
28+
// Turn the tortoise 1/15th of 360 degrees to the right --#12
29+
Tortoise.turn(360.0 / 15);
30+
}
31+
}
32+
// ------------- Recipe for CreateColorPalette --#9
33+
private static void createColorPalette()
34+
{
35+
Color color1 = PenColors.Reds.Red;
36+
Color color2 = PenColors.Oranges.DarkOrange;
37+
Color color3 = PenColors.Yellows.Gold;
38+
Color color4 = PenColors.Yellows.Yellow;
39+
ColorWheel.addColor(color1);
40+
ColorWheel.addColor(color2);
41+
ColorWheel.addColor(color3);
42+
ColorWheel.addColor(color4);
43+
ColorWheel.addColor(color4);
44+
ColorWheel.addColor(color3);
45+
ColorWheel.addColor(color2);
46+
ColorWheel.addColor(color1);
47+
//
48+
}
49+
// ------------- Recipe for DrawOctogon --#10
50+
private static void drawOctogon()
51+
{
52+
// Do the following 8 times --#6
53+
for (int i = 0; i < 8; i++)
54+
{
55+
// Change the pen color of the line the tortoise draws to the next color on the color wheel --#4
56+
Tortoise.setPenColor(ColorWheel.getNextColor());
57+
// Move the tortoise 50 pixels --#2
58+
Tortoise.move(50);
59+
// Turn the tortoise 1/8th of 360 degrees to the right --#5
60+
Tortoise.turn(360.0 / 8);
61+
}
62+
}
63+
}

src/main/java/org/teachingkidsprogramming/section04mastery/DeepDive04Mastery.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -113,7 +113,7 @@ public void dividing() throws Exception
113113
{
114114
Number number = 1.0 / 5;
115115
Assert.assertEquals(number.getClass(), ______.class);
116-
Assert.assertEquals(number, .2);
116+
Assert.assertEquals(number, ___);
117117
}
118118
@Test
119119
public void dividingIntegers() throws Exception
@@ -155,6 +155,7 @@ public void understandingDoubleNumbers() throws Exception
155155
public boolean ______ = true;
156156
public String ___ = "You need to fill in the blank ___";
157157
public Integer ____ = null;
158+
private Double _______;
158159
public String ___()
159160
{
160161
return ___;

0 commit comments

Comments
 (0)