-
Notifications
You must be signed in to change notification settings - Fork 906
Expand file tree
/
Copy pathMain.java
More file actions
39 lines (28 loc) · 968 Bytes
/
Main.java
File metadata and controls
39 lines (28 loc) · 968 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
import study.numberBaseball.NumberBaserball;
import java.util.Scanner;
public class Main {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
int gameStart = 1;
int number = 0;
int input = 0;
NumberBaserball baseball = new NumberBaserball();
number = baseball.initNumber();
while (gameStart == 1){
input = baseball.scanNumber(sc);
int ballCount = baseball.countBall(number, input);
int strikeCount = baseball.countStrike(number, input);
String result = baseball.printResult(ballCount, strikeCount);
System.out.println(result);
if(strikeCount != 3){
continue;
}
if(baseball.contiueGame(sc) == 1){
baseball.initNumber();
continue;
}
gameStart = 2;
baseball.printGameOver();
}
}
}