-
Notifications
You must be signed in to change notification settings - Fork 34
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
๐ [hanse & sally] ๋ก๋ 2๋จ๊ณ - ๋ณด๋์ค ๋ฒํธ ์ถ๊ฐ #45
Open
rkolx
wants to merge
15
commits into
codesquad-members-2022:sally-ksh
Choose a base branch
from
rkolx:step2
base: sally-ksh
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.
Open
Changes from all commits
Commits
Show all changes
15 commits
Select commit
Hold shift + click to select a range
f0573f7
feat : Input ํด๋์ค, Main ํด๋์ค
rkolx d069d61
refactor : ๋น์ฒจ๋ฒํธ ๋ชจ์ ํด๋์ค ๋ฐ ํด๋์ค ๋ช
์์
rkolx 8d41897
feat : ๋ณด๋์ค ๋ฒํธ ์ถ๊ฐ
rkolx d69a5ee
refactor: ๋ก๋ ๊ฒฐ๊ณผ ๋ก์ง ๋ฆฌํฉํ ๋ง
sally-ksh 141f826
refactor: ๋ณด๋์ค๋ณผ ์ถ๊ฐ ์ฌํญ ์ถ์ํ
sally-ksh 696896e
refactor: LottoPlay ๋น์ฆ๋์ค ๋ก์ง ๋ถ๋ฆฌ
sally-ksh ec5169b
feat: ํจํค์ง ๋ถ๋ฆฌ
sally-ksh d7ca355
refactor: ๋ณด๋์ค๋ณผ ์์์ผ๋ก ๋ณ๊ฒฝ
sally-ksh 72bc927
fix
sally-ksh b9df53d
refactor : ๋ก๋ ๋ด๋ ๋ฉ์๋ ์ญํ ์ ๋ฐ๋ผ ๋ถ๋ฆฌ
rkolx 7ac4a2b
docs : 2๋จ๊ณ ์๊ตฌ์ฌํญ์ ๋ง๊ฒ RADME.md ์์
rkolx ee3deaa
refacfor : gettotalLottos ๋ฉ์๋ ๋ถ๋ฆฌ
rkolx 79bfcec
refactor : ๋์ ํด๋์ค๋ช
์์
rkolx 73388b2
refactor: ๋ฆฌ๋ทฐ ๋ฐ์
sally-ksh 8271d2d
Merge pull request #1 from sally-ksh/sally-step2
sally-ksh 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,28 +1,32 @@ | ||
# java-lotto | ||
๋ง์คํฐ์ฆ ๋ฉค๋ฒ์ค 2022 ๋ก๋ ๊ฒ์ ํ๋ก์ ํธ | ||
|
||
|
||
- โ๏ธ from reviewer | ||
- countNumberOfWinnings() for๋ฌธ ๋์ stream์ผ๋ก ๊ฐ์ | ||
- boolean ํจ์ํ ๋ฐํ ์ด์ฉํ ๊ฒฐ๊ณผ ๋ฆฌํด์ ๋ถํ์ํ ์กฐ๊ฑด๋ฌธ์ ์ฐ์ง ์๊ธฐ | ||
- ํจํค์ง๋ช ์ ๋ณต์ํ์ ์ ์ฐ์ง ์์ต๋๋ค. | ||
- Lotto ๊ฐ์ฒด๊ฐ ์ง์ Ranking ๊ฒฐ๊ณผ๊ฐ์ ์ฃผ๋ ๋ฐฉ์์ผ๋ก ๊ฐ์ ํด์ผ ํ์ง ์์๊น์? | ||
- ๋น์ฒจ๋ฒํธ ๋ฆฌ์คํธ๋ฅผ ๋ณด๊ดํ ๋งํ ๊ฐ์ฒด๋ฅผ ์ค๊ณํด์ ๊ทธ ๊ฐ์ฒด์ ๋ฆฌ์คํธ๋ก ์ ๋ฌํด์ฃผ๋ฉด ๋ ์ข์ํ ๋ฐ์? | ||
- java.util.ArrayList ์๋ง ์กด์ฌํ๋ ๋ฉ์๋๋ ๋ก์ง์ ์ ํ๋ฆฌ์ผ์ด์ ์ด ๊ฐ๊ฒฐํฉ๋์ด์ผ ํ ํน๋ณํ ์ด์ ๊ฐ ์์๊น์? | ||
๊ทธ๋ ์ง ์๋ค๋ฉด ํญ์ List<T> ๋ฅผ ์ฌ์ฉํ๋ ๊ฒ์ด ์ข์ต๋๋ค. | ||
- [link](https://stackoverflow.com/questions/9852831/polymorphism-why-use-list-list-new-arraylist-instead-of-arraylist-list-n) | ||
|
||
<details> | ||
<summary>๐ฑ step2. ์๋ฐ ๋ก๋ 2๋จ๊ณ - ๋ณด๋์ค ๋ฒํธ ์ถ๊ฐ</summary> | ||
- pair programming (hanse, sally) | ||
|
||
#### ๊ธฐ๋ฅ์๊ตฌ์ฌํญ | ||
|
||
- [x] ๋ก๋ ๊ตฌ์ ๊ธ์ก์ ์ ๋ ฅํ๋ฉด ๊ตฌ์ ๊ธ์ก์ ํด๋นํ๋ ๋ก๋๋ฅผ ๋ฐ๊ธํด์ผ ํ๋ค. | ||
- [x] ๋ก๋ 1์ฅ์ ๊ฐ๊ฒฉ์ 1000์์ด๋ค. | ||
- [x] ๋น์ฒจ ๋ฒํธ๋ฅผ ์ ๋ ฅ๋ฐ์์ ์์ต๋ฅ ์ ์ถ๋ ฅํ๋ค. | ||
- [x] ๊ธฐ๋ ์์ต์ ๋์ ์์๋ฅผ ์ฐธ๊ณ ํ์. | ||
- [x] 2๋ฑ์ ์ํด ์ถ๊ฐ ๋ฒํธ๋ฅผ ํ๋ ๋ ์ถ์ฒจํ๋ค. ๋น์ฒจ ํต๊ณ์ 2๋ฑ๋ ์ถ๊ฐํด์ผ ํ๋ค. | ||
|
||
|
||
|
||
#### ํ๋ก๊ทธ๋๋ฐ ์๊ตฌ์ฌํญ | ||
|
||
- [x] indent(์ธ๋ดํธ, ๋ค์ฌ์ฐ๊ธฐ) depth๋ฅผ 1๋จ๊ณ๋ก ๊ตฌํํ๋ค. | ||
- [x] depth์ ๊ฒฝ์ฐ if๋ฌธ์ ์ฌ์ฉํ๋ ๊ฒฝ์ฐ 1๋จ๊ณ์ depth๊ฐ ์ฆ๊ฐํ๋ค. if๋ฌธ ์์ while๋ฌธ์ ์ฌ์ฉํ๋ค๋ฉด depth๊ฐ 2๋จ๊ณ๊ฐ ๋๋ค. | ||
- [x] else๋ฅผ ์ฌ์ฉํ์ง ๋ง๋ผ. | ||
- [x] ๋ฉ์๋์ ํฌ๊ธฐ๊ฐ ์ต๋ 10๋ผ์ธ์ ๋์ง ์๋๋ก ๊ตฌํํ๋ค. | ||
- [x] method๊ฐ ํ ๊ฐ์ง ์ผ๋ง ํ๋๋ก ์ต๋ํ ์๊ฒ ๋ง๋ค์ด๋ผ. | ||
- [x] ArrayList๋ฅผ ์ฌ์ฉํด์ ๊ตฌํํ๋ค. | ||
|
||
- [x] enum์ ์ ์ฉํด ํ๋ก๊ทธ๋๋ฐ์ ๊ตฌํํ๋ค. | ||
|
||
#### ์ถ๋ ฅ ๊ฒฐ๊ณผ | ||
|
||
<img src="https://user-images.githubusercontent.com/92699009/155276313-d1260c5c-de96-4875-9a05-bf43b59c10b9.png"> | ||
<img src="https://user-images.githubusercontent.com/92699009/155632776-f8de735e-2021-4985-8104-3e79c7f7317c.PNG"> | ||
|
||
</details> |
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,29 @@ | ||
import static view.Input.*; | ||
import static view.Output.*; | ||
|
||
import java.util.List; | ||
|
||
import domains.user.LottoMachine; | ||
import domains.user.Lottos; | ||
import domains.user.Tickets; | ||
import domains.winning.Ranking; | ||
import domains.user.UserLotto; | ||
import view.PurchasedLotto; | ||
|
||
public class LottoApplication { | ||
private static LottoMachine lottoMachine = new LottoMachine(); | ||
private static Lottos lottos = new Lottos(); | ||
private static UserLotto userLotto = new UserLotto(lottoMachine, lottos); | ||
|
||
public static void main(String[] args) { | ||
PurchasedLotto purchasedLotto = purchaseLotto(); | ||
|
||
Tickets totalLottos = userLotto.getTickets(purchasedLotto); | ||
showLottos(totalLottos); | ||
|
||
Ranking ranking = userLotto.getRankingFromWinningNumbers(inputWinningNumbers(), getBonusNumber()); | ||
getResultOfLotto(ranking, purchasedLotto.getPurchaseAmount()); | ||
|
||
scanClose(); | ||
} | ||
} |
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
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,53 @@ | ||
package domains.user; | ||
|
||
import java.util.Collections; | ||
import java.util.List; | ||
import java.util.Objects; | ||
|
||
import domains.winning.BonusWinningNumbers; | ||
import domains.winning.Ranking; | ||
|
||
public class Lotto { | ||
public static final int MINIMUM_NUMBER_OF_WINNING = 3; | ||
public static final String ERROR_OF_LOTTO_PARAMS = "error of lotto params"; | ||
private final List<Integer> sixNumbers; | ||
|
||
public Lotto(List<Integer> sixNumbers) { | ||
if (Objects.isNull(sixNumbers)) { | ||
throw new IllegalArgumentException(ERROR_OF_LOTTO_PARAMS); | ||
} | ||
if (sixNumbers.size() < 6) { | ||
throw new IllegalArgumentException(ERROR_OF_LOTTO_PARAMS); | ||
} | ||
Collections.sort(sixNumbers); | ||
this.sixNumbers = sixNumbers; | ||
} | ||
|
||
public void recordRanking(BonusWinningNumbers winningNumbers, Ranking ranking){ | ||
boolean checkedBonus = false; | ||
List<Integer> winning = winningNumbers.getNumbers(); | ||
int winningCount = countWinningNumber(winning); | ||
|
||
if (winningCount >= MINIMUM_NUMBER_OF_WINNING) { | ||
checkedBonus = this.getBonus(winningNumbers.getBonus()); | ||
} | ||
ranking.record(checkedBonus, winningCount); | ||
} | ||
|
||
private int countWinningNumber(List<Integer> winning) { | ||
return Math.toIntExact(winning.stream() | ||
.filter(winningNumber -> this.sixNumbers.contains(winningNumber)) | ||
.count()); | ||
} | ||
|
||
private int getCount(int count, Integer winningNumber) { | ||
if (sixNumbers.contains(winningNumber)) { | ||
count++; | ||
} | ||
return count; | ||
} | ||
|
||
public boolean getBonus(int bonusNumber) { | ||
return sixNumbers.contains(bonusNumber); | ||
} | ||
} |
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.
์ด ๋ถ๋ถ์ ์ด๋ป๊ฒ ๊ฐ์ ํ๋ฉด ์ข์์ง 3๋จ๊ณ์์ ๊ณ ๋ฏผํด์ฃผ์ธ์~
ํํธ:
LottoGame
๋ถ๋ฆฌ, ์์กด์ฑ ์ฃผ์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.
์ผ-์.... ์ด๋ ต์ง๋ง, ์ ๊ฒ๋ ๊ฐ๊ณ ... @_@๊ณ ๋ฏผ ํด์ ๊ฐ์ ๋๋๋ก ๋ ธ๋ ฅํ๊ฒ ์ต๋๋ค.
3๋จ๊ณ ์งํํ๋ฉด์ ์คํ ,์๋๋ง di๋ก ํ๋๋ฐ๋, ๋ณด์ง ๋ชปํ ๋ถ๋ถ์ด ์๋ ๊ฑฐ ๊ฐ์์.
์๋ ค์ฃผ์ ์ ๊ฐ์ฌํฉ๋๋ค.๐ฅ