-
Notifications
You must be signed in to change notification settings - Fork 1.1k
π 4λ¨κ³ - λ‘λ(μλ) #4212
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
base: chanani
Are you sure you want to change the base?
Conversation
javajigi
left a comment
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λ¨κ³κΉμ§ κ°μ²΄ μ€κ³λ₯Ό μν λλμ΄ λλ€μ. π―
κ·Έλ λ€ λ³΄λ 4λ¨κ³ μꡬμ¬νμ μΆκ°ν λ μν₯μ λ°λ κ°μ²΄μ μκ° μ΅μνμΌλ‘ ꡬν κ°λ₯νλ κ² κ°μμ.
λ°λ‘ λ¨Έμ§νλ €λ€ λ§μ§λ§ λ¨κ³μΈ λ§νΌ μ½κ°μ μμ¬μμ΄ λ¨μ 보μ΄λ λΆλΆμ λν΄ νΌλλ°± λ¨κ²¨λ΄€μ΄μ.
| import java.util.List; | ||
| import java.util.Objects; | ||
|
|
||
| public class BuyLotto { |
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.
BuyLottoλΌλ μ΄λ¦μ΄ μ¬μ©μκ° κ΅¬λ§€ν Lottoλ‘ μ§μ μ΄λ¦μΌλ‘ 보μ¬μ§
μ΄μ AIμκ² λ¬Όμ΄λ³΄λ λ€μκ³Ό κ°μ λ΅λ³μ μ€
μμΌλ‘ μ΄λ¦μ μ§μ λ μμ¬μμ΄ λ¨λλ€λ©΄ AIλ₯Ό νμ©ν΄ 보면 μ΄λ¨κΉ?
νμ¬ BuyLottoλΌλ μ΄λ¦μ κ°μ²΄μ μ± μμ λͺ νν λνλ΄μ§ λͺ»νκ³ μμ΅λλ€. κ°μ²΄ μ΄λ¦μ **무μ(What)**μ μΊ‘μννκ³ κ΄λ¦¬νλμ§λ₯Ό λͺ λ£νκ² λ³΄μ¬μ€μΌ ν©λλ€.
νμ¬ ν΄λμ€λ μ¬μ©μκ° κ΅¬λ§€ν λ‘λ λ²νΈ λͺ©λ‘μ μΊ‘μννκ³ , μ΄ λͺ©λ‘μ λν **μΌλ ¨μ λΉμ¦λμ€ λ‘μ§(λΉμ²¨ μ¬λΆ νμΈ)**μ μννλ μΌκΈ 컬λ μ μ μν μ νκ³ μμ΅λλ€.
λ°λΌμ λ€μκ³Ό κ°μ μ΄λ¦λ€μ μΆμ²ν©λλ€.
π₯ κ°μ₯ μΆμ²νλ μ΄λ¦: PurchasedLottos
μ€λͺ
: μ΄ μ΄λ¦μ μ΄ κ°μ²΄κ° ꡬ맀λ(Purchased) λ‘λ(Lottos)λ€μ 컬λ μ
μμ λͺ
ννκ² μ λ¬ν©λλ€. μ΄λ κ°μ²΄μ μνμ λ³Έμ§μ κ°μ₯ μ λνλ
λλ€.
μ₯μ :
**νμ(Buy)**κ° μλ **λ³Έμ§(Purchased Lottos)**μ λνλ λλ€.
Listλ₯Ό μΊ‘μνν μΌκΈ 컬λ μ μμ μμν©λλ€.
λ©μλ(getLottos(), match())μμ μ°κ΄μ±λ μμ°μ€λ½μ΅λλ€.
π₯ μ’μ λμ: LottoTickets
μ€λͺ
: λ‘λ ν°μΌλ€μ΄λΌλ μλ―Έλ‘, μ¬μ©μκ° μμ ν λ‘λ λ²νΈ μΈνΈλ€μ λ¬Άμμ λνλ΄λ μ§κ΄μ μΈ μ΄λ¦μ
λλ€.
μ₯μ : λλ©μΈ μ©μ΄λ‘μ λ§€μ° ννκ² μ¬μ©λλ©° κ°κ²°ν©λλ€.
π₯ λλ©μΈ νΉν: CustomerLottos
μ€λͺ
: μ΄ κ°μ²΄κ° **μ¬μ©μ(ꡬ맀μ)**κ° μμ ν λ‘λ λͺ©λ‘μ΄λΌλ μ μ κ°μ‘°νκ³ μΆμ λ μ ν©ν©λλ€.
μ₯μ : μμ€ν μμ μ΄ λͺ©λ‘μ΄ λꡬμκ² μνλμ§ λͺ νν ν λ μ μ©ν©λλ€.
π‘ μ BuyLottoλ μμ¬μ΄κ°?
BuyLottoλ **ꡬ맀νλ€(Buy)**λΌλ **νμ(Verb)**μ **λ‘λ(Noun)**κ° ν©μ³μ§ μ΄λ¦μ
λλ€.
κ°μ²΄ μ΄λ¦μ μΌλ°μ μΌλ‘ **λͺ μ¬(Noun)**λ₯Ό μ¬μ©νμ¬ **λ³Έμ§(Identity)**μ λνλ΄μΌ ν©λλ€.
μ΄ κ°μ²΄κ° ꡬ맀 νμ μ체λ₯Ό λ΄λΉνλ κ²μ΄ μλλΌ, **ꡬ맀λ κ²°κ³Όλ¬Ό(λ‘λ λͺ©λ‘)**μ κ΄λ¦¬νλ κ²μ΄ ν΅μ¬ μ± μμ΄λ―λ‘, **κ³Όκ±°λΆμ¬(Purchased)**λ **λͺ μ¬(Tickets)**λ₯Ό μ¬μ©νμ¬ μ΄λ¦μ μ§λ κ²μ΄ μ€κ³μ μμ§λλ₯Ό λμ¬μ€λλ€.
κ²°λ‘ μ μΌλ‘, PurchasedLottosλ‘ μ΄λ¦μ λ³κ²½νμμ΄ κ°μ²΄μ μ± μμ λͺ νν νννλ κ²μ κΆμ₯ν©λλ€.
| private final TicketCount ticketCount; | ||
| private final TicketCount passiveTicketCount; |
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.
νμ¬ μ½λλ **κ°μ²΄μ§ν₯ μν체쑰 μμΉμ "κ·μΉ 7: 3κ° μ΄μμ μΈμ€ν΄μ€ λ³μλ₯Ό κ°μ§ ν΄λμ€λ₯Ό μ°μ§ μλλ€.'**λ₯Ό μ§ν€μ§ λͺ»νκ³ μλ€.
μ΄ ν΄λμ€μ μΈμ€ν΄μ€ λ³μ(νλ)κ° 3κ° μ΄μ μ¬μ©λκ³ μλλ°, μ΄ νλλ€μ μ€μ΄κ±°λ λΆλ¦¬νλ λ°©λ²μ΄ μμκΉ? μ΄ 2κ°μ TicketCountλ₯Ό νλκ° μλ λ€λ₯Έ λ°©μμΌλ‘ μ κ·Όνλ κ²μ μ΄λ¨κΉ?
μμ±μμμ μ΄ κ°μ ꡬνκΈ° μν΄ λ무 λ§μ μ±
μμ λ§‘κ³ μλ κ²μ μλκΉ?
| public static BuyLotto createLotto(LottoPrice lottoPrice) { | ||
| List<Lotto> lottoNumbers = new ArrayList<>(); | ||
|
|
||
| public static void createLotto(BuyLotto buyLotto, LottoPrice lottoPrice) { |
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.
| public static void createLotto(BuyLotto buyLotto, LottoPrice lottoPrice) { | |
| public static BuyLotto createLotto(LottoPrice lottoPrice) { |
μ΄ λ©μλλ BuyLottoλ₯Ό μμ±ν΄ λ°ννλ λ°©μμΌλ‘ ꡬννλ©΄ μ΄λ¨κΉ?
λ©μλ μ΄λ¦μ 무μμΈκ° κ°μ λ°ννλ κ²μΌλ‘ 보μ¬μ§
μμ κ°μ΄ ꡬνν ν λκ°μ ArrayListλ₯Ό ν©μΉ λ addAll(ArrayList values)μ κ°μ λ©μλλ‘ μΆκ°νλλ° μμ κ°μ΄ μμ±ν νμ μλ, μλμ Listλ₯Ό ν©μΉλ λ λ€λ₯Έ λ©μλλ₯Ό μΆκ°νλ κ²μ μ΄λ¨κΉ?
javajigi
left a comment
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.
λ‘λ λ―Έμ
λκΉμ§ μ λ§λ¬΄λ¦¬νλ€μ. π―
μ΅κ·Ό λ€μ΄ μλΉν λ―Έμ
μ§νν΄ λͺ°μ
νλ€λ³΄λ λΉ λ₯΄κ² λ§λ¬΄λ¦¬νλ€μ.
λ°λ‘ mergeνλ €λ€ νΉμλΌλ μΆκ° μ°μ΅ν΄λ³΄κ³ μΆμ λΆλΆμ΄ μμ μ μμ΄ request changesλ‘ λ¨κ²¨λ΄
λλ€.
νΉμλΌλ μΆκ° 리ν©ν°λ§ν΄λ³΄κ³ μΆμ λΆλΆ μμΌλ©΄ λμ ν΄ λ³΄μκ³ μ.
μμΌλ©΄ λ°λ‘ 리뷰 μμ²ν΄λ λ©λλ€.
μλλ©΄ λ‘λ λ―Έμ μ μ§ν μνλ‘ λκ³ "μκ°μ μ² - λ κ±°μ μ½λ 리ν©ν°λ§" λ―Έμ μ§ννλ€ μΌμ μκ°μ΄ μ§λ ν λ€μ 리ν©ν°λ§ λμ ν΄ λ³΄λ κ²λ μ’μ μ°μ΅ λ°©λ²μΌ μ μμ΅λλ€. AIμ ν¨κ» λ‘λ λ―Έμ μ κ°μ²΄ μ€κ³μ λν νΌλλ°±μ λ°μ보λ κ²λ μ’μ λ°©λ²μΌ κ² κ°μμ.
| public TicketCount(int price, int passiveTicketCount) { | ||
| this.autoTicketCount = (price / 1_000) - passiveTicketCount; |
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.
'int price'λ₯Ό ν¬μ₯ν Price κ°μ²΄κ° μλλ° μ΄ κ°μ²΄κ° price / 1_000 λ‘μ§ κ΅¬νμ λ΄λΉν΄λ λμ§ μμκΉ?
κ·Έλ λ€λ©΄ (price / 1_000) - passiveTicketCount λ‘μ§λ Price κ°μ²΄κ° λ΄λΉν μλ μμ κ² κ°λ€.
μλ νμΈμ. 4λ¨κ³ λ‘λ(μλ) κ³Όμ μ μΆν©λλ€ ! πββοΈ
κ³Όμ μ§ν λ΄μ© μ 리