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

[Lee, Nathan] 로또 2단계 - 보너스 번호 추가 #41

Open
wants to merge 19 commits into
base: nathan29849
Choose a base branch
from
Open
Changes from 1 commit
Commits
Show all changes
19 commits
Select commit Hold shift + click to select a range
97da692
[step2] 시작
nathan29849 Feb 23, 2022
edf45b6
[step2] Enum 클래스 이름 변경(Rank) 및 switch문 Enum 클래스 내부로 이동
nathan29849 Feb 23, 2022
c59c7d5
[step2] makeAutoTicket(), makeManualTicket 분리해 수동 추첨 구현
street62 Feb 23, 2022
f438af0
[step2] 보너스 볼 기능 추가
nathan29849 Feb 23, 2022
cedce92
[step2] recactoring : 당첨 티켓과 현재 로또 티켓을 비교하는 기능을 TicketOffice에서 LottoT…
nathan29849 Feb 23, 2022
0a0f20d
[step2] 로또 자동/수동 입력 오류 수정
street62 Feb 23, 2022
2be4b31
[step2] TicketOffice 클래스 자동/수동 설정 리팩토링
street62 Feb 23, 2022
00a3220
[step2] TicketOffice.checkBonusNumber() -> LottoTicket.checkBonusNumb…
nathan29849 Feb 23, 2022
7162394
[step2] TicketOffice 클래스의 당첨 관련 기능을 LottoCompany 클래스로 분리
street62 Feb 24, 2022
ff671c5
[step2] User 클래스 추가
street62 Feb 24, 2022
2778b9a
[step2] LottoCompany 클래스를 통해 User에서 당첨 정보를 조회
nathan29849 Feb 24, 2022
a89c370
[step2] Rank 수정, 당첨 통계 Map key Integer -> Rank 수정
street62 Feb 24, 2022
6cc42b8
[step2] OutputView.showWinningResult 개선
nathan29849 Feb 24, 2022
8cc12ad
[step2] Rank 클래스 리팩토링 : checkBonus 메서드를 통해 indent를 줄임
nathan29849 Feb 24, 2022
68655b3
[step2] Rank 클래스에 FAIL 추가
nathan29849 Feb 24, 2022
c988010
[step3] 수동 티켓 개수 입력 받은 후 한꺼번에 생성하는 기능 구현
nathan29849 Feb 25, 2022
643fd1f
[step3] AutoTicketOffice, ManualTicketOffice 클래스 추가
street62 Feb 25, 2022
01591d8
[step3] User.goTicketOffice 메서드 구현
nathan29849 Feb 25, 2022
a2bed80
[step3] README 3단계 수동구매 기능 추가 관련 정보 기입
nathan29849 Feb 25, 2022
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
[step2] TicketOffice 클래스 자동/수동 설정 리팩토링
자동, 수동으로 나뉘어 있던 메서드를 TicketOffice.makeLottoTicket()으로 합침.
해당 메서드의 매개변수로 boolean isAuto를 넘겨서 자동/수동에 따른 로직 분기하도록 구현.
street62 committed Feb 23, 2022
commit 2be4b31c35d287ddf39891bcb60a4ad51e0c5066
Binary file modified .gradle/6.7/executionHistory/executionHistory.bin
Binary file not shown.
Binary file modified .gradle/6.7/executionHistory/executionHistory.lock
Binary file not shown.
Binary file modified .gradle/6.7/fileHashes/fileHashes.bin
Binary file not shown.
Binary file modified .gradle/6.7/fileHashes/fileHashes.lock
Binary file not shown.
Binary file modified .gradle/6.7/javaCompile/classAnalysis.bin
Binary file not shown.
Binary file modified .gradle/6.7/javaCompile/javaCompile.lock
Binary file not shown.
Binary file modified .gradle/buildOutputCleanup/buildOutputCleanup.lock
Binary file not shown.
8 changes: 4 additions & 4 deletions build/tmp/compileJava/source-classes-mapping.txt
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
Main.java
Main
view/InputView.java
view.InputView
domain/Rank.java
domain.Rank
view/OutputView.java
view.OutputView
domain/LottoTicket.java
domain.LottoTicket
view/InputView.java
view.InputView
Main.java
Main
domain/TicketOffice.java
domain.TicketOffice
21 changes: 5 additions & 16 deletions src/main/java/domain/TicketOffice.java
Original file line number Diff line number Diff line change
@@ -33,7 +33,9 @@ private void setLottoNumber() {
}
}

private LottoTicket makeAutoTicket() {
private LottoTicket makeLottoTicket(boolean isAuto) {
if (!isAuto)
return new LottoTicket(InputView.getManualNumber());
List<Integer> ticketNumber = new ArrayList<>();
Collections.shuffle(lottoNumber);
for (int i = 0; i < SELECTED_NUMBER; i++) {
@@ -43,28 +45,15 @@ private LottoTicket makeAutoTicket() {
return new LottoTicket(ticketNumber);
}

private LottoTicket makeManualTicket() {
List<Integer> ticketNumber = InputView.getManualNumber();
return new LottoTicket(ticketNumber);
}

public List<LottoTicket> issueTickets() {
int amount = InputView.getAmount();
int numberOfTickets = amount / PRICE;
int change = amount % PRICE;
TOTAL_PRICE = PRICE * numberOfTickets;
List<LottoTicket> tickets = new ArrayList<>();

boolean isAuto = InputView.askIsAuto();
if (isAuto) {
for (int i = 0; i < numberOfTickets; i++) {
tickets.add(makeAutoTicket());
}
} else {
for (int i = 0; i < numberOfTickets; i++) {
tickets.add(makeManualTicket());
}
}
for (int i = 0; i < numberOfTickets; i++)
tickets.add(makeLottoTicket(isAuto));
OutputView.completePurchase(numberOfTickets, change, tickets);
return tickets;
}