-
Notifications
You must be signed in to change notification settings - Fork 8
Expand file tree
/
Copy pathLottoController.java
More file actions
78 lines (59 loc) · 2.25 KB
/
LottoController.java
File metadata and controls
78 lines (59 loc) · 2.25 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
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
package lotto.controller;
import lotto.model.Lotto;
import lotto.service.AdjustmentLotto;
import lotto.service.CalculateTotalBenefit;
import lotto.service.CountCorrectNumber;
import lotto.service.LottoList;
import lotto.view.UserInput;
import lotto.view.UserOutput;
import lotto.util.Validator;
public class LottoController {
UserInput userInput;
UserOutput userOutput;
Validator validator;
LottoList lottoList;
CountCorrectNumber countCorrectNumber;
AdjustmentLotto adjustmentLotto;
CalculateTotalBenefit calculateTotalBenefit;
public LottoController(
UserInput userInput,
UserOutput userOutput,
Validator validator,
LottoList lottoList,
CountCorrectNumber countCorrectNumber,
AdjustmentLotto adjustmentLotto,
CalculateTotalBenefit calculateTotalBenefit) {
this.userInput = userInput;
this.userOutput = userOutput;
this.validator = validator;
this.lottoList = lottoList;
this.countCorrectNumber = countCorrectNumber;
this.adjustmentLotto = adjustmentLotto;
this.calculateTotalBenefit = calculateTotalBenefit;
}
public void lottoPlaying(){
buyLotto();
executeLotto();
winningPriceLotto();
}
public void buyLotto(){
userInput.setBudget();
lottoList = new LottoList(userInput.getNumberOfLotto());
userOutput.printNumberOfLotto(userInput.getNumberOfLotto());
userOutput.printNumberOfLottoNumbers(lottoList.getLottoContainer());
}
public void executeLotto(){
userInput.setWinningNumbers();
Lotto winningLotto = new Lotto(userInput.getWinningLotto().getNumbers());
validator.numberCountValidator(winningLotto.getNumbers());
userInput.setBonusNumber();
validator.numberDuplicateWithBonusNumberValidator(winningLotto, userInput.getBonusNumber());
countCorrectNumber.listCorrectNumber(lottoList.getLottoContainer(), winningLotto);
}
public void winningPriceLotto(){
adjustmentLotto.countCorrectNumber();
userOutput.printWinningLotto(adjustmentLotto.getLotto());
calculateTotalBenefit.sumLotto();
calculateTotalBenefit.calculateTotalBenefit();
}
}