Skip to content

Commit 77b9c1a

Browse files
committed
FizzBuzz update suggested by @KevlinHenney
1 parent aecf89e commit 77b9c1a

4 files changed

Lines changed: 12 additions & 12 deletions

File tree

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

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,11 +14,11 @@ public static void main(String[] args)
1414
}
1515
public static String convert(int i)
1616
{
17-
// If that number is evenly divisible by either 3 or 5, then print the word 'FizzBuzz'
17+
// If that number is divisible by either 3 or 5, then print the word 'FizzBuzz'
1818
if (0 == i % 15) { return "\n FizzBuzz"; }
19-
// If that number is evenly divisible by 5, then print the word 'Buzz',
19+
// If that number is divisible by 5, then print the word 'Buzz',
2020
if (0 == i % 5) { return "\n Buzz"; }
21-
// If that number is evenly divisible by 3, then print the word 'Fizz',
21+
// 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
}

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

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,9 @@
33
public class FizzBuzz
44
{
55
// For the whole numbers from 1 to 100, print either that number, or,
6-
// If that number is evenly divisible by 3, then print the word 'Fizz',
7-
// If that number is evenly divisible by 5, then print the word 'Buzz',
8-
// If that number is evenly divisible by either 3 or 5, then print the word 'FizzBuzz'
6+
// If that number is divisible by 3, then print the word 'Fizz',
7+
// 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'
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: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -19,9 +19,9 @@ public void testNumbers() throws Exception
1919
public static String convert(int i)
2020
{
2121
// For the whole numbers from 1 to 100, print either that number, or,
22-
// If that number is evenly divisible by 3, then print the word 'Fizz',
23-
// If that number is evenly divisible by 5, then print the word 'Buzz',
24-
// If that number is evenly divisible by either 3 or 5, then print the word 'FizzBuzz'
22+
// If that number is divisible by 3, then print the word 'Fizz',
23+
// 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'
2525
return "";
2626
}
2727
}

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

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,9 @@
33
public class FizzBuzzTDD
44
{
55
// For the numbers being tested, print out either that number, or,
6-
// If that number is evenly divisible by 3, then print the word 'Fizz',
7-
// If that number is evenly divisible by 5, then print the word 'Buzz',
8-
// If that number is evenly divisible by either 3 or 5, then print the word 'FizzBuzz'
6+
// If that number is divisible by 3, then print the word 'Fizz',
7+
// 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'
99
//
1010
// Write tests using the Assert object via the TDD style
1111
//

0 commit comments

Comments
 (0)