-
Notifications
You must be signed in to change notification settings - Fork 3
[로또] 박현규 미션 제출합니다. #1
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
base: main
Are you sure you want to change the base?
[로또] 박현규 미션 제출합니다. #1
Conversation
예외를 잡아 줄 Lotto.js와 LottoTest.js 코드 임시 작성
입출력 구현으로 가격 구매 및 예외 처리 구현
Random을 활용한 로또 생성 구현
당첨 번호와 보너스 번호 입력기능 구현
object를 활용한 수익률 계산 구현
수익률을 계산해주는 PrizeCheck 클래스를 분리
중복되는 함수를 하나로 합침
Console.print(`5개 일치 (1,500,000원) - ${result['5개 일치']}개`); | ||
Console.print(`5개 일치, 보너스 볼 일치 (30,000,000원) - ${result['5개 일치 (보너스 볼 일치)']}개`); | ||
Console.print(`6개 일치 (2,000,000,000원) - ${result['6개 일치']}개`); | ||
} | ||
} |
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.
App.js 부분에서 사용자 UI 부분만 깔끔하게 정리해서 작성하면 좀 더 코드 분리가 잘 될 것 같습니다! 예외처리문 까지 App에 넣을 필요는 없을 것 같아요!
lottos.forEach(lotto => Console.print(`[${lotto.getNumbers().join(", ")}]`)); | ||
} | ||
|
||
printResultsAndRevenueRate(purchaseAmount, lottos, winningNumbers, bonusNumber) { |
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.
여기 아래 부분부터는 PrizeChecker 클래스가 아니라 왜 App 클래스에 구현하신 건지 궁금합니다! 개인적으로 수익률 계산하는 곳에 묶어 놓았으면 더 보기 좋지 않을까 싶어서
신경써서 구현한 부분
코드 분리를 시도해보았습니다.
수익률을 계산하는 PrizeChecker.js를 새로 만들었습니다
피드백이 필요한 부분
사용해야 할 변수와 메서드가 많아지다보니 이름 짓는게 어려웠습니다.
제가 봐도 헷갈리는 부분이 많더라구요,,
그리고 필요한 함수를 하나하나 찾아가며 끼워맞추다보니 쾌적한 느낌이 들지는 않는 것 같습니다
내가 고려한 예외