-
Notifications
You must be signed in to change notification settings - Fork 175
Expand file tree
/
Copy pathInputView.java
More file actions
52 lines (45 loc) · 1.92 KB
/
InputView.java
File metadata and controls
52 lines (45 loc) · 1.92 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
46
47
48
49
50
51
52
package lotto2.view;
import lotto2.controller.Round;
import lotto2.model.*;
import lotto2.model.generator.LottoGeneratorFromUserInput;
import java.util.ArrayList;
import java.util.List;
import java.util.Scanner;
public class InputView {
public MoneyToBuy inputMoney() {
System.out.print("구입금액을 입력해 주세요.\n");
final Scanner scanner = new Scanner(System.in);
final String input = scanner.nextLine();
return new MoneyToBuy(input);
}
public ManualLottoCount inputManualCount(MoneyToBuy moneyToBuy) {
System.out.print("\n수동으로 구매할 로또 수를 입력해 주세요.\n");
final Scanner scanner = new Scanner(System.in);
final String input = scanner.nextLine();
return new ManualLottoCount(input, moneyToBuy);
}
public List<Lotto> inputManyManualLotto(ManualLottoCount lottoCount) {
System.out.print("\n수동으로 구매할 번호를 입력해 주세요.\n");
final List<Lotto> lottoBucket = new ArrayList<>();
final Round round = new Round(lottoCount.count());
while (round.hasNext()) {
round.goNext();
final Scanner scanner = new Scanner(System.in);
final String input = scanner.nextLine();
final LottoGeneratorFromUserInput lottoGenerator = new LottoGeneratorFromUserInput(input);
lottoBucket.add(lottoGenerator.generate());
}
return lottoBucket;
}
public String inputWinningNumbers() {
System.out.print("\n지난 주 당첨 번호를 입력해 주세요.\n");
final Scanner scanner = new Scanner(System.in);
return scanner.nextLine();
}
public LottoNumber inputBonusNumber() {
System.out.print("보너스 볼을 입력해 주세요.\n");
final Scanner scanner = new Scanner(System.in);
final String input = scanner.nextLine();
return new LottoNumber(input);
}
}