File tree 2 files changed +5
-8
lines changed
2 files changed +5
-8
lines changed Original file line number Diff line number Diff line change @@ -5,19 +5,19 @@ import lotto.domain.Money.Companion.toMoney
5
5
class LottoServiceRound {
6
6
private val lottoRound = LottoRound (LottoRoundElements ())
7
7
8
- fun buyLottos (payment : Money ): List <Lotto > {
8
+ fun buyLottos (payment : Long ): List <Lotto > {
9
9
lottoRound.addNewLottos(payment.buyableCount())
10
10
return lottoRound.getLottos()
11
11
}
12
12
13
- fun allPayment (): Money = (lottoRound.getLottos().size * LOTTO_BUY_PRIZE .value).toMoney( )
13
+ fun allPayment (): Long = (lottoRound.getLottos().size * LOTTO_BUY_PRIZE .value)
14
14
15
15
fun lotteryDraw (numbers : List <Int >): LottoRoundStatistics {
16
16
val winningLotto = Lotto .of(numbers)
17
17
return lottoRound.lotteryDraw(winningLotto)
18
18
}
19
19
20
- private fun Money .buyableCount (): Int = (value / LOTTO_BUY_PRIZE .value).toInt()
20
+ private fun Long .buyableCount (): Int = (this / LOTTO_BUY_PRIZE .value).toInt()
21
21
22
22
companion object {
23
23
private val LOTTO_BUY_PRIZE = 1000L .toMoney()
Original file line number Diff line number Diff line change 1
1
import lotto.domain.LottoServiceRound
2
- import lotto.domain.Money.Companion.toMoney
3
2
import lotto.view.LottoInputView
4
3
import lotto.view.LottoOutputView
5
4
@@ -11,11 +10,9 @@ fun lotto() {
11
10
val lottoOutputView = LottoOutputView ()
12
11
13
12
val payment = lottoInputView.inputLottoBuy()
14
- lottoServiceRound.buyLottos(payment.toLong().toMoney()).also {
15
- lottoOutputView.currentLottos(it)
16
- }
13
+ lottoServiceRound.buyLottos(payment.toLong()).also { lottoOutputView.currentLottos(it) }
17
14
18
15
val winningLottoNumbers = lottoInputView.inputWinningLotto()
19
16
val lottoRoundStatistics = lottoServiceRound.lotteryDraw(winningLottoNumbers)
20
- lottoOutputView.result(lottoServiceRound.allPayment().value , lottoRoundStatistics)
17
+ lottoOutputView.result(lottoServiceRound.allPayment(), lottoRoundStatistics)
21
18
}
You can’t perform that action at this time.
0 commit comments