-
Notifications
You must be signed in to change notification settings - Fork 174
Expand file tree
/
Copy pathOutputView.java
More file actions
32 lines (25 loc) · 895 Bytes
/
OutputView.java
File metadata and controls
32 lines (25 loc) · 895 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
package baseball.view;
import baseball.model.Result;
public class OutputView {
public void printStartMessage() {
System.out.println("숫자 야구 게임을 시작합니다.");
}
public void printHint(Result result) {
int strike = result.strike();
int ball = result.ball();
if (strike == 0 && ball == 0) {
System.out.println("낫싱");
return;
}
StringBuilder sb = new StringBuilder();
if (ball > 0) sb.append(ball).append("볼 ");
if (strike > 0) sb.append(strike).append("스트라이크");
System.out.println(sb.toString().trim());
}
public void printGameEndMessage() {
System.out.println("3개의 숫자를 모두 맞히셨습니다! 게임 종료");
}
public void printError(String message) {
System.out.println("[ERROR] " + message);
}
}