-
Notifications
You must be signed in to change notification settings - Fork 191
[로또] 정윤석 미션 제출합니다. #162
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
Open
yundol777
wants to merge
18
commits into
woowacourse-precourse:main
Choose a base branch
from
yundol777:yundol777
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
[로또] 정윤석 미션 제출합니다. #162
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
- InputView에서 사용자로부터 구입 금액을 입력받는 기능 추가
- 검증을 위한 유틸 함수 객체인 Validator 구현 - 숫자가 아닐 경우, 0 이하일 경우, 1000단위가 아닐 경우 예외 처리 - readPurchaseAmount에서 받은 입력값 검증 - README 반영
- 구입 금액을 바탕으로 발행할 로또 개수를 계산 - 각 로또 인스턴스를 랜덤한 번호로 생성하는 LottoMachine 클래스 구현 - 발행된 로또 인스턴스를 LottoBundle에 저장하여 반환
- 중복된 기능 목록 제거 후 새로운 클래스 연결 내용으로 수정 -(4) 저장 및 조회 가능한 LottoBundle 클래스 생성
- 발행된 로또 인스턴스를 묶어 관리하는 LottoBundle 클래스 구현 - 개수 조회, 전체 조회, 순회 기능 추가 - 내부 로또 묶음 데이터를 #을 사용하여 보호
- OutputView에 lottoBundle을 출력하는 printLottoBundle 메서드 구현 - 로또 개수 및 각 로또 번호 출력 - Lotto 클래스에 번호를 반환하는 getNumbers 메서드 추가
- InputView에서 당첨 번호 입력 받는 readWinningNumbers() 구현
- Validator에서 당첨 번호를 검증하는 validateWinningNumbers() 구현 - 6개가 아닐 경우, 중복될 경우, 숫자가 아닐 경우, 1~45 사이가 아닐 경우 예외 처리 - readWinningNumbers에서 받은 입력값 검증 - README 예외 내용 추가
InputView에서 보너스 번호 입력 받는 readBonusNumber() 구현
- Validator에서 보너스 번호를 검증하는 validateBonusNumber() 구현 - 숫자가 아닐 경우, 1~45 사이가 아닐 경우 예외 처리 - readBonusNumber에서 받은 입력값 검증 - README 예외 내용 추가
- 일치 개수와 보너스 여부를 기반으로 등수와 상금을 반환하는 getRank() 구현 - 숫자 값을 하드코딩 하지 않고, 의미있는 이름 사용
- LottoJudge에서 당첨 번호, 보너스 번호, 로또 번호를 기반으로 결과를 반환하는 judge() 메소드 구현 - 일치 개수와 보너스 여부에 따라 getRank() 결과 반환
- 각 로또별 등수 결과를 집계하여 변수(rankCounts)에 저장 - 등수별 상금과 당첨 개수를 곱해 총 상금 계산 - 총 상금을 구입 금액으로 나누어 수익률 계산 - 결과 출력을 위한 getter 메서드 추가
- OutputView에서 결과를 통합한 내용을 출력하는 printResult() 구현 - OutputView에서 수익률을 출력하는 printProfitRate() 구현
- 생성한 로또 번호 출력 과정에서 배열 반환이 아닌 배열 형태의 문자열을 반환하도록 수정 - Lotto 클래스의 파일 구조를 변경하는 과정에서 테스트 코드의 경로를 수정 - Lotto 단일 테스트를 통과하기 위해 클래스에서 예외 처리 추가 - 예외처리 시 단순히 Error만 던지는 것이 아닌 try-catch를 추가하여 Console 출력 추가
- 기능 목록에서 테스트가 필요한 기능들에 대한 테스트 코드를 구현 - 설정한 예외 내에서 테스트를 통과하는지 확인
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
기능 목록
(0) 기본 구조 세팅
(1) 로또 구입 금액 입력 기능 구현
(2) 구입 금액 검증 로직 구현
(3) 로또 발행 기능 구현
(4) 저장 및 조회 가능한 LottoBundle 클래스 생성
(5) 발행된 로또 번호 출력 기능 구현
(6) 당첨 번호 입력 기능 구현
(7) 당첨 번호 검증 로직 구현
(8) 보너스 번호 입력 기능 구현
(9) 보너스 번호 검증 기능 구현
(10) 규칙 및 상금 정의
(11) 당첨 결과 계산 기능 구현
(12) 결과 구현(결과 집계 및 수익률 계산)
(13) 결과 출력
(14) 통합 테스트 확인
(15) 단일 테스트 추가 및 확인