-
Notifications
You must be signed in to change notification settings - Fork 107
Expand file tree
/
Copy pathLottoGame.java
More file actions
32 lines (24 loc) · 902 Bytes
/
LottoGame.java
File metadata and controls
32 lines (24 loc) · 902 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
import java.util.ArrayList;
import java.util.List;
public class LottoGame {
private final InputView inputView;
private final OutputView outputView;
public LottoGame(InputView inputView, OutputView outputView) {
this.inputView = inputView;
this.outputView = outputView;
}
public void run() {
int inputPrice = inputView.inputLottoPrice();
LottoPrice price = new LottoPrice(inputPrice);
List<Lotto> lottos = getLottos(price);
outputView.printLotto(lottos);
}
private List<Lotto> getLottos(LottoPrice price) {
List<Lotto> lottos = new ArrayList<>();
RandomLottoGenerator randomLottoGenerator = new RandomLottoGenerator();
for (int i = 0; i < price.getPrice() / 1000; i++) {
lottos.add(new Lotto(randomLottoGenerator.generateLotto().numbers()));
}
return lottos;
}
}