-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* docs: <3단계> 기능 요구 사항 정리 * feat: <3단계> 로또 2등 당첨 확인 - 보너스 번호 추가 - 로또 2등 당첨 여부 확인 * feat: <3단계> 피드백 반영 - 상수 제거 - HashMap 메서드 활용 * refactor: <3단계> lottoTicket 검증 주체 변경 - 클라이언트 로또 티켓이 당첨 번호와 보너스 번호로 비교 검증 진행 --------- Co-authored-by: HAE\1161893 <[email protected]>
- Loading branch information
1 parent
bfa706d
commit 06308c1
Showing
11 changed files
with
109 additions
and
75 deletions.
There are no files selected for viewing
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file was deleted.
Oops, something went wrong.
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
package step2.domain; | ||
|
||
import java.security.InvalidParameterException; | ||
import java.util.Arrays; | ||
|
||
public enum Rank { | ||
MISS(0, 0, "0개 일치 (0)"), | ||
FIFTH(3, 5_000, "3개 일치 (5000)"), | ||
FOURTH(4, 50_000, "4개 일치 (50000)"), | ||
THIRD(5, 1_500_000, "5개 일치 (1500000)"), | ||
SECOND(5, 30_000_000, "5개 일치, 보너스 볼 일치(30000000원)"), | ||
FIRST(6, 2_000_000_000, "6개 일치 (2000000000)"); | ||
|
||
private static final int THIRD_COUNT = 5; | ||
|
||
private int matchCount; | ||
private long prizeMoney; | ||
|
||
private String message; | ||
|
||
Rank(int matchCount, long rank, String message) { | ||
this.matchCount = matchCount; | ||
this.prizeMoney = rank; | ||
this.message = message; | ||
} | ||
|
||
public static Rank toPrizeMoney(int matchCount) { | ||
if (matchCount == THIRD_COUNT) { | ||
return Rank.THIRD; | ||
} | ||
|
||
return Arrays.stream(values()) | ||
.filter(prizeMoney -> prizeMoney.matchCount == matchCount) | ||
.findAny() | ||
.orElse(Rank.MISS); | ||
} | ||
|
||
public int matchCount() { | ||
return this.matchCount; | ||
} | ||
|
||
public long prizeMoney() { | ||
return this.prizeMoney; | ||
} | ||
|
||
public String message() { | ||
return this.message; | ||
} | ||
} |
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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