-
Notifications
You must be signed in to change notification settings - Fork 76
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
[로또 2단계] 시아 미션 제출합니다. #135
Open
Leeyerin0210
wants to merge
27
commits into
woowacourse:leeyerin0210
Choose a base branch
from
Leeyerin0210:step2
base: leeyerin0210
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.
+558
−464
Open
Changes from 1 commit
Commits
Show all changes
27 commits
Select commit
Hold shift + click to select a range
79bc0e4
refactor : Lotto의 가격 부분 삭제
Leeyerin0210 133dce9
refactor : 출력 로직 수정 , 로또 결과 산출 로직 수정
Leeyerin0210 02cb6d7
feat : 유저가 입력한 숫자의 로또를 수동으로 발행하는 기능 추가
Leeyerin0210 29794c2
fix : 수동과 자동 모든 로또가 출력되도록 변경
Leeyerin0210 d9ec1a0
refactor: 입력값 검증 방식 수정하여 반복 입력 가능하도록 변경
Leeyerin0210 66b2a02
refactor: 잘못된 입력값을 받았을 때 다시 입력 받도록 수정
Leeyerin0210 1907483
docs : 리드미 수정
Leeyerin0210 6a9e9d9
refactor : 뷰와 도메인이 너무 강하게 결합되지 않도록 수정
Leeyerin0210 4ed8d62
refactor : 로또 번호를 잘못 입력하면 바로 다시 입력 받도록 수정
Leeyerin0210 1db3c57
refactor : 출력 로직 일부 수정
Leeyerin0210 4485eac
refactor : sealed 클래스를 활용해서 오류 처리 일부 수정
Leeyerin0210 6dd8b3d
refactor : 오류 원인을 사용자가 파악할 수 있도록 출력 수정
Leeyerin0210 63bb963
feat : 로또 금액 단위의 금액을 입력하지 않으면 남는 돈을 출력하도록 추가
Leeyerin0210 e401cbd
fix : 테스트 함수 수정
Leeyerin0210 d07db8c
refactor: 기존 코드 구조를 폐기하고 새로운 설계를 시작
Leeyerin0210 422eaac
docs: 코드 작성 중 유의할 사항 기재
Leeyerin0210 0050e23
feat : 로또 넘버 객체 생성
Leeyerin0210 e7f5664
feat : 로또 객체 생성
Leeyerin0210 8eb1895
feat : amount 객체 생성
Leeyerin0210 8444009
feat : amount 객체 지불 함수 작성
Leeyerin0210 0fd886a
feat : rank 객채 및 winningLotto 객체 생성
Leeyerin0210 fece2a8
feat : 당첨금 계산 서비스 작성 및 파일 이동
Leeyerin0210 0220a90
feat : 로또를 자동으로 생성하는 로또 메이커 서비스 추가
Leeyerin0210 09eb61b
feat : 입출력 기능 추가
Leeyerin0210 19253ff
refactor : 생성 인터페이스 일관성 추가
Leeyerin0210 33d22ea
refactor : 비지니스 로직 분리 및 순회 횟수 감소
Leeyerin0210 00d4c70
refactor : 명확한 오류 원인 전달
Leeyerin0210 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -5,9 +5,14 @@ class Amount private constructor( | |
) { | ||
fun getCount(lottoPrize: Int): Int = money / lottoPrize | ||
|
||
fun paymentOrNull(payMoney: Int): Amount? { | ||
if (money < payMoney) return null | ||
return Amount(money - payMoney) | ||
} | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 금액은 음수일 수 없다는 것을 null로 하는게 자연스러운 흐름일까요? data class Amount(val money: Int) {
require(money >= 0)
fun pay(other: Amount): Amount {
val newMoney = (money - other.money).coerceAtLeast(0)
return copy(money = newMoney)
}
} 결과적으로 이 함수를 사용할 때 마다 null을 컨트롤 해야한다는게 매우 번거롭다고 느껴지니까요 |
||
|
||
companion object { | ||
fun createOrNull(input: Int): Amount? { | ||
if (input <= 0) return null | ||
if (input < 0) return null | ||
return Amount(input) | ||
} | ||
} | ||
|
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
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Amount를 유연하게 만들었다면, 더이상 "로또" 라는 관심사를 가질 필요가 있을까요?
이 클래스는 LottoAmount가 되어야 했을까요?