File tree Expand file tree Collapse file tree 3 files changed +75
-0
lines changed
src/main/java/org/teachingkidsprogramming/recipes/completed
section02methods/KataQuestions
section03ifs/KataQuestions Expand file tree Collapse file tree 3 files changed +75
-0
lines changed Original file line number Diff line number Diff line change 1+ package org .teachingkidsprogramming .recipes .completed .section02methods .KataQuestions ;
2+
3+ //------------FourSquare Kata---------------//
4+ // Use the Tortoise to draw four squares, each with a width and height of 50 pixels
5+ // Write each of the English line comments (use at least 8 line comments)
6+ // Number each comment line at the end
7+ // Verify - step one - Translate EACH comment line into code
8+ // Verify - step two - Run your code after each line
9+ public class CompleteFourSquare
10+ {
11+ public static void main ()
12+ {
13+ System .out .println ("be sure to complete the main method to start" );
14+ //TODO: write comments and then code here
15+ }
16+ }
Original file line number Diff line number Diff line change 1+ package org .teachingkidsprogramming .recipes .completed .section03ifs .KataQuestions ;
2+
3+ //------------Snowflake Kata---------------//
4+ // Use the Tortoise to draw a snowflake using triangles
5+ // Write each of the English line comments (use at least 8 line comments)
6+ // Number each comment line at the end
7+ // Verify - step one - Translate EACH comment line into code
8+ // Verify - step two - Run your code after each line
9+ public class CompleteSnowflake
10+ {
11+ //TODO: write comments and then code here
12+ }
Original file line number Diff line number Diff line change 1+ package org .teachingkidsprogramming .recipes .completed .section03ifs .KataQuestions ;
2+
3+ import org .teachingextensions .logo .Tortoise ;
4+ import org .teachingextensions .logo .utils .ColorUtils .PenColors ;
5+
6+ //------------Snowflake Kata---------------//
7+ public class CompleteSnowflakeAnswer
8+ {
9+ public static void main (String [] args )
10+ {
11+ setUpBackground ();
12+ for (int i = 0 ; i < 6 ; i ++)
13+ {
14+ makeStarTop (4 );
15+ Tortoise .turn (-60 );
16+ }
17+ }
18+ private static void makeStarTop (int starSides )
19+ {
20+ for (int i = 0 ; i < starSides - 1 ; i ++)
21+ {
22+ makeTriangleTop (3 );
23+ Tortoise .turn (-60 );
24+ }
25+ Tortoise .move (45 );
26+ Tortoise .turn (-60 );
27+ Tortoise .move (45 );
28+ }
29+ private static void makeTriangleTop (int triangleSides )
30+ {
31+ for (int i = 1 ; i < triangleSides - 1 ; i ++)
32+ {
33+ Tortoise .move (60 );
34+ Tortoise .turn (360 / triangleSides );
35+ Tortoise .move (60 );
36+ }
37+ }
38+ private static void setUpBackground ()
39+ {
40+ Tortoise .show ();
41+ Tortoise .setX (400 );
42+ Tortoise .setY (100 );
43+ Tortoise .setSpeed (10 );
44+ Tortoise .getBackgroundWindow ().setBackground (PenColors .Whites .AliceBlue );
45+ Tortoise .setPenColor (PenColors .Grays .SlateGray );
46+ }
47+ }
You can’t perform that action at this time.
0 commit comments