-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathOutputView.java
More file actions
33 lines (29 loc) · 1.53 KB
/
OutputView.java
File metadata and controls
33 lines (29 loc) · 1.53 KB
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
package baseball.view;
public class OutputView {
private static final String GAME_START_MESSAGE = "숫자 야구 게임을 시작합니다.";
private static final String STRIKE_MESSAGE = "스트라이크";
private static final String GAME_OVER_MESSAGE = "3개의 숫자를 모두 맞히셨습니다! 게임종료";
private static final String GAME_RESTART_OR_END_MESSAGE = "게임을 새로 시작하려면 1, 종료하려면 2를 입력하세요";
private static final String NOTHING_MESSAGE = "낫싱";
private static final String BALL_MESSAGE = "볼 ";
public static final int THREE_STRIKE = 3;
public static final int ZERO = 0;
public static void printGameStartMessage() {
System.out.println(GAME_START_MESSAGE);
}
public static void printGameResultMessage(final int strikeCount, final int ballCount) {
if (strikeCount == THREE_STRIKE) {
System.out.println(strikeCount + STRIKE_MESSAGE);
System.out.println(GAME_OVER_MESSAGE);
System.out.println(GAME_RESTART_OR_END_MESSAGE);
} else if (strikeCount == ZERO && ballCount == ZERO) {
System.out.println(NOTHING_MESSAGE);
} else if (strikeCount != ZERO && ballCount == ZERO) {
System.out.println(strikeCount + STRIKE_MESSAGE);
} else if (strikeCount == ZERO && ballCount != ZERO) {
System.out.println(ballCount + BALL_MESSAGE);
} else {
System.out.println(ballCount + BALL_MESSAGE + strikeCount + STRIKE_MESSAGE);
}
}
}