Skip to content

Commit 0280116

Browse files
committed
added SquareKata
1 parent db62b4b commit 0280116

4 files changed

Lines changed: 48 additions & 13 deletions

File tree

0 Bytes
Binary file not shown.

TeachingKidsProgramming/src/org/teachingkidsprogramming/section06modelviewcontroller/OneFishTwoFish.java

Lines changed: 15 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -4,31 +4,33 @@
44
@SuppressWarnings("unused")
55
public class OneFishTwoFish
66
{
7-
// Create a Scanner to make a string
7+
// Create a Scanner to make a string --#1
88
public static void main(String[] args)
99
{
1010
makeAString();
1111
}
1212
public static void makeAString()
1313
{
1414
final String input = "1 fish 2 fish red fish blue fish,black fish,blue fish,old fish,new fish ";
15-
// Use your scanner with your input
16-
// Display a new line and "We have: " and the input and then a new line
17-
// Now, tell a story with a new Scanner instance
15+
// Use your scanner with your input --#2
16+
// Display a new line and "We have: " and the input and then a new line --#3
17+
// Now, tell a story with a new Scanner instance (tellAStory recipe) --#8
1818
}
19+
//-------recipe for tellAStory------------------------------------
1920
private static void tellAStory(final String input)
2021
{
21-
// Use 'fish' as the base text w/your scanner [story] HINT: useDelimeter
22-
// Get the next number to use in your scanner [story] HINT: nextInt
23-
// Get the next value to use in your scanner [story] HINT: next
24-
// Iterate over each fish [string] HINT: Interable
25-
// Create a new string iterator
26-
// Create a new scanner for your input
27-
// Use a comma to separate the strings in your story HINT: useDelimeter
28-
// Return the result
22+
// Use 'fish' as the base text w/your scanner [story] HINT: useDelimeter --#5
23+
// Get the next number to use in your scanner [story] HINT: nextInt --#7
24+
// Get the next value to use in your scanner [story] HINT: next --#9
25+
// Iterate over each fish [string] HINT: Interable --#10
26+
// Create a new string iterator --#11
27+
// Create a new scanner for your input --#12
28+
// Use a comma to separate the strings in your story HINT: useDelimeter --#13
29+
// Return the result --#6
2930
{
30-
// Display "And then: " and the fish in the console
31+
// Display "And then: " and the fish in the console --#14
3132
}
3233
System.out.println("");
34+
//------end recipe tellAStory--------------------------------------
3335
}
3436
}
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
package org.teachingkidsprogramming.section09final;
2+
3+
public class SquareKata
4+
{
5+
public static void main(String[] args)
6+
{
7+
// Draw a square
8+
// HINT: Write each step in English FIRST, then translate to Java one line at a time
9+
// TIP: Be sure to run after each line of Java to make sure it works as expected
10+
}
11+
}
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
package org.teachingkidsprogramming.section09final;
2+
3+
//--------------------This recipe is in progress-------------------------------//
4+
import static org.junit.Assert.assertEquals;
5+
6+
import org.junit.Test;
7+
import org.teachingkidsprogramming.recipes.completed.section09final.FizzBuzzTDD;
8+
9+
public class SquareKataTDD
10+
{
11+
// Draw a square
12+
// HINT: Write each step in English FIRST, then translate to Java one line at a time
13+
// TIP: Be sure to run after each line of Java to make sure it works as expected
14+
// Write tests using the Assert object via the TDD style shown below
15+
// TIP: Fix this test to make it pass to get started
16+
@Test
17+
public void test1Returns1()
18+
{
19+
String result = FizzBuzzTDD.convert(1);
20+
assertEquals("2", result);
21+
}
22+
}

0 commit comments

Comments
 (0)