File tree Expand file tree Collapse file tree 4 files changed +66
-6
lines changed
src/main/java/org/teachingkidsprogramming/recipes/completed/section02methods/KataQuestions Expand file tree Collapse file tree 4 files changed +66
-6
lines changed Original file line number Diff line number Diff line change 1111// Then translate the steps into code
1212// Make sure to run after each line
1313//
14- public class HousesToAColorfulPointyAndASlantedRoof_05
14+ public class HousesToAColorfulPointyAndASlantedRoof_04
1515{
1616 public static void main (String [] args )
1717 {
Original file line number Diff line number Diff line change 1- package org .teachingkidsprogramming .recipes .completed .section02methods ;
1+ package org .teachingkidsprogramming .recipes .completed .section02methods . KataQuestions ;
22
33import org .teachingextensions .logo .Tortoise ;
44// NOTE: Re-factor to remove duplicate code HINT: Use Extract Method
55import org .teachingextensions .logo .utils .ColorUtils .PenColors ;
66
7- public class PyramidsOfGizaMiddle
7+ //------------Kata Question---------------//
8+ // Where do you see duplicate lines of code?
9+ // and how can you refactor to make this code more readable?
10+ // Write out the steps in English
11+ // Then translate the steps into code
12+ // Make sure to run after each line
13+ //
14+ public class PyramidsOfGizaRemoveDuplication_01
815{
916 public static void main (String [] args ) throws Exception
1017 {
Original file line number Diff line number Diff line change 1- package org .teachingkidsprogramming .recipes .completed .section02methods ;
1+ package org .teachingkidsprogramming .recipes .completed .section02methods . KataQuestions ;
22
33import org .teachingextensions .logo .Tortoise ;
44import org .teachingextensions .logo .utils .ColorUtils .PenColors ;
55
6- public class PyramidsOfGizaEnd
6+ //------------Kata Question---------------//
7+ //Where do you see duplicate lines of code?
8+ // and how can you refactor to make this code more readable?
9+ //Write out the steps in English
10+ //Then translate the steps into code
11+ //Make sure to run after each line
12+ //
13+ public class PyramidsOfGizaRemoveEvenMoreDuplication_03
714{
815 public static void main (String [] args ) throws Exception
916 {
@@ -17,7 +24,6 @@ public static void main(String[] args) throws Exception
1724 moveDown ();
1825 turnAndMove (135 , 210 );
1926 }
20- // this makes the turtle turn and move -- duh
2127 public static void turnAndMove (int degrees , int length )
2228 {
2329 Tortoise .turn (degrees );
Original file line number Diff line number Diff line change 1+ package org .teachingkidsprogramming .recipes .completed .section02methods .KataQuestions ;
2+
3+ import org .teachingextensions .logo .Tortoise ;
4+ // NOTE: Re-factor to remove duplicate code HINT: Use Extract Method
5+ import org .teachingextensions .logo .utils .ColorUtils .PenColors ;
6+
7+ //------------Kata Question---------------//
8+ // Where do you see duplicate lines of code?
9+ // and how can you refactor to make this code more readable?
10+ // Write out the steps in English
11+ // Then translate the steps into code
12+ // Make sure to run after each line
13+ //
14+ public class PyramidsOfGizaRemoveMoreDuplication_02
15+ {
16+ public static void main (String [] args ) throws Exception
17+ {
18+ setUpPyramidLand ();
19+ Tortoise .turn (-90 );
20+ Tortoise .move (220 );
21+ Tortoise .turn (135 );
22+ Tortoise .move (100 );
23+ moveDown ();
24+ Tortoise .turn (-90 );
25+ Tortoise .move (100 );
26+ moveDown ();
27+ Tortoise .turn (-90 );
28+ Tortoise .move (100 );
29+ moveDown ();
30+ Tortoise .turn (135 );
31+ Tortoise .move (210 );
32+ }
33+ public static void moveDown ()
34+ {
35+ Tortoise .turn (90 );
36+ Tortoise .move (100 );
37+ }
38+ private static void setUpPyramidLand ()
39+ {
40+ Tortoise .show ();
41+ Tortoise .setSpeed (10 );
42+ Tortoise .getBackgroundWindow ().setBackground (PenColors .Blues .AliceBlue );
43+ Tortoise .setPenColor (PenColors .Yellows .DarkGoldenrod );
44+ Tortoise .setPenWidth (2 );
45+ Tortoise .hide ();
46+ }
47+ }
You can’t perform that action at this time.
0 commit comments