[java-lotto] yohan.kim(김요한) 과제 제출합니다.#2
Open
yohanii wants to merge 25 commits intoJapring-Study:yohan/java-lottofrom
Open
[java-lotto] yohan.kim(김요한) 과제 제출합니다.#2yohanii wants to merge 25 commits intoJapring-Study:yohan/java-lottofrom
yohanii wants to merge 25 commits intoJapring-Study:yohan/java-lottofrom
Conversation
alreadysons
reviewed
Oct 1, 2024
| @@ -11,10 +14,59 @@ public Lotto(List<Integer> numbers) { | |||
| } | |||
|
|
|||
| private void validate(List<Integer> numbers) { | |||
There was a problem hiding this comment.
Lotto 내부에서 예외처리를 선언하다보니 코드가 지저분해지는것 같습니다! 클래스를 따로 만들어 예외처리를 하는 방법은 별로인가요??
| } | ||
|
|
||
| // 아래에 추가 테스트 작성 가능 | ||
| @DisplayName("6개 일치하면, 1을 반환한다.") |
msung99
reviewed
Oct 1, 2024
Comment on lines
+15
to
+27
| int purchaseCount = seller.calculateLottoCount(seller.parsePurchaseMoneyStr(purchaseMoneyStr)); | ||
|
|
||
| List<Lotto> lottos = seller.getLottos(purchaseCount); | ||
| UI.printBoughtLottos(lottos); | ||
|
|
||
| List<Integer> answers = UI.receiveAnswers(); | ||
| int bonus = UI.receiveBonus(); | ||
|
|
||
| List<Integer> result = seller.getResult(lottos, answers, bonus); | ||
| UI.printResult(result); | ||
| UI.printRate(seller.calculateRate(result, purchaseCount)); | ||
| } catch (IllegalArgumentException e) { | ||
| UI.handlingIllegalArgumentException(e); |
There was a problem hiding this comment.
MVC 패턴에 따라 설게구조를 변경해도 좋을 듯 합니다! 이 부분을 컨트롤러로 분리해도 좋을 것 같아요!
Comment on lines
+49
to
+66
| private static int getBonusCorrect(int bonus, Set<Integer> set, int correct) { | ||
| if (set.contains(bonus) && correct == 5) { | ||
| return 1; | ||
| } | ||
| return 0; | ||
| } | ||
|
|
||
| // TODO: 추가 기능 구현 | ||
| private int rankByCondition(int correct, int bonusCorrect) { | ||
| if (correct == 6) { | ||
| return 1; | ||
| } | ||
|
|
||
| if (correct + bonusCorrect <= 2) { | ||
| return 6; | ||
| } | ||
|
|
||
| return 8 - (correct + bonusCorrect); | ||
| } |
There was a problem hiding this comment.
아까 피드백 드렸듯이, 매직 넘버를 상수로 치환하는 것이 좋습니다. 더 의미있는 상수로 치환해주세요!
Comment on lines
+69
to
72
| public String toString() { | ||
| return numbers.toString(); | ||
| } | ||
| } |
There was a problem hiding this comment.
객체를 더 객체답게 사용하려면 toString() 더 의미있는 내용을 리턴할 수 있도록 할 수 있을 것 같아요. 단순히 getter 와 비슷하게 데이터를 리턴하는게 아니라, 객체의 상태를 표현할 수 있는 더 의미있는 정보를 리턴해도 좋을 것 같습니다!
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.
[java-lotto] yohan.kim(김요한) 과제 제출합니다.