File tree Expand file tree Collapse file tree
src/main/java/org/teachingkidsprogramming
recipes/completed/section01forloops Expand file tree Collapse file tree Original file line number Diff line number Diff line change 33import org .teachingextensions .logo .ColorWheel ;
44import org .teachingextensions .logo .PenColors ;
55import org .teachingextensions .logo .Tortoise ;
6+ import org .teachingextensions .windows .MessageBox ;
67
78public class Spiral
89{
@@ -21,12 +22,19 @@ public static void main(String[] args)
2122 // Do the following 75 times --#3
2223 for (int i = 0 ; i < 75 ; i ++)
2324 {
24- // Change the color of the line the tortoise draws the next color on the Color Wheel --#6
25- Tortoise .setPenColor (ColorWheel .getNextColor ());
26- // Move the tortoise 5 times the current line number you are drawing --#5
27- Tortoise .move (i * 5 );
28- // Turn the tortoise 1/3 of 360 degrees to the right --#2
29- Tortoise .turn (360.0 / 3 );
25+ try
26+ {
27+ // Change the color of the line the tortoise draws the next color on the Color Wheel --#6
28+ Tortoise .setPenColor (ColorWheel .getNextColor ());
29+ // Move the tortoise 5 times the current line number you are drawing --#5
30+ Tortoise .move (i * 5 );
31+ // Turn the tortoise 1/3 of 360 degrees to the right --#2
32+ Tortoise .turn (360.0 / 3 );
33+ }
34+ catch (RuntimeException re )
35+ {
36+ MessageBox .showMessage ("Hold up: " + re );
37+ }
3038 }
3139 }
3240}
Original file line number Diff line number Diff line change 11package org .teachingkidsprogramming .section01forloops ;
22
3+ import org .teachingextensions .windows .MessageBox ;
4+
35public class Spiral
46{
57 public static void main (String [] args )
@@ -10,9 +12,16 @@ public static void main(String[] args)
1012 // Add Violet to the Color Wheel --#8
1113 // Add Purple to the Color Wheel --#9
1214 // Do the following 75 times --#3.1
13- // Change the pen color of the line the tortoise draws the next color on the Color Wheel --#6
14- // Move the tortoise 5 times the current line number you are drawing --#5
15- // Turn the tortoise 1/3 of 360 degrees to the right --#2
15+ try
16+ {
17+ // Change the pen color of the line the tortoise draws the next color on the Color Wheel --#6
18+ // Move the tortoise 5 times the current line number you are drawing --#5
19+ // Turn the tortoise 1/3 of 360 degrees to the right --#2
20+ }
21+ catch (RuntimeException re )
22+ {
23+ MessageBox .showMessage ("Hold up: " + re );
24+ }
1625 // Repeat --#3.2
1726 }
1827}
You can’t perform that action at this time.
0 commit comments