-
Notifications
You must be signed in to change notification settings - Fork 330
[2단계 - 로또 구현] 포츈(정윤성) 미션 제출합니다. #312
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
Merged
Merged
Changes from all commits
Commits
Show all changes
32 commits
Select commit
Hold shift + click to select a range
e6e39bb
add step1 code
javajigi 6a50db6
add Lotto, WinningLotto
javajigi ed49fab
fix(Rank) : 4등 이하에서 보너스 번호로 인해, 당첨결과를 못뽑는 로직에러 수정
unluckyjung fcb6154
refactor : unmodifiable을 방어적 복사로 수정
unluckyjung 908f436
docs(기능목록) : 기능목록 작성
unluckyjung 16ba132
refactor : 로또 티켓을 인터페이스로한 수동티켓, 자동 티켓 분할
unluckyjung da1d0b8
test(LottoTicketTest) : 로또 티켓의 타입이 맞는지 확인하는 기능
unluckyjung fb9813f
feat : 로또 티켓 뭉치에서 수동티켓과 자동티켓의 개수를 세는 기능
unluckyjung fda4f66
refactor(LottoNumbers) : 로또 넘버를 정렬하는 기능
unluckyjung f34bd1a
feat(LottoManualTicketCount) : 구매하려는 수동 티켓의 개수를 확인하는 기능 구현
unluckyjung f16fefa
feat(LottoGameUtils) : 문자열로 받은 로또 번호들을 split해서 리턴해주는 유틸기능 구현
unluckyjung ad7ca4d
feat(LottoTicketMachine) : 로또 티켓을 수동으로 구매하는 기능 추가
unluckyjung d1ec4c8
feat(LottoTickets) : 로또 티켓을 이어 붙이는 기능 구현
unluckyjung b313cd9
refactor(LottoManualTicketCount) : coun가 스스로 남아있는지 확인하게 수정
unluckyjung aa08243
refactor(LottoGame) : 도메인에 맞춰 컨트롤러 수정
unluckyjung 44364aa
refactor(view) : view 수정 및 구현
unluckyjung a6f9a84
Merge remote-tracking branch 'origin/step2' into step2
unluckyjung cd6d368
refactor(LottoNumber) : 로또 넘버들을 캐싱해놓고, 로또 넘버를 던져주기
unluckyjung 326f964
refactor : 로또 번호 생성방식 변경으로 인한 수정
unluckyjung a544799
refactor(LottoGameController) : 결과 화면에 맞춰서 공백 출력
unluckyjung 275b54a
docs(기능목록) : 구현한 기능목록 정리
unluckyjung d461d8e
fix : 머지될때 추가된 포비의 코드들 삭제
unluckyjung ade76bb
fix : 머지될때 추가된 포비의 코드들 삭제
unluckyjung d084da2
refactor : LottoGameUtil의 기능을 LottoNumbers로 이관
unluckyjung 586f7f1
refactor : 사용되지 않는 메소드 삭제
unluckyjung 1d6867e
refactor : 타입을 나누었던 로또 티켓을 다시 한개의 로또 티켓으로 수정
unluckyjung ed12c8a
refactor : view 에서 로또 번호 리스트를 받아오게 수정
unluckyjung 3ee8b13
refactor : 자바 컨벤션 적용
unluckyjung 397aa44
refactor : 사용되지 않는 메소드 삭제
unluckyjung 1d1aa7e
refactor(InputView) : 요구사항에 맞춰서 결과 입, 출력
unluckyjung 542cb5a
Merge remote-tracking branch 'origin/step2' into step2
unluckyjung c4e7e22
refactor(LottoTicket) : 상수로 수정
unluckyjung 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 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
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
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
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
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
13 changes: 11 additions & 2 deletions
13
src/main/java/lottogame/domain/machine/LottoTicketMachine.java
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,20 +1,29 @@ | ||
package lottogame.domain.machine; | ||
|
||
import lottogame.domain.Money; | ||
import lottogame.domain.number.LottoNumbers; | ||
import lottogame.domain.ticket.LottoTicket; | ||
import lottogame.domain.ticket.LottoTickets; | ||
|
||
public class LottoTicketMachine { | ||
|
||
public static final int TICKET_PRICE = 1000; | ||
|
||
public LottoTickets buyTickets(final Money money) { | ||
public LottoTickets buyAutoTickets(final Money money) { | ||
LottoTickets lottoTickets = new LottoTickets(); | ||
|
||
while (money.isCanBuy(TICKET_PRICE)) { | ||
lottoTickets.add(new LottoTicket()); | ||
lottoTickets.add(LottoTicket.of()); | ||
money.use(TICKET_PRICE); | ||
} | ||
return lottoTickets; | ||
} | ||
|
||
public LottoTicket buyManualTicket(final Money money, final String selectedLottoNumbers) { | ||
if (!money.isCanBuy(TICKET_PRICE)) { | ||
throw new IllegalArgumentException("남은 금액이 모자릅니다."); | ||
} | ||
money.use(TICKET_PRICE); | ||
return LottoTicket.of(new LottoNumbers(selectedLottoNumbers)); | ||
} | ||
} |
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
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
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
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
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
Oops, something went wrong.
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.
기존 util 에 있던 문자열을 잘라내면서 lottoNumber로 만드는 작업을 LottoNumbers로 이관시켜줬어요.
이전에는 중복되는 기능이니까 유틸로 빼야지 ~ 하고 넘겼었는데, 다음부터는 이 책임을 적절히 수행할 수 있는 다른 객체가 있는지 한번더 찾아볼것 같아요.