We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 2149b77 commit 01032c1Copy full SHA for 01032c1
app/src/main/java/hexlet/code/games/Even.java
@@ -0,0 +1,22 @@
1
+package hexlet.code.games;
2
+
3
+import hexlet.code.Engine;
4
5
+import java.util.Random;
6
7
+public class Even {
8
+ public static void startGame() {
9
+ final int rndMax = 100;
10
+ String description = "Answer 'yes' if the number is even, otherwise answer 'no'.";
11
+ String[][] roundsData = new String[Engine.ROUNDS][2];
12
+ Random rand = new Random();
13
14
+ for (int i = 0; i < Engine.ROUNDS; i++) {
15
+ int question = rand.nextInt(rndMax);
16
+ String answer = (question % 2 == 0) ? "yes" : "no";
17
+ roundsData[i][0] = String.valueOf(question);
18
+ roundsData[i][1] = answer;
19
+ }
20
+ Engine.run(description, roundsData);
21
22
+}
app/src/main/java/hexlet/code/games/EvenGame.java
0 commit comments