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

[로또 미션] 신예린 미션 제출합니다. #19

Open
wants to merge 32 commits into
base: nyeroni
Choose a base branch
from

Conversation

nyeroni
Copy link

@nyeroni nyeroni commented May 6, 2024

"모든 원시 값과 문자열을 포장한다" 이 부분을 정확히 이해하지 못해서, 그 부분은 감안해서 리뷰해주시면 될 것 같습니다!
test 코드 때문에 메서드를 public으로 설정한 경우가 많은데 ,,, 다른 방법이 있다면 리뷰 남겨주세요!

FOURTH(4, 50000, "4개 일치 (50000원)- "),
THIRD(5, 150000, "5개 일치 (1500000원)- "),
SECOND(5, 30000000, "5개 일치, 보너스 볼 일치(30000000원)- "),
FIRTH(6, 2000000000, "6개 일치 (2000000000원)- ");
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

enum 활용을 잘 하신 것 같습니다! 같은 의미인 것 끼리 모아서 메시지를 구성할때에도 편리할 것 같아요
메시지까지 묶을 생각은 못했었는데 배워갑니다

if(priceNum % LOTTO_UNIT != 0){
throw new IllegalArgumentException("[ERROR] 구입 금액은 1000원 단위로 입력되어야 합니다.");
}
}
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

좋은 예외처리 같습니다!

return arr;
}
public double calculateRate(int arr[], int price){
int total = arr[0] * 5000 + arr[1] * 50000 + arr[2] * 1500000 + arr[3] * 2000000000;
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

정의해두신 enum을 활용할 수 있지 않을까요?

lottoNums = new ArrayList<>();
for (int i = 0; i < CNT_LOTTO_NUMBER; i++) {
int uniqueNumber = numbers.get(i);
while (lottoNums.contains(uniqueNumber)) {
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

궁금한점이 있습니다. numbers에는 이미 유니크한 숫자들이 shuffle되어있는 것 아닌가요? 이미 중복되지 않는 것은 보장된 것 같은데 한번 더 중복을 체크하시는 이유가 궁금합니다.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants