Skip to content

Commit bc200cc

Browse files
committed
updating FizzBuzz w/ @mattballin
1 parent 5b51314 commit bc200cc

4 files changed

Lines changed: 14 additions & 6 deletions

File tree

src/main/java/org/teachingkidsprogramming/recipes/completed/section09final/FizzBuzz.java

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,14 +14,12 @@ public static void main(String[] args)
1414
}
1515
public static String convert(int i)
1616
{
17-
// If that number is divisible by either 3 or 5, then print the word 'FizzBuzz'
17+
// If that number is divisible by 3 and 5, then print the word 'FizzBuzz'
1818
if (0 == i % 15) { return "\n FizzBuzz"; }
1919
// If that number is divisible by 5, then print the word 'Buzz',
2020
if (0 == i % 5) { return "\n Buzz"; }
2121
// If that number is divisible by 3, then print the word 'Fizz',
2222
if (0 == i % 3) { return "\n Fizz"; }
2323
return "\n " + i;
2424
}
25-
// For more complete directions see this page
26-
// https://www.penflip.com/lynnlangit/tkp-lesson-plans/blob/master/course09.txt
2725
}

src/main/java/org/teachingkidsprogramming/section09final/FizzBuzz.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ public class FizzBuzz
55
// For the whole numbers from 1 to 100, print either that number, or,
66
// If that number is divisible by 3, then print the word 'Fizz',
77
// If that number is divisible by 5, then print the word 'Buzz',
8-
// If that number is divisible by either 3 or 5, then print the word 'FizzBuzz'
8+
// If that number is divisible by 3 and 5, then print the word 'FizzBuzz'
99
//
1010
// NOTE: this is a kata (higher level instructions)
1111
// part of the exercise is to translate into line-by-line English, THEN Java

src/main/java/org/teachingkidsprogramming/section09final/FizzBuzzGoldenMaster.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ public static String convert(int i)
2121
// For the whole numbers from 1 to 100, print either that number, or,
2222
// If that number is divisible by 3, then print the word 'Fizz',
2323
// If that number is divisible by 5, then print the word 'Buzz',
24-
// If that number is divisible by either 3 or 5, then print the word 'FizzBuzz'
24+
// If that number is divisible by 3 and 5, then print the word 'FizzBuzz'
2525
return "";
2626
}
2727
}
Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,24 @@
11
package org.teachingkidsprogramming.section09final;
22

3+
import static org.junit.Assert.assertEquals;
4+
5+
import org.junit.Test;
6+
37
public class FizzBuzzTDD
48
{
59
// For the numbers being tested, print out either that number, or,
610
// If that number is divisible by 3, then print the word 'Fizz',
711
// If that number is divisible by 5, then print the word 'Buzz',
8-
// If that number is divisible by either 3 or 5, then print the word 'FizzBuzz'
12+
// If that number is divisible by 3 and 5, then print the word 'FizzBuzz'
913
//
1014
// Write tests using the Assert object via the TDD style
1115
//
1216
// For more complete directions see this page
1317
// https://www.penflip.com/lynnlangit/tkp-lesson-plans/blob/master/course09.txt
18+
@Test
19+
public void test1Returns1()
20+
{
21+
//String result = FizzBuzzTDD.convert(1);
22+
assertEquals(1, 0);
23+
}
1424
}

0 commit comments

Comments
 (0)