Skip to content

Commit f9d7f14

Browse files
committed
upd: linter bug fix
1 parent 1bd3f11 commit f9d7f14

File tree

4 files changed

+18
-33
lines changed

4 files changed

+18
-33
lines changed

app/src/main/java/hexlet/code/Calc.java

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -5,18 +5,18 @@
55

66
public class Calc {
77
public static void gameLogic() {
8-
final int RND_MAX_VALUE = 100;
9-
final int MATH_SYMBOL_MAX_VALUE = 3;
8+
final int rndMax = 100;
9+
final int mathSymbolMax = 3;
1010
Engine.userGreetings();
1111
Scanner sc = new Scanner(System.in);
1212
char[] mathSymbols = {'+', '-', '*'};
1313
int result = 0;
1414
System.out.println("What is the result of the expression?\n");
1515
while (Engine.questionCounter != Engine.MAX_QUESTIONS) {
1616
Random randNum = new Random();
17-
int randMathSymbol = randNum.nextInt(MATH_SYMBOL_MAX_VALUE);
18-
int num1 = randNum.nextInt(RND_MAX_VALUE);
19-
int num2 = randNum.nextInt(RND_MAX_VALUE);
17+
int randMathSymbol = randNum.nextInt(mathSymbolMax);
18+
int num1 = randNum.nextInt(rndMax);
19+
int num2 = randNum.nextInt(rndMax);
2020
System.out.println("Question: " + num1 + " " + mathSymbols[randMathSymbol] + " " + num2);
2121
result = switch (mathSymbols[randMathSymbol]) {
2222
case '+' -> num1 + num2;

app/src/main/java/hexlet/code/Engine.java

Lines changed: 8 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -28,29 +28,14 @@ public static void selectGame() {
2828
System.out.println(formattedGamesList);
2929
int gameNumber = sc.nextInt();
3030
switch (gameNumber) {
31-
case 0:
32-
System.console();
33-
break;
34-
case 1:
35-
Cli.userGreeting();
36-
break;
37-
case 2:
38-
EvenGame.gameLogic();
39-
break;
40-
case 3:
41-
Calc.gameLogic();
42-
break;
43-
case 4:
44-
GCD.gameLogic();
45-
break;
46-
case 5:
47-
Progression.gameLogic();
48-
break;
49-
case 6:
50-
Prime.gameLogic();
51-
break;
52-
default:
53-
System.console();
31+
case 0-> System.console();
32+
case 1 -> Cli.userGreeting();
33+
case 2 -> EvenGame.gameLogic();
34+
case 3 -> Calc.gameLogic();
35+
case 4 -> GCD.gameLogic();
36+
case 5 -> Progression.gameLogic();
37+
case 6 -> Prime.gameLogic();
38+
default -> System.console();
5439
}
5540
}
5641

app/src/main/java/hexlet/code/GCD.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,15 +5,15 @@
55

66
public class GCD {
77
public static void gameLogic() {
8-
final int MAX_VALUE = 100;
8+
final int maxValue = 100;
99
Engine.userGreetings();
1010
System.out.println("Find the greatest common divisor of given numbers.");
1111
Scanner sc = new Scanner(System.in);
1212
int result;
1313
while (Engine.questionCounter != Engine.MAX_QUESTIONS) {
1414
Random randNum = new Random();
15-
int num1 = randNum.nextInt(MAX_VALUE);
16-
int num2 = randNum.nextInt(MAX_VALUE);
15+
int num1 = randNum.nextInt(maxValue);
16+
int num2 = randNum.nextInt(maxValue);
1717
System.out.println("Question: " + num1 + " " + num2);
1818
int answer = sc.nextInt();
1919
result = Engine.gcdGenerate(num1, num2);

app/src/main/java/hexlet/code/Prime.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,13 +5,13 @@
55

66
public class Prime {
77
public static void gameLogic() {
8-
final int RND_NUM_MAX = 1000;
8+
final int rndMax = 1000;
99
Scanner sc = new Scanner(System.in);
1010
Random randNum = new Random();
1111
Engine.userGreetings();
1212
System.out.println("Answer 'yes' if given number is prime. Otherwise answer 'no'.");
1313
while (Engine.questionCounter != Engine.MAX_QUESTIONS) {
14-
int num = randNum.nextInt(2, RND_NUM_MAX);
14+
int num = randNum.nextInt(2, rndMax);
1515
boolean isPrime = true;
1616
System.out.println("Question: " + num);
1717
for (int i = 2; i <= Math.sqrt(num); i++) {

0 commit comments

Comments
 (0)