-
Notifications
You must be signed in to change notification settings - Fork 4
Expand file tree
/
Copy pathView.java
More file actions
34 lines (25 loc) · 907 Bytes
/
View.java
File metadata and controls
34 lines (25 loc) · 907 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
package racingcar;
import camp.nextstep.edu.missionutils.Console;
import java.util.Map;
public class View {
String inputCarName(){
System.out.println("경주할 자동차 이름을 입력하세요.(이름은 쉼표(,)기준으로 구분)");
return Console.readLine();
}
String inputNumberOfAttempts(){
System.out.println("시도할 회수는 몇회인가요?");
return Console.readLine();
}
void printResult(Map<String, Integer> result){
StringBuilder sb = new StringBuilder();
sb.append("\n실행 결과\n\n");
result.forEach((name, distance)-> sb.append(name).append(" : ")
.append("-".repeat(distance))
.append("\n"));
System.out.println(sb);
}
void printWinner(String winner){
System.out.print("최종 우승자 : ");
System.out.println(winner);
}
}