Skip to content

Commit 0d03c2d

Browse files
committed
fixed checkstyle
1 parent 6c9d83f commit 0d03c2d

File tree

1 file changed

+11
-4
lines changed

1 file changed

+11
-4
lines changed

src/main/java/com/thealgorithms/puzzlesandgames/NumberGuess.java

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,11 +7,16 @@
77
package com.thealgorithms.puzzlesandgames;
88
import java.util.Scanner;
99

10-
public class NumberGuess {
10+
public final class NumberGuess {
11+
private NumberGuess() {
12+
throw new AssertionError("Cannot instantiate NumberGuess");
13+
}
14+
1115
public static void playGame() {
1216
Scanner sc = new Scanner(System.in);
1317
int number = (int) (Math.random() * 100) + 1;
14-
int guess = 0, tries = 0;
18+
int guess = 0;
19+
int tries = 0;
1520

1621
System.out.println("🎯 Welcome to the Number Guessing Game!");
1722
System.out.println("I've picked a number between 1 and 100. Try to guess it!\n");
@@ -33,10 +38,12 @@ public static void playGame() {
3338
continue;
3439
}
3540

36-
if (guess < number)
41+
if (guess < number) {
3742
System.out.println("Too low! 📉");
38-
else if (guess > number)
43+
}
44+
else if (guess > number) {
3945
System.out.println("Too high! 📈");
46+
}
4047
else {
4148
System.out.println("🎉 Correct! The number was " + number + ".");
4249
System.out.println("You took " + tries + " tries.");

0 commit comments

Comments
 (0)