Open
Conversation
view의 함수를 이용해 구입 금액을 입력 받는 기능 연결
- 검증을 위한 유틸 함수 객체인 Validator 구현 - 0 이하일 경우, 1000단위가 아닐 경우 예외 처리 - readPurchaseAmount에서 받은 입력값 검증
- 각 랜덤한 번호로 생성하는 LottoMachine 클래스 구현 - 구입 금액을 바탕으로 발행할 로또 개수를 계산 - 발행된 로또 번호를 2차원 배열로 저장 후 반환
- 발행된 로또 인스턴스를 묶어 관리하는 LottoBundle 클래스 구현 - 개수 조회, 전체 조회, 순회 기능 추가 - 내부 로또 묶음 데이터를 #을 사용하여 보호
view를 활용해 lottoBundle을 요구사항에 맞게 출력
view의 함수를 이용해 당첨 번호 입력받는 기능 구현
Validator에서 당첨 번호를 검증하는 validateWinningNumbers() 구현 5개가 아닐 경우, 중복될 경우, 1~30 사이가 아닐 경우 예외 처리 사용자에게 받은 입력값 검증
view의 함수를 이용해 보너스 번호 입력받는 기능 구현
- Validator에서 보너스 번호를 검증하는 validateBonusNumber() 구현 - 1~30 사이가 아닐 경우 예외 처리 - 사용자에게 받은 입력값 검증
- 일치 개수와 보너스 여부를 기반으로 등수와 상금을 반환하는 getRank() 구현 - 숫자 값을 하드코딩 하지 않고, 의미있는 이름 사용
- 추가할 LottoJudge 클래스의 기능인 judge() 함수에 대한 테스트 케이스 추가
- LottoJudge에서 당첨 번호, 보너스 번호, 로또 번호를 기반으로 결과를 반환하는 judge() 메소드 구현 - 일치 개수와 보너스 여부에 따라 getRank() 결과 반환 - 테스트 통과 여부 확인
-getRank() 함수의 조건부를 문제 조건에 맞게 수정
각 로또별 등수 결과를 집계하여 변수(rankCounts)에 저장 등수별 상금과 당첨 개수를 곱해 총 상금 계산 결과 출력을 위한 getter 메서드 추가
- 결과를 비교하고 출력하는 기능 구현
- 로그용으로 출력한 console.log 제거 - 판단하는 함수에서 리턴값 제거 후 호출만 하도록 변경
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
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.
No description provided.