Skip to content

Commit 4ee4dec

Browse files
committed
chore: replacing magic numbers with constants
1 parent 904127b commit 4ee4dec

File tree

1 file changed

+15
-7
lines changed

1 file changed

+15
-7
lines changed

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

Lines changed: 15 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,14 @@
99
import java.util.Scanner;
1010

1111
public class App {
12+
private static final int GREET = 1;
13+
private static final int EVEN_GAME = 2;
14+
private static final int CALC_GAME = 3;
15+
private static final int GCD_GAME = 4;
16+
private static final int PROGRESSION_GAME = 5;
17+
private static final int PRIME_GAME = 6;
18+
private static final int EXIT = 0;
19+
1220
public static void main(String[] args) {
1321
Scanner sc = new Scanner(System.in);
1422
System.out.println("""
@@ -22,25 +30,25 @@ public static void main(String[] args) {
2230
System.out.print("Your choice: ");
2331
int selectedGame = sc.nextInt();
2432
switch (selectedGame) {
25-
case 1:
33+
case GREET:
2634
Cli.greet();
2735
break;
28-
case 2:
36+
case EVEN_GAME:
2937
Even.startGame();
3038
break;
31-
case 3:
39+
case CALC_GAME:
3240
Calc.startGame();
3341
break;
34-
case 4:
42+
case GCD_GAME:
3543
GCD.startGame();
3644
break;
37-
case 5:
45+
case PROGRESSION_GAME:
3846
Progression.startGame();
3947
break;
40-
case 6:
48+
case PRIME_GAME:
4149
Prime.startGame();
4250
break;
43-
case 0:
51+
case EXIT:
4452
System.out.println("Quit the game...");
4553
break;
4654
default:

0 commit comments

Comments
 (0)