Skip to content
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

[둘리] 1단계 로또 제출합니다. #17

Merged
merged 36 commits into from
Feb 19, 2023
Merged
Changes from 1 commit
Commits
Show all changes
36 commits
Select commit Hold shift + click to select a range
8596d56
docs(README) : 구현 기능 목록 작성
re4rk Feb 14, 2023
6794faa
feat(LottoNumber) : 1부터 45까지 번호를 뽑는다.
re4rk Feb 14, 2023
488e0de
feat(LottoNumbers) : 숫자가 6개인 로또 번호를 뽑는다.
re4rk Feb 14, 2023
033a496
refactor(Lotto) : LottoNumbers -> Lotto
re4rk Feb 14, 2023
82e19f6
fix(Lotto) : 같은 list<> 인자로 인해 JVM 변환 발생으로 오류 수정
re4rk Feb 14, 2023
97ea472
feat(LottoFactory) : 입력 받은 개수만큼 로또를 생성하는 기능 구현
re4rk Feb 14, 2023
8b17bd1
docs(README) : 구현 기능 목록 수정
re4rk Feb 14, 2023
dd48bcf
feat(LottoStore) : 입력 받은 금액에 맞는 구매 개수만큼 로또를 반환한다.
re4rk Feb 14, 2023
ab19ba3
feat(WinningLotto) : 로또 번호, 로또 번호와 중복되지 않는 보너스 번호로 이루어진 당첨 번호를 생성
re4rk Feb 14, 2023
d31edd7
docs: 구현 기능 목록 수정
re4rk Feb 15, 2023
3a8ea66
fix(Lotto): 로또 숫자 중복 검증 기능 구현
re4rk Feb 15, 2023
5788c36
docs (README): 구현 기능 목록 수정
re4rk Feb 15, 2023
f6ce620
feat (WinningLotto): 로또를 받으면 맞는 개수를 반환하고 보너스 번호가 있는지 확인한다.
re4rk Feb 15, 2023
582319f
feat (Rank): 맞는 개수와 보너스 번호 매치 여부에 맞는 등수를 반환한다.
re4rk Feb 15, 2023
4c40648
feat (LottoResult): 총 등 별로 당첨 개수를 반환한다.
re4rk Feb 15, 2023
33ae683
fix (LottoFactory): 중복인 숫자가 나오지 않도록 수정
re4rk Feb 15, 2023
148622b
feat (LottoResult): 총 수익률을 계산한다.
re4rk Feb 15, 2023
7840c98
feat (InputView): 구입 금액을 입력받는다.
re4rk Feb 15, 2023
19620f7
feat (InputView): 당첨 번호와 보너스 번호를 입력 받는다.
re4rk Feb 15, 2023
ecfade4
feat(OutputView): 로또 구매 결과 출력 기능 구현
re4rk Feb 15, 2023
e61f8a9
feat (OutputView): 당첨 통계를 출력한다.
re4rk Feb 15, 2023
c5ef7e4
feat(Lotto): 로또 번호 오름차순 정렬 여부 검증 기능 구현
re4rk Feb 15, 2023
2a022d4
refactor(Application, LottoController): inputView, outputView 받아서 사용하…
hyemdooly Feb 16, 2023
a392419
refactor(NumberGenerator): interface 삭제
hyemdooly Feb 16, 2023
f2e3d74
refactor(RandomNumberGenerator): interface 삭제
hyemdooly Feb 16, 2023
98c2164
refactor(LottoFactory): interface 삭제
hyemdooly Feb 16, 2023
11f2323
refactor(Rank): 매직넘버 수정
hyemdooly Feb 16, 2023
265c964
refactor(LottoTest, OutputView): 정렬 예외 삭제
hyemdooly Feb 16, 2023
c60ce25
refactor(LottoResult): domain에서 소수점 둘째자리까지 내림 적용
hyemdooly Feb 16, 2023
dc0d48f
refactor(Rank): values를 활용하여 조건 변경
hyemdooly Feb 18, 2023
18bdfa8
refactor(OutputView): values()를 활용하여 출력
hyemdooly Feb 18, 2023
850729d
refactor(LottoResult): 가독성 수정
hyemdooly Feb 18, 2023
e6c5f67
refactor(LottoNumber): 팩토리 함수 구현하여 객체를 재사용하도록 수정
hyemdooly Feb 18, 2023
f7ad42f
refactor(Amount): amount 원시값 포장 적용
hyemdooly Feb 18, 2023
c33ff79
refactor(Rank): valueOf함수 일관적인 코드로 수정
hyemdooly Feb 18, 2023
6aae4b6
refactor(OutputView): 결과 출력 일관적인 코드로 수정
hyemdooly Feb 18, 2023
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
refactor(OutputView): values()를 활용하여 출력
  • Loading branch information
hyemdooly committed Feb 18, 2023
commit 18bdfa853263067434aaddce767f446acd5804cc
19 changes: 14 additions & 5 deletions src/main/kotlin/view/OutputView.kt
Original file line number Diff line number Diff line change
Expand Up @@ -26,11 +26,20 @@ class OutputView {
fun outputResult(lottoResult: LottoResult) {
println("\n당첨 통계")
println("---------")
println("3개 일치 (${Rank.FIFTH.winningMoney})원 - ${lottoResult[Rank.FIFTH]}개")
println("4개 일치 (${Rank.FOURTH.winningMoney})원 - ${lottoResult[Rank.FOURTH]}개")
println("5개 일치 (${Rank.THIRD.winningMoney})원 - ${lottoResult[Rank.THIRD]}개")
println("5개 일치, 보너스 볼 일치(${Rank.SECOND.winningMoney}원) - ${lottoResult[Rank.SECOND]}개")
println("6개 일치 (${Rank.FIRST.winningMoney})원 - ${lottoResult[Rank.FIRST]}개")
for (value in Rank.values().reversed()) {
if (value == Rank.MISS) continue
if (value == Rank.SECOND) {
println(
"%d개 일치, 보너스 볼 일치 (%s)원 - %d개".format(
value.countOfMatch,
value.winningMoney,
lottoResult[value],
),
)
continue
}
println("%d개 일치 (%s)원 - %d개".format(value.countOfMatch, value.winningMoney, lottoResult[value]))
}
println("총 수익률은 ${lottoResult.getRateOfReturn()}입니다.")
}
}