-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Expand file tree
/
Copy pathUser.java
More file actions
28 lines (21 loc) · 807 Bytes
/
User.java
File metadata and controls
28 lines (21 loc) · 807 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
import java.util.ArrayList;
import java.util.List;
import java.util.Scanner;
public class User {
public static void main(String[] args) {
Scanner scanner = new Scanner(System.in);
System.out.println("경주할 자동차 이름을 입력 하세요. (이름은 쉼표(,)로 구분)");
String input = scanner.nextLine();
String[] splitCarNames = input.split(",");
List<Car> cars = new ArrayList<>();
for (String carName : splitCarNames) {
cars.add(new Car(carName));
}
System.out.println("시도할 회수는 몇회인가요?");
int rounds = scanner.nextInt();
System.out.println("실행 결과");
Game game = new Game(cars);
game.startGame(rounds);
scanner.close();
}
}