New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. Weโll occasionally send you account related emails.
Already on GitHub? Sign in to your account
๐ 3๋จ๊ณ - ๋ก๋(2๋ฑ) #792
base: goyounggyeong
Are you sure you want to change the base?
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
์๋
ํ์ธ์!
3๋จ๊ณ ๊ตฌํ ์ ํด์ฃผ์
จ๋ค์!! ๐
๋ช๊ฐ์ง ์ฝ๋ฉํธ๋ฅผ ๋จ๊ฒจ๋จ์ผ๋ ํ์ธ๋ถํ๋๋ฆด๊ฒ์~~~
@@ -23,8 +23,9 @@ fun main() { | |||
printLottoNumber(purchasedLottos) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
์ ์ ๊ฐ 2๋จ๊ณ์์ ํผ๋๋ฐฑ ๋๋ฆฌ์ง ๋ชปํ๋ถ๋ถ์ด ์์ด์ ์๊ธฐ์ ๋จ๊ธธ๊ฒ์!!
- COMMA_SEPARATOR๊ฐ LottoPlay์ ์์นํ ์ด์ ๊ฐ ์์๊น์? StringUtil์์๋ง ์ฌ์ฉ๋๋ ๊ฒ ๊ฐ์์!
- purchasedLottos๋ MutableList๊ฐ ์๋๋ผ List์ฌ๋ ์ถฉ๋ถํ ๊ฒ ๊ฐ์์ :)
|
||
fun setLottoPrize(lastWeekWinningNumbers: List<Int>, lastWeekBonusNumber: Int): LottoPrize { | ||
val matchingNumbers = match(lastWeekWinningNumbers) | ||
val bonusBallMatching: Int = |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
- Booleanํ์ ์ด์ฌ๋ ์ถฉ๋ถํ์ง ์์๊น์?
- ํด๋น๋ณ์์๋ง ๋ฆฌํด๊ฐ์ ๋ช ์ํ์ ์ด์ ๊ฐ ์์๊น์?
NONE_PRIZE(0, 0); | ||
enum class LottoPrize(val matchingCount: Int, val bonusMatching: Int = 0, val prizeAmount: Long) { | ||
FIRST(6, 0, 2000000000), | ||
BONUS(5, 1, 30000000), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
๋ณดํต ๋ก๋์์ 2๋ฑ์ 5๊ฐ ์ผ์น + ๋ณด๋์ค ์ผ์น๋ก ์ด์ผ๊ธฐํ๋๋ฐ์! ํด๋น enum์ ๊ฐ์ด BONUS๊ฐ ๋์ด์ผํ์ง ์์๊น์?
@@ -4,14 +4,23 @@ class Lotto { | |||
var lottoPrize: LottoPrize = LottoPrize.NONE_PRIZE | |||
val purchasedLottoNumbers: List<Int> = LOTTO_NUMBERS.shuffled().take(LOTTO_NUMBER_COUNT).sorted() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
์ง๋์ฃผ ๋ฆฌ๋ทฐ์์ LottoNumber๋ฅผ ๊ฐ๊ฐ์ฒด๋ก wrappingํ๋ ์์๋ฅผ ๋ณด์ฌ์คฌ๋๋ฐ์! ์ด๋ฒ์ ๊ฐ๊ฐ์ฒด๋ฅผ ๋ง๋ค์ด๋ณด์๋ฉด ์ด๋จ๊น์?
val lastWeekWinningNumbers: List<Int> = toIntList(lastWeekWinningString) | ||
purchasedLottos.forEach { it.setLottoPrize(lastWeekWinningNumbers) } | ||
purchasedLottos.forEach { it.setLottoPrize(lastWeekWinningNumbers, lastWeekBonusNumber) } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ํ์ฌ๋ lastWeekWinningNumbers๋ฅผ List๋ก ๋๊ฒจ์ฃผ๊ณ ์์ง๋ง, ํด๋น ๋ณ์๋ ํ๋์ Lotto๊ฐ์ฒด๋ก ๋ง๋ค์ด๋ณด๋ฉด ์ด๋จ๊น์??
WinningLotto์ ๊ฐ์ด Lotto์ BonusNumber๋ฅผ ๊ฐ์ง๊ณ ์๋ ๊ฐ์ฒด๋ฅผ ๋ง๋ค์ด๋ณผ ์ ์์๊ฒ ๊ฐ์์!
์๋ ํ์ธ์. ๋ฆฌ๋ทฐ ์ ๋ถํ๋๋ฆฝ๋๋ค. :)