-
Notifications
You must be signed in to change notification settings - Fork 409
Expand file tree
/
Copy pathController.java
More file actions
45 lines (32 loc) · 1.11 KB
/
Controller.java
File metadata and controls
45 lines (32 loc) · 1.11 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
34
35
36
37
38
39
40
41
42
43
44
45
package menu.controller;
import menu.domain.*;
import menu.view.InputView;
import menu.view.OutputView;
import java.util.List;
public class Controller {
public void run() {
OutputView.welcomeMessage();
Coach coach = askCoachName();
NonPreferredMenu nonPreferredMenu = askNonPreferred(coach.getCoachNames());
ChooseCategory chooseCategory = new ChooseCategory();
chooseCategory.choose();
printCategory(chooseCategory.getCategory());
Menu menu = new Menu();
menu.Recommend(chooseCategory.getCategory(),coach.getCoachNames());
}
private void printCategory(List<MenuCategory> category) {
OutputView.printCategory(category);
}
private NonPreferredMenu askNonPreferred(List<String> coachNames) {
return new NonPreferredMenu(InputView.askNonPreferred(coachNames));
}
private Coach askCoachName() {
while (true) {
try {
return new Coach(InputView.askCoachName());
} catch (IllegalArgumentException e) {
OutputView.printError(e);
}
}
}
}