code stringlengths 41 34.3k | lang stringclasses 8
values | review stringlengths 1 4.74k |
|---|---|---|
@@ -0,0 +1,162 @@
+package store.domain;
+
+import static store.util.Constant.BLANK;
+import static store.util.Constant.PRODUCTS_FILE_NAME;
+import static store.util.ErrorMessage.INSUFFICIENT_INVENTORY_MESSAGE;
+import static store.util.ErrorMessage.PRODUCT_NOT_FOUND_MESSAGE;
+import static store.util.Parser.parseProdu... | Java | ์ ๋ ์ด ๋ฉ์๋์ ๊ธฐ๋ฅ์ด ํด๋น ํด๋์ค์ ์๋๊ฒ๋ณด๋ค Product์ ์๋๊ฒ ์ ์ ํ๊ฑฐ ๊ฐ๋ค๊ณ ์๊ฐ์ด ๋๋๋ฐ ํด๋น ํด๋์ค์ ๋ฃ์ผ์ ์ด์ ๊ฐ ๊ถ๊ธํฉ๋๋ค |
@@ -0,0 +1,162 @@
+package store.domain;
+
+import static store.util.Constant.BLANK;
+import static store.util.Constant.PRODUCTS_FILE_NAME;
+import static store.util.ErrorMessage.INSUFFICIENT_INVENTORY_MESSAGE;
+import static store.util.ErrorMessage.PRODUCT_NOT_FOUND_MESSAGE;
+import static store.util.Parser.parseProdu... | Java | ์ฒ์๋ณด๋ ํ์์ธ๋ฐ ์ด๋ค ๊ธฐ๋ฅ์ ํ๋์ง ๊ถ๊ธํฉ๋๋ค |
@@ -0,0 +1,83 @@
+package store.domain;
+
+import static store.util.Constant.BLANK;
+import static store.util.ErrorMessage.INVALID_ORDER_MESSAGE;
+
+import java.util.Collections;
+import java.util.LinkedHashMap;
+import java.util.List;
+import java.util.Map;
+
+public class Order {
+
+ private final Map<String, Inte... | Java | order์ ๋ฃ๋ ๋ถ๋ถ์ด parserOrder์ ์์ด์ ์ด ๋ถ๋ถ์์ ํ๋ผ๋ฏธํฐ๋ฅผ ์ ๋ฌํด์ฃผ๊ณ putToOrders์์ ์ง์ orders์ ๋ฃ๋ ๋ฐฉ์์ผ๋ก ๋ณ๊ฒฝํ๋ฉด ๋ฉ์๋ ์ด๋ฆ์ ์ ํฉํ ๊ธฐ๋ฅ์ ํ ๊ฑฐ๊ฐ๋ค๋ ์๊ฐ์ด ๋ค์ด์ ์์ฑํด๋ด
๋๋ค. |
@@ -0,0 +1,83 @@
+package store.domain;
+
+import static store.util.Constant.BLANK;
+import static store.util.ErrorMessage.INVALID_ORDER_MESSAGE;
+
+import java.util.Collections;
+import java.util.LinkedHashMap;
+import java.util.List;
+import java.util.Map;
+
+public class Order {
+
+ private final Map<String, Inte... | Java | splitํ๋ ๋ถ๋ถ์ regex๋ ์์ํํ๋ฉด ์ข์๊ฑฐ๊ฐ๋ค๊ณ ์๊ฐ๋ญ๋๋ค |
@@ -0,0 +1,120 @@
+package store.domain;
+
+import static store.util.Constant.MEMBERSHIP_DISCOUNT_LIMIT;
+import static store.util.Constant.MEMBERSHIP_DISCOUNT_RATE;
+
+import java.util.Collections;
+import java.util.LinkedHashMap;
+import java.util.Map;
+
+public class Receipt {
+
+ private final Map<Product, Integ... | Java | inventory์์ ๋น์ทํ ์ญํ ์ ํ๋ ํจ์๋ฅผ ๋ณธ๊ฑฐ ๊ฐ์๋ฐ ์๋ฃํ ๋๋ฌธ์ ์๋ก ๋ง๋์ ๊ฑด๊ฐ์..? |
@@ -0,0 +1,86 @@
+package store.controller;
+
+import static store.util.Constant.ANSWER_NO;
+import static store.util.InformationMessage.WELCOME_MESSAGE;
+import static store.util.Validator.validateAnswer;
+import static store.view.InputView.readForAdditionalPurchase;
+import static store.view.OutputView.displayReceipt... | Java | private๋ก ์ํ์ ์ด์ ๊ฐ ์๋์? controller์์๋ ์๋ฌด๋ ์ ๊ทผํ์ง ๋ชปํ๋๋ก ์ ๊ทผ์ ํ์๋ฅผ ์ค์ ํด ๋๋๊ฒ ์ข์๋ณด์
๋๋ค |
@@ -0,0 +1,162 @@
+package store.domain;
+
+import static store.util.Constant.BLANK;
+import static store.util.Constant.PRODUCTS_FILE_NAME;
+import static store.util.ErrorMessage.INSUFFICIENT_INVENTORY_MESSAGE;
+import static store.util.ErrorMessage.PRODUCT_NOT_FOUND_MESSAGE;
+import static store.util.Parser.parseProdu... | Java | Inventory์ ์ญํ ์ด ๋๋ฌด ๋ง์๋ณด์ฌ์. find๋ add ๊ฐ์ CRUD ๊ฐ๋
์ 3-way-architecture๋ฅผ ์ด์ฉํด๋ณด์๋๊ฑด ์ด๋จ๊น์ |
@@ -0,0 +1,83 @@
+package store.domain;
+
+import static store.util.Constant.BLANK;
+import static store.util.ErrorMessage.INVALID_ORDER_MESSAGE;
+
+import java.util.Collections;
+import java.util.LinkedHashMap;
+import java.util.List;
+import java.util.Map;
+
+public class Order {
+
+ private final Map<String, Inte... | Java | ์ ๋ ๋๋ฉ์ธ์์ ๊ฒ์ฆํ๋ ๊ฒ ์๋๊ฑธ ์ข์ํ๋ ํธ์ธ๋ฐ ํด๋น ์ ๊ฐ ์๊ฐํ๋ ์ด๋ฒ ํธ์์ ์์๋ orderCount๋ฅผ ๋ฏธ๋ฆฌ parseํ๋ ๊ฒ ๋ ์ข๋ค๊ณ ์๊ฐํฉ๋๋ค |
@@ -0,0 +1,158 @@
+package store.service;
+
+import static store.util.Constant.ANSWER_NO;
+import static store.util.Constant.ANSWER_YES;
+import static store.util.Validator.validateAnswer;
+import static store.view.InputView.readForAdditionalItem;
+import static store.view.InputView.readForMembershipDiscount;
+import s... | Java | ์ ๋ service์์ input, output์ ํ๋ ๊ฑด ์ญํ ์ ์๋ง๋ค๊ณ ์๊ฐํฉ๋๋ค. controller๊ฐ ์ฌ์ฉ์์๊ฒ ์
๋ ฅ๊ณผ ์ถ๋ ฅ์ ๋ด๋นํ๋ค๊ณ ์๊ฐํ๋๋ฐ service์์ ํ๋ ์ญํ ์ด ์๋๋ผ๊ณ ์๊ฐํฉ๋๋ค |
@@ -0,0 +1,86 @@
+package store.controller;
+
+import static store.util.Constant.ANSWER_NO;
+import static store.util.InformationMessage.WELCOME_MESSAGE;
+import static store.util.Validator.validateAnswer;
+import static store.view.InputView.readForAdditionalPurchase;
+import static store.view.OutputView.displayReceipt... | Java | ํด๋น ์ฝ๋๋ InputView์์ ๋ฉ์๋๋ฅผ ๋ง๋ค์ด์ ํธ์ถํ๋ ๋ฐฉ์์ผ๋ก ์ํํ์ผ๋ฉด ๋ ์ข์์ ๊ฒ ๊ฐ๋ค๋ ์๊ฐ์ด ๋ค์์ด์!
import camp.nextstep.edu.missionutils.Console; ๋์ผํ import ๊ตฌ๋ฌธ์ด InputView์๋ ์๊ธฐ ๋๋ฌธ์ด์์! |
@@ -0,0 +1,162 @@
+package store.domain;
+
+import static store.util.Constant.BLANK;
+import static store.util.Constant.PRODUCTS_FILE_NAME;
+import static store.util.ErrorMessage.INSUFFICIENT_INVENTORY_MESSAGE;
+import static store.util.ErrorMessage.PRODUCT_NOT_FOUND_MESSAGE;
+import static store.util.Parser.parseProdu... | Java | ์ผ๊ธ ์ปฌ๋ ์
๋ฐฉ์์ ์ด์ฉํ์ฌ Inventory ํด๋์ค์์ ์ํ์ ์๋ ๊ฐ์ ๋ฉ์๋๋ฅผ ํธ์ถํ์ ๊ฒ ๊ฐ์์!
๊ฐ์ฒด๋ฅผ ๊ฐ์ฒด๋ต๊ฒ ํ์ฉํ๋ ค๋ ์ ๊ทผ์ด ๋๋ณด์
๋๋ค.
ํ์ง๋ง ํ ๊ฐ์ง ์์ฌ์ด ์ ์ ํ์ฌ ์๋๋งํผ ๋ฐ๋ณต๋ฌธ์ ํตํด reduceQuantity๋ฅผ ์ฌ๋ฌ ๋ฒ ํธ์ถํ๊ณ ์๋ค๋ ์ ์
๋๋ค.
์ด ๋์ , ํด๋น ์ํ(Product)์ ์ฐจ๊ฐํ ์๋์ ํ ๋ฒ์ ์ ๋ฌํ๋ ๋ฐฉ์์ผ๋ก ๊ฐ์ ํ๋ฉด ๋ถํ์ํ ๋ฐ๋ณต๋ฌธ์ ์ค์ด๊ณ ์ฑ๋ฅ๋ ๊ฐ์ ๋ ๊ฒ ๊ฐ์์!
```
private void reduceProduct(Product product, int quantity) {
product.re... |
@@ -0,0 +1,162 @@
+package store.domain;
+
+import static store.util.Constant.BLANK;
+import static store.util.Constant.PRODUCTS_FILE_NAME;
+import static store.util.ErrorMessage.INSUFFICIENT_INVENTORY_MESSAGE;
+import static store.util.ErrorMessage.PRODUCT_NOT_FOUND_MESSAGE;
+import static store.util.Parser.parseProdu... | Java | ๋ถ๋ณ ๋ฆฌ์คํธ๋ฅผ ๋ฐํํ๊ธฐ ์ํ ๋ฉ์๋๋ก ์๊ณ ์์ด์!
์ธ๋ถ์์ ์์ ์ ๋ฐฉ์งํ๊ณ ์์ ์ฑ์ ๋ณด์ฅํ๋ ๋ฐฉ๋ฒ์ผ๋ก ์๊ณ ์์ต๋๋ค!
์ ๋ ์ผ๊ธ์ปฌ๋ ์
๋ฐฉ๋ฒ์ ์ฌ์ฉํด์ ํน์๋ ๋์์ด ๋์
จ์ผ๋ฉด ํ๋ ๋ง์์ ๋ต๋ณ ๋ฌ์๋ด
๋๋ค! |
@@ -0,0 +1,83 @@
+package store.domain;
+
+import static store.util.Constant.BLANK;
+import static store.util.ErrorMessage.INVALID_ORDER_MESSAGE;
+
+import java.util.Collections;
+import java.util.LinkedHashMap;
+import java.util.List;
+import java.util.Map;
+
+public class Order {
+
+ private final Map<String, Inte... | Java | ์ผํ(,)์ ๊ฐ์ ์๋ฏธ ์๋ ๊ธฐํธ๋ฅผ ์์๋ก์จ ๋ถ๋ฆฌ๋ฅผ ํ์๋ฉด ์ ์ง ๋ณด์ ๊ด์ ์์ ๋ ์ข์ ๊ฒ ๊ฐ๋ค๋ ์๊ฐ์ด ๋ค์์ด์! |
@@ -0,0 +1,83 @@
+package store.domain;
+
+import static store.util.Constant.BLANK;
+import static store.util.ErrorMessage.INVALID_ORDER_MESSAGE;
+
+import java.util.Collections;
+import java.util.LinkedHashMap;
+import java.util.List;
+import java.util.Map;
+
+public class Order {
+
+ private final Map<String, Inte... | Java | split์ ์ฌ์ฉํ์
จ์ง๋ง List๋ฅผ ์ด์ฉํ์๊ธฐ ์ํค List.of๋ฅผ ์ด์ฉํ์ ์ ์ด ๋๋ณด์ด๋ค์! |
@@ -0,0 +1,120 @@
+package store.domain;
+
+import static store.util.Constant.MEMBERSHIP_DISCOUNT_LIMIT;
+import static store.util.Constant.MEMBERSHIP_DISCOUNT_RATE;
+
+import java.util.Collections;
+import java.util.LinkedHashMap;
+import java.util.Map;
+
+public class Receipt {
+
+ private final Map<Product, Integ... | Java | ```
int promotionApplicableQuantity = calculatePromotionApplicableQuantity(product, promotions);
membershipApplicableAmount += product.getPrice() * (quantity - promotionApplicableQuantity);
```
ํด๋น ์ฝ๋๋ฅผ ๋ฉ์๋ ๋ถ๋ฆฌํ์
์ ํ ๋ผ์ธ์ผ๋ก ์ฒ๋ฆฌ๊ฐ ๊ฐ๋ฅํ์ ๊ฒ ๊ฐ์์! |
@@ -0,0 +1,81 @@
+package store.view;
+
+import static store.util.Constant.BLANK;
+import static store.util.ErrorMessage.ERROR_TAG;
+import static store.util.Constant.RECEIPT_AMOUNT_INFO_TITLE;
+import static store.util.Constant.RECEIPT_GIVEAWAY_TITLE;
+import static store.util.Constant.RECEIPT_TITLE;
+import static st... | Java | ์๋
ํ์ธ์!
ํน์ ์๋์ ๊ฐ์ด ํฌ๋งท์ ์ค์ ํ์
จ์ ๋, ๋์ด์ฐ๊ธฐ ๋๋ฌธ์ ์ถ๋ ฅ์ด ์ฌ๋ฐ๋ฅด๊ฒ ์ ๋ ฌ์ด ๋์
จ๋์??
4์ฃผ ์ฐจ ์งํํ๋ฉด์ ์์์ฆ ์ถ๋ ฅ ๋ถ๋ถ์ ๋ณด๊ธฐ ์ข๊ฒ ์ ๋ฆฌํ๋ ๊ฒ์ด ์๊ตฌ์ฌํญ์ด์์ด์ ๋ง์ด ์ฐพ์๋ดค์ต๋๋ค!
๊ทธ ๊ณผ์ ์์ ์๊ฒ ๋ ์ ์, ํ๊ตญ์ด๋ 2๊ธ์๋ก ์ทจ๊ธ๋์ง๋ง, ๋์ด์ฐ๊ธฐ์ ์์ด๋ 1๊ธ์๋ก ์ทจ๊ธ๋๋ค๋ ๊ฒ์
๋๋ค. ๊ทธ๋์ ๋์ด์ฐ๊ธฐ๋ฅผ ํ๊ธ์ฒ๋ผ 2๊ธ์ ์ญํ ์ ํ ์ ์๋ ๋ฐฉ๋ฒ์ด ์์๊น ๊ณ ๋ฏผํ๋ค๊ฐ, \u3000 (์ ๋์ฝ๋ ๊ณต๋ฐฑ)์ ์๊ฒ ๋์์ต๋๋ค!
์๋ฅผ ๋ค์ด, ์๋์ ๊ฐ์ด ์ฌ์ฉํ ์ ์์ต๋๋ค:
`String name = String.format("%-14s... |
@@ -0,0 +1,86 @@
+package store.controller;
+
+import static store.util.Constant.ANSWER_NO;
+import static store.util.InformationMessage.WELCOME_MESSAGE;
+import static store.util.Validator.validateAnswer;
+import static store.view.InputView.readForAdditionalPurchase;
+import static store.view.OutputView.displayReceipt... | Java | ์ผ๋ฐ์ ์ผ๋ก do-while๋ณด๋ค๋ while๋ฌธ์ ์ฌ์ฉํ์ฌ ์กฐ๊ฑด์ ๋จผ์ ํ์ธํ๋ ๊ฒ์ด ๋ ๋ช
ํํ๊ณ ๊ฐ๋
์ฑ๋ ํฅ์๋๋ค๊ณ ์๊ณ ์์ด์! while ๋ฌธ์ ์ฌ์ฉํ๋ค๋ฉด, ์ฝ๋ ํ๋ฆ์ด ๋ช
ํํด์ ธ์ ์ ์ง๋ณด์ํ ๋ ๋ ์ฝ๊ฒ ์ดํดํ ์ ์์ ๊ฒ ๊ฐ์ต๋๋ค. ๐ |
@@ -0,0 +1,162 @@
+package store.domain;
+
+import static store.util.Constant.BLANK;
+import static store.util.Constant.PRODUCTS_FILE_NAME;
+import static store.util.ErrorMessage.INSUFFICIENT_INVENTORY_MESSAGE;
+import static store.util.ErrorMessage.PRODUCT_NOT_FOUND_MESSAGE;
+import static store.util.Parser.parseProdu... | Java | ํ๋ณํ์ ์ฌ์ฉํ๋ ๋ฐฉ์์ ์ ์ฌ์ ์ธ ์ค๋ฅ๋ฅผ ์ ๋ฐํ ์ ์๊ธฐ ๋๋ฌธ์, ๊ฐ๋ฅํ ํ ๊ตฌ์ฒด์ ์ธ ํ์
์ ์ฌ์ฉํ์ฌ ์์ ํ๊ณ ๊ฐ๋
์ฑ์ด ์ข์ ์ฝ๋๋ฅผ ์์ฑํ๋ ๊ฒ์ด ์ข์ ๊ฒ ๊ฐ์์!
์๋ฅผ ๋ค์ด, `List<Object>` ํ์
์ `List<String>, List<ProductInfo>` ๋ฐ๊พธ์ด ๊ตฌ์ฒด์ ์ธ ์๋ฃํ์ ์ฌ์ฉํ๋ฉด ํ๋ณํ์ ํผํ ์ ์์ด์
```java
private Product createProduct(List<String> productInfo) {
String name = productInfo.get(0);
int price = Integer... |
@@ -0,0 +1,162 @@
+package store.domain;
+
+import static store.util.Constant.BLANK;
+import static store.util.Constant.PRODUCTS_FILE_NAME;
+import static store.util.ErrorMessage.INSUFFICIENT_INVENTORY_MESSAGE;
+import static store.util.ErrorMessage.PRODUCT_NOT_FOUND_MESSAGE;
+import static store.util.Parser.parseProdu... | Java | ๋ฐ๋ณต๋๋ ์ฝ๋๋ ๋ฉ์๋๋ฅผ ๋ถ๋ฆฌํ๋ฉด ์ข์ ๊ฒ ๊ฐ์์ ๐ |
@@ -0,0 +1,162 @@
+package store.domain;
+
+import static store.util.Constant.BLANK;
+import static store.util.Constant.PRODUCTS_FILE_NAME;
+import static store.util.ErrorMessage.INSUFFICIENT_INVENTORY_MESSAGE;
+import static store.util.ErrorMessage.PRODUCT_NOT_FOUND_MESSAGE;
+import static store.util.Parser.parseProdu... | Java | ์ด ๋ถ๋ถ์ ์คํธ๋ฆผ์ ์ฌ์ฉํ์ฌ ๋ ๊ฐ๋จํ๊ฒ ๋ํ๋ผ ์ ์์ ๊ฒ ๊ฐ์์!
```java
public boolean hasProduct(String name) {
return products.stream()
.anyMatch(product -> name.equals(product.getName()));
}
``` |
@@ -0,0 +1,83 @@
+package store.domain;
+
+import static store.util.Constant.BLANK;
+import static store.util.ErrorMessage.INVALID_ORDER_MESSAGE;
+
+import java.util.Collections;
+import java.util.LinkedHashMap;
+import java.util.List;
+import java.util.Map;
+
+public class Order {
+
+ private final Map<String, Inte... | Java | ์,, ํน์ ์ด๋ฌ๋ฉด [์ฝ๋ผ[-3]] ์ด๋ ๊ฒ ์์ฑ๋ผ๋ ํต๊ณผ๋ ๊ฑฐ ๊ฐ์๋ฐ ์๋๊ฐ์ ?? |
@@ -0,0 +1,40 @@
+package store.domain;
+
+import java.time.LocalDateTime;
+
+public class Promotion {
+
+ private final String name;
+ private final int buy;
+ private final int get;
+ private final LocalDateTime startDate;
+ private final LocalDateTime endDate;
+
+ public Promotion(String name, int ... | Java | startDate์ endDate ๋ DateRange ๊ฐ์ ํด๋์ค๋ฅผ ํตํด ๋ฐ๋ก ๋ถ๋ฆฌํ๋ ๊ฒ์ด ๋์ ๊ฒ ๊ฐ์์! |
@@ -0,0 +1,40 @@
+package store.domain;
+
+import java.time.LocalDateTime;
+
+public class Promotion {
+
+ private final String name;
+ private final int buy;
+ private final int get;
+ private final LocalDateTime startDate;
+ private final LocalDateTime endDate;
+
+ public Promotion(String name, int ... | Java | ์ ๋ ์ค์ํ ๋ถ๋ถ์ธ๋ฐ, ์ด๋ฌ๋ฉด ํ๋ก๋ชจ์
์์์ผ, ์ข
๋ฃ์ผ์ด๋ฉด false ๋ฅผ ๋ฐํํ๋๋ผ๊ตฌ์ ใ
ใ
|
@@ -0,0 +1,81 @@
+package store.view;
+
+import static store.util.Constant.BLANK;
+import static store.util.ErrorMessage.ERROR_TAG;
+import static store.util.Constant.RECEIPT_AMOUNT_INFO_TITLE;
+import static store.util.Constant.RECEIPT_GIVEAWAY_TITLE;
+import static store.util.Constant.RECEIPT_TITLE;
+import static st... | Java | ์ด๋ฌํ ์ํ๋ช
, ์๋, ๊ธ์ก, ์ด๊ตฌ๋งค์ก, ํ์ฌํ ์ธ, ๋ฉค๋ฒ์ญํ ์ธ ๋ฑ ์์๋ก ๊ด๋ฆฌํ๋ฉด ๋ ์ข์ ๊ฑฐ ๊ฐ์์! |
@@ -0,0 +1,162 @@
+package store.domain;
+
+import static store.util.Constant.BLANK;
+import static store.util.Constant.PRODUCTS_FILE_NAME;
+import static store.util.ErrorMessage.INSUFFICIENT_INVENTORY_MESSAGE;
+import static store.util.ErrorMessage.PRODUCT_NOT_FOUND_MESSAGE;
+import static store.util.Parser.parseProdu... | Java | close๊น์ง ์๊ฐ๋ชปํ๋๋ฐ ๊ผผ๊ผผํ์ ๋ฐ์! |
@@ -0,0 +1,162 @@
+package store.domain;
+
+import static store.util.Constant.BLANK;
+import static store.util.Constant.PRODUCTS_FILE_NAME;
+import static store.util.ErrorMessage.INSUFFICIENT_INVENTORY_MESSAGE;
+import static store.util.ErrorMessage.PRODUCT_NOT_FOUND_MESSAGE;
+import static store.util.Parser.parseProdu... | Java | ์ฌ๊ธฐ์ ์ผ๊ธ์ปฌ๋ ์
์ ์ฌ์ฉํ์ ๊ฑฐ๋ผ๋ฉด, static์ด ์๋๋ผ final์ด ๋ ์ ์ ํด ๋ณด์ด๋๋ฐ static์ ์ฌ์ฉํ์ ์ด์ ๊ฐ ์์๊น์? |
@@ -0,0 +1,162 @@
+package store.domain;
+
+import static store.util.Constant.BLANK;
+import static store.util.Constant.PRODUCTS_FILE_NAME;
+import static store.util.ErrorMessage.INSUFFICIENT_INVENTORY_MESSAGE;
+import static store.util.ErrorMessage.PRODUCT_NOT_FOUND_MESSAGE;
+import static store.util.Parser.parseProdu... | Java | ์ด ๋ถ๋ถ์ ์ธ๋ถ ํด๋์ค์์ ์ฌ์ฉํ๋๊ฒ ์๋ checkProductInventory์์๋ง ์ฌ์ฉํ๊ธฐ ๋๋ฌธ์, private์ผ๋ก ๋ซ์๋ฌ๋ ๋ ๊ฑฐ ๊ฐ์ต๋๋ค |
@@ -0,0 +1,33 @@
+public class Calculator {
+ public double calculate(String expression) {
+ String[] tokens = expression.split(" ");
+ double currentResult = Double.parseDouble(tokens[0]);
+
+ for (int i = 1; i < tokens.length; i += 2) {
+ String operator = tokens[i];
+ do... | Java | Enum์ ์ฌ์ฉํด์ switch๋ฌธ์ ์ฌ์ฉํ์ง ์๋ ๋ฐฉํฅ์ผ๋ก ์ฝ๋๋ฅผ ์์ฑํด๋ด
์๋ค |
@@ -0,0 +1,33 @@
+public class Calculator {
+ public double calculate(String expression) {
+ String[] tokens = expression.split(" ");
+ double currentResult = Double.parseDouble(tokens[0]);
+
+ for (int i = 1; i < tokens.length; i += 2) {
+ String operator = tokens[i];
+ do... | Java | Calculator ํด๋์ค์ ์ฑ
์์ ๋ฌด์์ธ๊ฐ์.
ํ ํด๋์ค์ ์ฌ๋ฌ ๊ฐ์ ์ฑ
์์ด ์๋ ๊ฒ ๊ฐ์ต๋๋ค.
SCP์ ๋ํด์ ๊ณต๋ถํด๋ณด๊ณ ์ฝ๋๋ฅผ ์์ฑํด์ฃผ์ธ์ |
@@ -0,0 +1,34 @@
+public class Validator {
+ public boolean isValid(String expression) {
+ String[] tokens = expression.split(" ");
+
+ if (tokens.length % 2 == 0) {
+ return false;
+ }
+
+ if (!isNumeric(tokens[0])) {
+ return false;
+ }
+
+ for (int i... | Java | ํ ๋ฉ์๋๊ฐ ๋ง์ ์ญํ ์ ํด์ฃผ๋ ๊ฒ ๊ฐ์ต๋๋ค.
๊ฐ๊ฐ์ if๋ฌธ์ ์ฌ๋ฌ ๋ฉ์๋๋ก ๋๋์ด๋ณด์ธ์. |
@@ -1,5 +1,22 @@
+import java.util.Scanner;
+
public class Main {
public static void main(String[] args) {
- System.out.println("1 + 1 = 2");
+ Scanner scanner = new Scanner(System.in);
+ System.out.println("๊ณ์ฐํ ์์์ ์
๋ ฅํ์ธ์ (์: 30 + 20 / 2 * 4):");
+ String expression = scanner.nextLine(... | Java | Main ํด๋์ค์ ๋๋ฌด ๋ง์ ์ฑ
์์ด ์์ต๋๋ค.
SCP์ ๋ํด์ ๊ณต๋ถ ํด๋ณด๊ณ ์ฝ๋๋ฅผ ์์ฑํด์ฃผ์ธ์
* ์ฝ์์ ํ๋ฆฐํธํด์ฃผ๋ ๊ฒ๋ ํ๋์ ์ฑ
์์ผ๋ก ๋ด
๋๋ค |
@@ -18,6 +18,7 @@
import java.util.ArrayList;
import java.util.List;
import java.util.Optional;
+import java.util.stream.Collectors;
@Slf4j
@RestController
@@ -26,12 +27,24 @@ public class OrderController {
private final OrderService orderService;
private final BasketService basketService;
+
+ /*
... | Java | (C) ๋ถํ์ํ IOException์ธ ๊ฒ ๊ฐ์ต๋๋ค. |
@@ -11,6 +11,7 @@
import java.io.IOException;
+// (Q) Custom deserializer๋ฅผ ๊ตฌํํ ์ด์ ๊ฐ ๋ฌด์์ธ๊ฐ์? Jackson ๋ฑ์ serializer๋ฅผ ์ฌ์ฉํ๊ธฐ ์ด๋ ค์ด ๋ถ๋ถ์ด ์๋์?
public class StoreDeserializer extends StdDeserializer {
public StoreDeserializer(){ | Java | > ๋ค ์ฌ์ค Menu ๋ฐ์ดํฐ์๋ ๋ค๋ฅด๊ฒ Store ๋ฐ์ดํฐ๋ Point๋ผ๋ spring์์ ์ ๊ณตํ๋ ๊ฐ์ฒด๋ฅผ property๋ก ๊ฐ์ง๊ณ ์์ต๋๋ค. ๊ทธ๋ฐ๋ฐ objectMapper์ readValue()๋ก๋ Store.class๋ฅผ ๋ฐ๋ก ์ญ์ง๋ ฌํ์ํค์ง ๋ชปํ๋๋ฐ ๊ทธ๊ฑด ๋ฐ๋ก Point๋ฅผ objectMapper๊ฐ ํด์ํ์ง ๋ชปํ๊ธฐ ๋๋ฌธ์ด๋๋ผ๊ณ ์. JSONObject.get()์ ์ฌ์ฉํด์ ํ๋ํ๋ ๊น์ ์ญ์ง๋ ฌํํด๋ ๋์ง๋ง, convertStoreData() ๋ฉ์๋๊ฐ ๊ธธ์ด์ง๋ ๊ฒ ๋ณด๊ธฐ ์ซ์ด์ Custom deserializer๋ฅผ ์ฌ์ฉํด์ ํ๋ฐฉ์ ์ฒ๋ฆฌ๋๊ฒ๋ ๋ณด์ด๋๋ก(?) ํ์ต๋๋ค. ์ฌ์ค D... |
@@ -5,27 +5,32 @@
import org.springframework.web.bind.annotation.*;
import java.util.ArrayList;
+import java.util.Arrays;
import java.util.EnumSet;
import java.util.List;
+import java.util.stream.Collectors;
@RestController
-@RequestMapping("/customer")
+@RequestMapping("/customer") // (R) HomeController์์ url... | Java | >HomeController์ home()์ ํน๋ณํ ์ด์ ์์ด ์ด๊ธฐ์ ์๋ฒ๊ฐ ์ ๋์๊ฐ๋์ง ํ
์คํธ ํ๋ ค๊ณ ๋ฃ์ด๋์ ํ
์คํธ ์ฉ๋์ ์ฝ๋์
๋๋ค. Customer, Restaurant, Rider ์ธ๊ฐ์ง ์๋ฒ๋ฅผ ๋์ฐ๋ค๋ณด๋ White Error ํ์ด์ง๋ก๋ ํท๊ฐ๋ ค์ ์์๋ก ์์ฑํ๋ ์ฝ๋์ธ๋ฐ, ํ
์คํธ ์ฉ๋๊ธฐ ๋๋ฌธ์ ์์ด๋ ๋ฌธ์ ๊ฐ ์์ต๋๋ค. ํด๋น ์ฝ๋์๋ ์ฃผ์์ ๋ฃ์ด์ผ ํ์๋ค์.
> customer, restaurant, rider ์๋ฒ ๋ชจ๋ home controller๋ฅผ ๊ฐ์ง๊ณ ์๋๋ฐ, ์ฌ์ค ์ฃผ ์ฉ๋๋ ์๋ฒ๊ฐ ๋์๊ฐ๋์ง ๋ณด๋ ค๊ณ ๋ง๋ค์ด๋ ๊ฒ์
๋๋ค. url prefix๋ ์ปจํธ... |
@@ -18,6 +18,7 @@
import java.util.ArrayList;
import java.util.List;
import java.util.Optional;
+import java.util.stream.Collectors;
@Slf4j
@RestController
@@ -26,12 +27,24 @@ public class OrderController {
private final OrderService orderService;
private final BasketService basketService;
+
+ /*
... | Java | > Customer๋น Basket์ ํ๋๋ง ๊ฐ์ง๋ค๊ณ ์๊ฐํด์ CustomerId๋ฅผ ๋ฐ๋ก BasketId๋ก ์ฌ์ฉํ์ต๋๋ค.
๋ฌผ๋ก ๋์ผํ ๊ฐ์ id๋ก ์ฌ์ฉํ์๋ ๊ฒ๋ ๊ธฐ๋ฅ ๋์์ ๋ฌธ์ ๊ฐ ์๊ฒ ์ง๋ง, basketId์ customerId๋ฅผ ๊ทธ๋๋ก ์ฌ์ฉํ๋ ๊ฒ์ ์ผ๋จ ์ฝ๋์ ์๋ ํ์
์ด ์ด๋ ต๊ณ , ์ดํ ๋ถ์ฌ๋๋ id๋ฅผ ๊ธฐ๋ฐ์ผ๋ก ๋ฐ์ดํฐ๋ฅผ ๊ฒ์ํ ํ
๋ฐ ๊ทธ ๋๋ ์ค์๋ฅผ ์ ๋ฐํ ์ฌ์ง๊ฐ ์๋ ๊ฒ ๊ฐ์ต๋๋ค.
์ฝ๋ ์์ค์์ ์ค์๋ฅผ ์๋ฐฉํ ์ ์๋ ๋ถ๋ถ์ด ์๋ค๋ฉด ํญ์ ๋ฐฉ์ดํ๋๋ก ์์ฑํ๋ ๊ฒ์ด ์ข์ ๊ฒ ๊ฐ์ต๋๋ค! |
@@ -18,6 +18,7 @@
import java.util.ArrayList;
import java.util.List;
import java.util.Optional;
+import java.util.stream.Collectors;
@Slf4j
@RestController
@@ -26,12 +27,24 @@ public class OrderController {
private final OrderService orderService;
private final BasketService basketService;
+
+ /*
... | Java | > Repository์์ ์ต๊ด์ ์ผ๋ก create์ดํ id๋ฅผ ๋ฐํํ๋ ๋ก์ง์ ์ฌ์ฉํ๋ค๋ณด๋ ์ด๋ ๊ฒ ์์ฑํ๋๋ฐ, ์๊ฐํด๋ณด๋ order ์์ฒด๋ฅผ ๊ฐ์ ธ์ค๋ฉด getOrder()๋ ์ฌ์ฉํ์ง ์์๋ ๋๋ ์ฟผ๋ฆฌ ํ ๋ฒ์ ์ ์ฝํ๊ฒ ๊ตฐ์. ์ง์ ํด์ฃผ์
์ ๊ฐ์ฌํฉ๋๋ค.
๋ง์ํด์ฃผ์ ๋ถ๋ถ๋ order ๊ฐ์ฒด๋ก ์ฒ๋ฆฌํ๋ ๊ฒ์ ์ฅ์ ์ผ๋ก ๋ณผ ์ ์์ ๊ฒ ๊ฐ์ต๋๋ค.
๋ค๋ง ์ ๊ฐ ๋ฆฌ๋ทฐ๋๋ฆฐ ๊ด์ ์ ์กฐ๊ธ ๋ค๋ฅธ ๋ถ๋ถ์
๋๋ค.
string ํ์
์ ๋ฒ์ฉ์ ์ธ primitive ํ์
์ด๊ธฐ ๋๋ฌธ์, ํด๋์ค ์์ฒด๋ก์จ๋ ํฐ ์๋ฏธ๋ฅผ ๊ฐ์ง ์์ต๋๋ค. (๋จ์ง string์ ์ญํ ์ ํ๋ ๊ธฐ๋ฅ๋ค์ ์ ๊ณตํ ๋ฟ์ด๊ฒ ์ฃ )
ํ์ง๋ง... |
@@ -11,6 +11,7 @@
import java.io.IOException;
+// (Q) Custom deserializer๋ฅผ ๊ตฌํํ ์ด์ ๊ฐ ๋ฌด์์ธ๊ฐ์? Jackson ๋ฑ์ serializer๋ฅผ ์ฌ์ฉํ๊ธฐ ์ด๋ ค์ด ๋ถ๋ถ์ด ์๋์?
public class StoreDeserializer extends StdDeserializer {
public StoreDeserializer(){ | Java | ๋ค ๋์ผํ ๋ณ์๋ช
์ผ๋ก ์ฒ๋ฆฌํ์ง๋ง, custom deserializer๋ฅผ ์ฌ์ฉํ์ง ์์ผ๋ฉด ๋ค์๊ณผ ๊ฐ์ ์๋ฌ๊ฐ ๋ฐ์ํฉ๋๋ค.
_Cannot construct instance of `org.springframework.data.geo.Point` (no Creators, like default constructor, exist): cannot deserialize from Object value (no delegate- or property-based Creator)_
Point๋ผ๋ ๊ฐ์ฒด๋ฅผ objectMapper๊ฐ ๋ชจ๋ฅด๊ธฐ ๋๋ฌธ์ ๋ฐ์ํ ์ผ์ด๋ผ๊ณ ํ๋๊ตฐ์. ์๋๋ c... |
@@ -11,6 +11,7 @@
import java.io.IOException;
+// (Q) Custom deserializer๋ฅผ ๊ตฌํํ ์ด์ ๊ฐ ๋ฌด์์ธ๊ฐ์? Jackson ๋ฑ์ serializer๋ฅผ ์ฌ์ฉํ๊ธฐ ์ด๋ ค์ด ๋ถ๋ถ์ด ์๋์?
public class StoreDeserializer extends StdDeserializer {
public StoreDeserializer(){ | Java | @millwheel
์ Point๊ฐ ๊ธฐ๋ณธ ์์ฑ์๊ฐ ์๊ตฐ์.
์ ๊ฐ ์๊ณ ์๋ ์ผ๋ฐ์ ์ธ serializer์ deserialize ๋ฐฉ์์, ๋จผ์ ๊ธฐ๋ณธ ์์ฑ์๋ก ๊ฐ์ฒด๋ฅผ ์์ฑํ๊ณ setter๋ฅผ ํตํด ๊ฐ์ฒด ํ๋๋ฅผ settingํ๋ ๋ฐฉ์์ผ๋ก ์๊ณ ์์ต๋๋ค.
๊ทธ๋ฐ๋ฐ ๊ธฐ๋ณธ ์์ฑ์๊ฐ ์๋ค๋ณด๋ ๊ฐ์ฒด๋ฅผ ์์ฑํ๋ ๊ณผ์ ์์ ์๋ฌ๊ฐ ๋๋ ๊ฒ ๊ฐ๋ค์~
์ฌ์ค point ํด๋์ค์ ๊ด๋ จํด์๋ ๋ฆฌ๋ทฐ ๋๋ฆฌ๋ ค๊ณ ํ๋๋ฐ, ์ดํ ๊ด๋ จ ๋ฆฌ๋ทฐ์์ ๋ ์๊ธฐํด๋ณด๊ฒ ์ต๋๋ค~ |
@@ -19,11 +19,16 @@
@RestController
@Slf4j
+/*
+ (C) foodKind๋ QueryParam์ผ๋ก ๋ฐ๋ ๊ฒ์ด ๋ restful ํด๋ณด์
๋๋ค.
+ ๋ํ showStoreInfo์์๋ foodKind๋ฅผ ์ฌ์ฉํ์ง ์๊ธฐ ๋๋ฌธ์, ๊ฐ๋ณ ๋ฉ์๋์์ ๋งตํํ๋ ๊ฒ์ด ์ข์ ๋ณด์
๋๋ค.
+*/
@RequestMapping("/customer/{foodKind}/store")
public class StoreController {
private final MemberService memberService;
priv... | Java | > Q) @RequiredArgConstructor๋ฅผ Entity์์ ์ฌ์ฉํ๋ ๊ฒฝ์ฐ ์
๋ ฅ๋ Property์ ์์๋ฅผ ๋ฐ๊ฟจ์ ๋ ๋ ๊ฐ์ ํ์
์ property๋ผ๋ฉด ๋ฌธ์ ๊ฐ ๋๋ ๊ฒฝ์ฐ๊ฐ ์๋๋ผ๊ณ ์. ์์ฑ์๋ฅผ ์์ฑํ ๋ ๋งค๊ฐ๋ณ์ ์
๋ ฅ ์์๋ฅผ ๋ฐ๊พธ์ง ์์๋ ์ปดํ์ผ ๊ณผ์ ์์ ์๋ฌ๊ฐ ๋ฐ์ํ์ง ์์์ ์๋ชป๋ ๊ฐ์ด ๋ค์ด์๋ ์บ์นํ ์ ์์ด์ ์์ @RequiredArgConstructor๋ฅผ ์ฌ์ฉํ์ง ๋ง์๊ณ ํ๋ ๊ธ๋ ๋ดค์์ต๋๋ค. ๋ฌผ๋ก Controller๋ผ์ ๊ฐ์ ํ์
์ property๊ฐ ์์ผ๋๊น ์ฌ๊ธฐ์ ๋ฌธ์ ๊ฐ ์๊ฒ ์ง๋ง, ์ค์ ๋ก @requiredargsconstructor๋ฅผ ํธ์์ ... |
@@ -0,0 +1,6 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<Bucket
+ uuid = "F89D4C7C-1180-42EB-AF20-BEE64400FB01"
+ type = "1"
+ version = "2.0">
+</Bucket> | Unknown | ์ด ํ์ผ์ ๋ฌด์์ธ๊ฐ์ . .?
gitignore ๋ก ์์ฌ๋ฆฌ๋๊ฒ ์ข์๊ฒ๊ฐํธ์ |
@@ -10,11 +10,11 @@ import UIKit
class HomeViewController: UIViewController {
private var feeds: [Feed] = [
- Feed(username: "Woody", profileImage: "profileImage", title: "์ฐ๋ญ๋จน๋ค ๋ฐ์ ์๊ฐ", hashTags: [HashTag(hashTag: "#Guitar"), HashTag(hashTag: "#Jazz")]),
- Feed(username: "Woody", profileImage: ... | Swift | 550์ ์๋ฏธ๋ ๋ฌด์์ธ๊ฐ์ !
์๋ฏธ๊ฐ ์๋ค๋ฉด let์ผ๋ก ๋ช
๋ช
ํด์ ์ถํ์ ์ ์ง๋ณด์ ๋ ์์๋ณด๊ธฐ ์ฝ๊ฒํ๋๊ฒ์ด ์ข์ ๋ฏํฉ๋๋ค ~ |
@@ -21,3 +21,25 @@ extension UICollectionViewCell {
NSStringFromClass(self.classForCoder()).components(separatedBy: ".").last!
}
}
+
+extension UIImage {
+
+ func applyBlur_usingClamp(radius: CGFloat) -> UIImage {
+ let context = CIContext()
+ guard let ciImage = CIImage(image: self),
+... | Swift | Swift๋ ์นด๋ฉ์ผ์ด์ค ~ ๐ซ |
@@ -21,3 +21,25 @@ extension UICollectionViewCell {
NSStringFromClass(self.classForCoder()).components(separatedBy: ".").last!
}
}
+
+extension UIImage {
+
+ func applyBlur_usingClamp(radius: CGFloat) -> UIImage {
+ let context = CIContext()
+ guard let ciImage = CIImage(image: self),
+... | Swift | ๊ณ์ extension์ด ๋์ด๋ ์์ ์ด๋ผ๋ฉด UIImage+.swift ๋ก ๋ณ๋๋ก ๋นผ๋ฉด์ด๋จ๊น์ฅ |
@@ -20,27 +20,106 @@ class FeedCollectionViewCell: UICollectionViewCell {
return stackView
}()
- // ์๋จ
+ // UpperBar
private let feedUpperBar: UIStackView = {
let stackView = UIStackView()
stackView.axis = .horizontal
stackView.distribution = .fill
... | Swift | ```suggestion
private let feedUpperBarStackView: UIStackView = {
```
class๊ฐ StackView์ธ๊ฑด ๋ฐ๋ก ์์๋ณด๋ฉด ์ฝ๊ธฐ ํธํ ๊ฑฐ๊ฐ์์ฉ |
@@ -20,27 +20,106 @@ class FeedCollectionViewCell: UICollectionViewCell {
return stackView
}()
- // ์๋จ
+ // UpperBar
private let feedUpperBar: UIStackView = {
let stackView = UIStackView()
stackView.axis = .horizontal
stackView.distribution = .fill
... | Swift | ```suggestion
```
์ฌ์ฉํ์ง ์๊ฒ๋์๋ค๋ฉด ์ญ์ |
@@ -20,27 +20,106 @@ class FeedCollectionViewCell: UICollectionViewCell {
return stackView
}()
- // ์๋จ
+ // UpperBar
private let feedUpperBar: UIStackView = {
let stackView = UIStackView()
stackView.axis = .horizontal
stackView.distribution = .fill
... | Swift | ์ฌ๊ธฐ์ ํ์ค์ฉ ๋ฃ๋๊ฑด ์ฐ๋๋ง์ ์คํ์ผ์ธ๊ฑด๊ฐ์?
๊ทธ์ ๊ถ๊ธ์ฐ |
@@ -20,27 +20,106 @@ class FeedCollectionViewCell: UICollectionViewCell {
return stackView
}()
- // ์๋จ
+ // UpperBar
private let feedUpperBar: UIStackView = {
let stackView = UIStackView()
stackView.axis = .horizontal
stackView.distribution = .fill
... | Swift | property์ด๋ฆ๊ณผ ์ฃผ์์ด ๊ฐ๋ค๋ฉด ๊ฐ ์ฃผ์์ด ์ฌ๋ผ์ ธ๋ ๋์ง ์์๊น์ ..? |
@@ -10,11 +10,11 @@ import UIKit
class HomeViewController: UIViewController {
private var feeds: [Feed] = [
- Feed(username: "Woody", profileImage: "profileImage", title: "์ฐ๋ญ๋จน๋ค ๋ฐ์ ์๊ฐ", hashTags: [HashTag(hashTag: "#Guitar"), HashTag(hashTag: "#Jazz")]),
- Feed(username: "Woody", profileImage: ... | Swift | ์๋ฏธ๋ ์์๋๋ค.. ๋์ผ๋ก ๋๊ฐ height ์์ต๋๋ค let์ผ๋ก ๋ณ์ ์ ์ธํ๋๊ฒ์ ํด๋น func ๋ด๋ถ์ ์ ์ธํ๋ ๊ฒ์ด ์ข๊ฒ ์ฃ ? |
@@ -20,27 +20,106 @@ class FeedCollectionViewCell: UICollectionViewCell {
return stackView
}()
- // ์๋จ
+ // UpperBar
private let feedUpperBar: UIStackView = {
let stackView = UIStackView()
stackView.axis = .horizontal
stackView.distribution = .fill
... | Swift | ์์ ์ฃผ์ ๋ง์์ด์ ๊ฐ์? |
@@ -20,27 +20,106 @@ class FeedCollectionViewCell: UICollectionViewCell {
return stackView
}()
- // ์๋จ
+ // UpperBar
private let feedUpperBar: UIStackView = {
let stackView = UIStackView()
stackView.axis = .horizontal
stackView.distribution = .fill
... | Swift | ์ฃผ์์ ์ ์๊ฒ ์ผ์ข
์ ์์ญ ํ์์ ๊ฐ์ต๋๋ค
๊ตณ์ด ์กด์ฌํ์ง ์์๋ ๋ ์๋ ์์ง๋ง ์ฌ๊ธฐ ๋ญ๊ฐ๊ฐ ์๋ค๋ผ๋ ๋๋์ ์ธ ๋๋์ด๋๊น์ |
@@ -20,27 +20,106 @@ class FeedCollectionViewCell: UICollectionViewCell {
return stackView
}()
- // ์๋จ
+ // UpperBar
private let feedUpperBar: UIStackView = {
let stackView = UIStackView()
stackView.axis = .horizontal
stackView.distribution = .fill
... | Swift | ํค์๋๋ฅผ ์ฌ๋ฌ๊ฐ ๋ถ์ฌ๋ ๋๋๊ตฐ์? ์๊ฐ๋ ์ํด๋ดค์ต๋๋ค |
@@ -10,11 +10,11 @@ import UIKit
class HomeViewController: UIViewController {
private var feeds: [Feed] = [
- Feed(username: "Woody", profileImage: "profileImage", title: "์ฐ๋ญ๋จน๋ค ๋ฐ์ ์๊ฐ", hashTags: [HashTag(hashTag: "#Guitar"), HashTag(hashTag: "#Jazz")]),
- Feed(username: "Woody", profileImage: ... | Swift | > ๋์ผ๋ก ๋๊ฐ height ์์ต๋๋ค
๐ค ..?????
> let์ผ๋ก ๋ณ์ ์ ์ธํ๋๊ฒ์ ํด๋น func ๋ด๋ถ์ ์ ์ธํ๋ ๊ฒ์ด ์ข๊ฒ ์ฃ ?
๋ฌผ๋ก ์ด์ฃ ! |
@@ -20,27 +20,106 @@ class FeedCollectionViewCell: UICollectionViewCell {
return stackView
}()
- // ์๋จ
+ // UpperBar
private let feedUpperBar: UIStackView = {
let stackView = UIStackView()
stackView.axis = .horizontal
stackView.distribution = .fill
... | Swift | L60๊ณผ ๊ฐ์ ๊ฐํ ์ด์ผ๊ธฐ๋๋ฆฐ๊ฑฐ์์ด์ ! |
@@ -20,27 +20,106 @@ class FeedCollectionViewCell: UICollectionViewCell {
return stackView
}()
- // ์๋จ
+ // UpperBar
private let feedUpperBar: UIStackView = {
let stackView = UIStackView()
stackView.axis = .horizontal
stackView.distribution = .fill
... | Swift | ๊ฐ์ธ์ ์ธ ์คํ์ผ์ด๋ค์ ! ๐ |
@@ -0,0 +1,29 @@
+import ItemCard from "@/components/ItemCard";
+import styled from "styled-components";
+import { flexCenter } from "@/styles/common";
+import { Product } from "@/types/products";
+import SeaOtterVideo from "@/components/SeaOtterVideo";
+
+const ItemCardList = ({ products, isLoading }: { products: Prod... | Unknown | ์ฌ๊ธฐ์ product.id ๊ฐ key ๊ฐ์ด ์๋๋ผ Math.random ์ผ๋ก ์ฃผ์ ์ด์ ๊ฐ ๋ฐ๋ก ์์ผ์ค๊น์ฉ ?? |
@@ -0,0 +1,15 @@
+import * as S from "@/components/Header/style";
+
+export const HeaderMain = ({ children }: React.PropsWithChildren) => {
+ return <S.Header>{children}</S.Header>;
+};
+
+export const Title = ({ text }: { text: string }) => {
+ return <S.Title>{text}</S.Title>;
+};
+
+const Header = Object.assign(He... | Unknown | ๋๋ฌด ์ข์์~! |
@@ -0,0 +1,29 @@
+import ItemCard from "@/components/ItemCard";
+import styled from "styled-components";
+import { flexCenter } from "@/styles/common";
+import { Product } from "@/types/products";
+import SeaOtterVideo from "@/components/SeaOtterVideo";
+
+const ItemCardList = ({ products, isLoading }: { products: Prod... | Unknown | ์๋ฒ์์ ๊ฐํ์ ์ผ๋ก ์ค๋ณต๋ key ๋ฅผ ๋ฐํํ๋ ๋ฌธ์ ๊ฐ ์์ด์ ํ ๋ฒ์ฉ ๋์ผํ key ๊ฐ์ผ๋ก ์๋ฌ๊ฐ ๋ฐ์ํ๊ธฐ์ random ๊ฐ์ key ๋ก ์ค์ ํด์คฌ์ด์! |
@@ -0,0 +1,45 @@
+package calculator.model;
+
+import java.util.HashMap;
+import java.util.Map;
+import java.util.function.BiFunction;
+
+public enum OperatorType {
+ ADDITION("+", (a, b) -> a + b),
+ SUBTRACTION("-", (a, b) -> a - b),
+ MULTIPLICATION("*", (a, b) -> a * b),
+ DIVISION("/", (a, b) -> {
+ ... | Java | ์ด๋ ๊ฒ ๋ฌธ์์ด์ ๋ฆฌํดํด์ค ํ์๊ฐ ์์๊น์? |
@@ -0,0 +1,17 @@
+package calculator.model;
+
+public class Operator {
+
+ public int calculate(String[] values) {
+ int result = Integer.parseInt(values[0]);
+
+ for (int i = 1; i < values.length; i += 2) {
+ String symbol = values[i];
+ int nextNumber = Integer.parseInt(values[i... | Java | Enum ์ฌ์ฉ๋ฒ์ ๋ค์ ๊ณต๋ถํด์ ์ ์ฉํด๋ด
์๋ค. Switch๋ฌธ์ ์ฌ์ฉํ์ง ์๋ ๋ฐฉ์์ผ๋ก์. |
@@ -0,0 +1,11 @@
+package calculator.view;
+
+import java.util.Scanner;
+
+public class InputView {
+ public String formulaInput() {
+ Scanner scanner = new Scanner(System.in);
+ System.out.print("์์์ ์
๋ ฅํ์ธ์ : ");
+ return scanner.nextLine();
+ }
+}
\ No newline at end of file | Java | ํด๋์ค์ ์ญํ ์ด ๋ ๊ฐ์ง ์กด์ฌํฉ๋๋ค
1. ๋ฌธ์์ด์ ๋ฐ๋๋ค
2. ๋ฌธ์์ด์ ๋๋๋ค
ํด๋์ค์ ์ฑ
์๊ณผ ์ญํ ์ ๋ํด์ ์๊ฐํด๋ด
์๋ค |
@@ -0,0 +1,27 @@
+package calculator.controller;
+
+import calculator.model.Operator;
+import calculator.util.FormulaParser;
+import calculator.view.InputView;
+import calculator.view.OutputView;
+
+public class CalculatorController {
+ private final Operator operator;
+ private final InputView inputView;
+ pr... | Java | ์ด ๋ณ์๊ฐ ์ด๋ค ์ญํ ์ ํ๋ ๋ณ์์ธ์ง ๋ณ์๋ช
๋ง ๋ณด๊ณ ์ ์ ์๊ฒ ๋ง๋ค์ด์ฃผ์ธ์ |
@@ -0,0 +1,17 @@
+package calculator.model;
+
+public class Operator {
+
+ public int calculate(String[] values) {
+ int result = Integer.parseInt(values[0]);
+
+ for (int i = 1; i < values.length; i += 2) {
+ String symbol = values[i];
+ int nextNumber = Integer.parseInt(values[i... | Java | ์ด๋ ๊ฒ ํด์ค ๊ฑฐ๋ฉด ํ๋์์ ์ง์ ์ ์ผ๋ก ์ ์ธํด์ฃผ๋ ๊ฒ์ด ๋ ๊น๋ํฉ๋๋ค |
@@ -0,0 +1,45 @@
+package calculator.model;
+
+import java.util.HashMap;
+import java.util.Map;
+import java.util.function.BiFunction;
+
+public enum OperatorType {
+ ADDITION("+", (a, b) -> a + b),
+ SUBTRACTION("-", (a, b) -> a - b),
+ MULTIPLICATION("*", (a, b) -> a * b),
+ DIVISION("/", (a, b) -> {
+ ... | Java | ์ด ๋ฉ์๋๊ฐ static ๋ฉ์๋์ฌ์ผ๋ง ํ๋ ์ด์ ๊ฐ ์๋์? |
@@ -0,0 +1,11 @@
+package calculator.view;
+
+import java.util.Scanner;
+
+public class InputView {
+ public String formulaInput() {
+ Scanner scanner = new Scanner(System.in);
+ System.out.print("์์์ ์
๋ ฅํ์ธ์ : ");
+ return scanner.nextLine();
+ }
+}
\ No newline at end of file | Java | FormulaParser ํด๋์ค์ ๋ฌธ์์ด์ ๋๋๋ ์ญํ ์ ๋ถํ ํ์ต๋๋ค. |
@@ -0,0 +1,27 @@
+package calculator.controller;
+
+import calculator.model.Operator;
+import calculator.util.FormulaParser;
+import calculator.view.InputView;
+import calculator.view.OutputView;
+
+public class CalculatorController {
+ private final Operator operator;
+ private final InputView inputView;
+ pr... | Java | calculatorRun์ผ๋ก ์์ ํ์ต๋๋ค. |
@@ -0,0 +1,45 @@
+package calculator.model;
+
+import java.util.HashMap;
+import java.util.Map;
+import java.util.function.BiFunction;
+
+public enum OperatorType {
+ ADDITION("+", (a, b) -> a + b),
+ SUBTRACTION("-", (a, b) -> a - b),
+ MULTIPLICATION("*", (a, b) -> a * b),
+ DIVISION("/", (a, b) -> {
+ ... | Java | ์ง์ ๋ ์ฐ์ฐ์๋ฅผ ์ ์ธํ ๋ค๋ฅธ ๊ธฐํธ๋ฅผ ์
๋ ฅํ์ ๊ฒฝ์ฐ์ ์ถ๋ ฅํ๋๋ก ํ์ง๋ง
๊ณ์ฐ๊ธฐ์ ๊ฒฝ์ฐ ๋ฐ๋ก ์์ด๋ ๋ ๊ฒ ๊ฐ์ต๋๋ค. |
@@ -0,0 +1,17 @@
+package calculator.model;
+
+public class Operator {
+
+ public int calculate(String[] values) {
+ int result = Integer.parseInt(values[0]);
+
+ for (int i = 1; i < values.length; i += 2) {
+ String symbol = values[i];
+ int nextNumber = Integer.parseInt(values[i... | Java | OperatorType์ ๊ธฐ๋ฅ์ ์์ ํ๋ฉด์ Operator์ ๊ธฐ๋ฅ๊ณผ ์ค๋ณต๋๊ธฐ์ ์ญ์ ํ์ต๋๋ค. |
@@ -0,0 +1,45 @@
+package calculator.model;
+
+import java.util.HashMap;
+import java.util.Map;
+import java.util.function.BiFunction;
+
+public enum OperatorType {
+ ADDITION("+", (a, b) -> a + b),
+ SUBTRACTION("-", (a, b) -> a - b),
+ MULTIPLICATION("*", (a, b) -> a * b),
+ DIVISION("/", (a, b) -> {
+ ... | Java | ๊ฐ์ฒด๋ฅผ ๋ณ๊ฒฝํ์ง ์์์ ์ธ์คํด์ค๋ฅผ ์์ฑํ์ง ์์๋ ๋๋ค๊ณ ์๊ฐํ๊ณ
static๋ฉ์๋๋ก ์ ์ธํ๋ฉด ์ธ์คํด์ค ์์ฑ์์ด ํธ์ถ ํ ์ ์์ด์ ์ฌ์ฉํ์ต๋๋ค. |
@@ -0,0 +1,17 @@
+package calculator.model;
+
+public class Operator {
+
+ public int calculate(String[] values) {
+ int result = Integer.parseInt(values[0]);
+
+ for (int i = 1; i < values.length; i += 2) {
+ String symbol = values[i];
+ int nextNumber = Integer.parseInt(values[i... | Java | BiFunction ํ๋๋ฅผ ํ์ฉํ์ฌ Switch๋ฌธ ์์ด ์ฐ์ฐ์ ์ฒ๋ฆฌ ํ ์ ์๊ฒ ์์ ํ์ต๋๋ค. |
@@ -0,0 +1,27 @@
+package calculator.controller;
+
+import calculator.model.Operator;
+import calculator.util.FormulaParser;
+import calculator.view.InputView;
+import calculator.view.OutputView;
+
+public class CalculatorController {
+ private final Operator operator;
+ private final InputView inputView;
+ pr... | Java | values๋ ์ด๋ค ์ฉ๋๋ก ์ฌ์ฉ๋๋ ๋ณ์์ธ๊ฐ์ |
@@ -0,0 +1,17 @@
+package calculator.model;
+
+public class Operator {
+
+ public int calculate(String[] values) {
+ int result = Integer.parseInt(values[0]);
+
+ for (int i = 1; i < values.length; i += 2) {
+ String symbol = values[i];
+ int nextNumber = Integer.parseInt(values[i... | Java | ์ด๋ค ๋งค๊ฐ๋ณ์๋ฅผ ๋ฐ์์ค๋ ๊ฑด๊ฐ์.
๋งค๊ฐ๋ณ์๊ฐ ๋ฉ์๋ ๋ด์์ ์ด๋ค ์ญํ ์ ํ๋์ง ์ ์ ์๋๋ก ์ง์ด์ฃผ์ธ์ |
@@ -0,0 +1,17 @@
+package calculator.model;
+
+public class Operator {
+
+ public int calculate(String[] values) {
+ int result = Integer.parseInt(values[0]);
+
+ for (int i = 1; i < values.length; i += 2) {
+ String symbol = values[i];
+ int nextNumber = Integer.parseInt(values[i... | Java | static ๋ฉ์๋๋ฅผ ์ฌ์ฉํด์ผํ ์ด์ ๊ฐ ์์๊น์? |
@@ -0,0 +1,45 @@
+package calculator.model;
+
+import java.util.HashMap;
+import java.util.Map;
+import java.util.function.BiFunction;
+
+public enum OperatorType {
+ ADDITION("+", (a, b) -> a + b),
+ SUBTRACTION("-", (a, b) -> a - b),
+ MULTIPLICATION("*", (a, b) -> a * b),
+ DIVISION("/", (a, b) -> {
+ ... | Java | ์ด๊ฑธ ํ๋๋ก ์ ์ธํ ์ด์ ๊ฐ ์์๊น์?
๋ฐ์ดํฐ ์ฃผ๋ ์ค๊ณ๊ฐ ์๋ ๋๋ฉ์ธ ์ฃผ๋ ์ค๊ณ๋ฅผ ๊ณต๋ถํด๋ณด์ธ |
@@ -0,0 +1,17 @@
+package calculator.model;
+
+public class Operator {
+
+ public int calculate(String[] values) {
+ int result = Integer.parseInt(values[0]);
+
+ for (int i = 1; i < values.length; i += 2) {
+ String symbol = values[i];
+ int nextNumber = Integer.parseInt(values[i... | Java | ํ์ฌ ํธ์ฌํ ์ฝ๋์ ์กด์ฌํ์ง ์๋ ์ฝ๋์
๋๋ค. |
@@ -0,0 +1,17 @@
+package calculator.model;
+
+public class Operator {
+
+ public int calculate(String[] values) {
+ int result = Integer.parseInt(values[0]);
+
+ for (int i = 1; i < values.length; i += 2) {
+ String symbol = values[i];
+ int nextNumber = Integer.parseInt(values[i... | Java | values ๋งํ ๊ฑฐ์์ |
@@ -0,0 +1,172 @@
+package store.domain;
+
+import static store.constants.NumberConstants.FREEBIE_QUANTITY;
+
+import java.util.List;
+import store.dto.BuyGetQuantity;
+import store.dto.PromotionInfo;
+import store.io.InputView;
+
+public class PromotionManager {
+
+ private final List<PromotionInfo> promotionInfos;... | Java | ๋๋ฉ์ธ์์ view์ ์์กดํ๋ ํํ๋ฅผ ๋๊ณ ์์ต๋๋ค.
์ฌ์ฉ์ ์
๋ ฅ ์ฒ๋ฆฌ์ ๋ํ ๋ถ๋ถ์ `MembershipManager` ์ฒ๋ผ ์ปจํธ๋กค๋ฌ๋ก ๊บผ๋ด์ด ์ฒ๋ฆฌํ๋ ๊ฒ์ ์ด๋จ๊น์? |
@@ -0,0 +1,88 @@
+package store.controller;
+
+import static store.constants.InputMessages.PRODUCTS_FILE_NAME;
+import static store.constants.InputMessages.PROMOTIONS_FILE_NAME;
+
+import java.util.List;
+import store.config.IoConfig;
+import store.domain.Choice;
+import store.domain.MembershipManager;
+import store.do... | Java | ์ด ๋ฉ์๋์์, ๊ตฌ๋งคํ ์ํ๊ณผ ์๋์ ๋ฐ์, Receipt๋ฅผ ๋ง๋๋๋ฐ
์ด ๊ณผ์ ์์, ํ๋ก๋ชจ์
์ ๋ํ ๊ธฐ๋ฅ๋ค์ ์ฒ๋ฆฌํ๊ณ ์์ต๋๋ค.
์ด๋ฅผ ๋ถ๋ฆฌํ๋ฉด ์ด๋จ๊น์?
์ฌ์ฉ์๊ฐ ๊ตฌ๋งคํ ์ํ๊ณผ ์๋์ ๋ฐ์ ์ ์ฅํ๊ณ , ์ด ์ ์ฅ๋ ์ ๋ณด๋ฅผ ๋ฐํ์ผ๋ก ํ๋ก๋ชจ์
์ ์ ์ฉํ๋ ์์๋ก์!
์ด๋ ๊ฒ ํ๋ฉด, ํ๋ก๋ชจ์
์์ธ์ฌํญ์ ๋ํ ์ฌ์ฉ์ ์
๋ ฅ์ ์ปจํธ๋กค๋ฌ๋ก ๋บ ์ ์์ ๊ฒ ๊ฐ์ต๋๋ค:) |
@@ -0,0 +1,23 @@
+package store.constants;
+
+import static store.constants.StringConstants.NEW_LINE;
+import static store.constants.StringConstants.ONE_SPACE;
+import static store.constants.StringConstants.TAP;
+
+public class OutputMessages {
+ public static String WELCOME_MESSAGE = "์๋
ํ์ธ์. Wํธ์์ ์
๋๋ค." + NEW_LINE + ... | Java | ์ด๋ ๊ฒ ์์ ํ๋์ฝ๋ฉ ๋ฌธ์์ด ๊ฐ์ ๊ฒฝ์ฐ์ ๋ํด์ ํ๊ณผ ์ ๋ฐฐ๋๊ป ๋ฌผ์ด๋ดค๋๋ฐ, ์ด๋ฐ ์์ ๋ถ๋ถ(๋ฌธ์์ด์ ์กฐ๋ฆฝํด์ผํ๋ ๋ถ๋ถ)์ ๋ง์ง ์์ผ๋ฉด ํด๋์ค ๋ด์์ ์ ์ธํ๊ณ ์ด๋ค๋ ์๊ฒฌ์ ๋ค์์ต๋๋ค! |
@@ -0,0 +1,88 @@
+package store.controller;
+
+import static store.constants.InputMessages.PRODUCTS_FILE_NAME;
+import static store.constants.InputMessages.PROMOTIONS_FILE_NAME;
+
+import java.util.List;
+import store.config.IoConfig;
+import store.domain.Choice;
+import store.domain.MembershipManager;
+import store.do... | Java | ๋์ํฉ๋๋ค! |
@@ -0,0 +1,172 @@
+package store.domain;
+
+import static store.constants.NumberConstants.FREEBIE_QUANTITY;
+
+import java.util.List;
+import store.dto.BuyGetQuantity;
+import store.dto.PromotionInfo;
+import store.io.InputView;
+
+public class PromotionManager {
+
+ private final List<PromotionInfo> promotionInfos;... | Java | ๋๋ฉ์ธํด๋์ค์ ์ฃผ์์ฑ
์์ '๋๋ฉ์ธ์ ์ ํํํด๋ด๋ ๊ฒ'์ด๋ผ๊ณ ์๊ฐํฉ๋๋ค. ํด๋น ๋๋ฉ์ธ ํด๋์ค๋ ๋ง์ ๋น์ฆ๋์ค ๋ก์ง์ ํฌํจํ๊ณ ์์ผ๋ฏ๋ก, ๋จ์ผ์ฑ
์์์น์ด ์๋ฐฐ๋ ๊ฒ ๊ฐ์ต๋๋ค! ์๋น์ค๊ณ์ธต์ ๋์
ํ๊ฑฐ๋ ์ฑ
์์ ๋ถ๋ฆฌํด๋ณด๋๊ฑด ์ด๋จ๊น์? |
@@ -0,0 +1,15 @@
+package store.constants;
+
+public class StringConstants {
+ public static final String COMMA = ",";
+ public static final String DASH = "-";
+ public static final String NEW_LINE = "\n";
+ public static final String TAP = "\t";
+ public static final String OPEN_SQUARE_BRACKETS = "[";
+... | Java | ๊ผผ๊ผผํ ์์ ์ฒ๋ฆฌ! ๋ณผ ๋๋ง๋ค ๊ฐํ์ ์์๋
๋๋ค! |
@@ -0,0 +1,88 @@
+package store.controller;
+
+import static store.constants.InputMessages.PRODUCTS_FILE_NAME;
+import static store.constants.InputMessages.PROMOTIONS_FILE_NAME;
+
+import java.util.List;
+import store.config.IoConfig;
+import store.domain.Choice;
+import store.domain.MembershipManager;
+import store.do... | Java | ์๋ฌ ๋ฉ์์ง ์ถ๋ ฅ ๋ถ๋ถ๋ OutputView ๋ก ๋นผ์ฃผ์๋ฉด ์ข์ ๊ฒ ๊ฐ์ต๋๋ค! |
@@ -0,0 +1,172 @@
+package store.domain;
+
+import static store.constants.NumberConstants.FREEBIE_QUANTITY;
+
+import java.util.List;
+import store.dto.BuyGetQuantity;
+import store.dto.PromotionInfo;
+import store.io.InputView;
+
+public class PromotionManager {
+
+ private final List<PromotionInfo> promotionInfos;... | Java | setQuantity์ setPromotionPeriods ๋ฉ์๋๊ฐ ์ ์ ๋ฉ์๋๋ก ๋ณด์ด๋๋ฐ ์ ์ ๋ฉ์๋๋ ์ํ ๋ณ๊ฒฝ์ ์ฌ์ฉ๋๋ฉด ๊ฐ์ฒด์งํฅ์์น์ ๋ง์ง ์์ ์ ์ข๋ค๊ณ ์๊ณ ์์ต๋๋ค Promotion ๊ฐ์ฒด๋ฅผ ์ธ์คํด์คํํ์ฌ ๊ด๋ฆฌํ๋ ๊ฒ์ด ์ข์ ๊ฒ ๊ฐ์์! |
@@ -0,0 +1,172 @@
+package store.domain;
+
+import static store.constants.NumberConstants.FREEBIE_QUANTITY;
+
+import java.util.List;
+import store.dto.BuyGetQuantity;
+import store.dto.PromotionInfo;
+import store.io.InputView;
+
+public class PromotionManager {
+
+ private final List<PromotionInfo> promotionInfos;... | Java | ๋๋ฉ์ธ์์ ๋ทฐ์ ์์กดํ๋ ํํ๋ ์ข์ง ์์ ๊ฒ ๊ฐ์ต๋๋ค! |
@@ -0,0 +1,60 @@
+package store.domain;
+
+import static camp.nextstep.edu.missionutils.DateTimes.now;
+
+import java.time.LocalDateTime;
+
+public enum Promotion {
+
+ NULL(""),
+ SPARKLING_BUY_TWO_GET_ONE_FREE("ํ์ฐ2+1"),
+ MD_RECOMMENDATION("MD์ถ์ฒ์ํ"),
+ FLASH_SALE("๋ฐ์งํ ์ธ");
+
+ private final String promo... | Java | ์ ๋ ํ๋ก๋ชจ์
์ด ๋์ ์ผ๋ก ๊ฐ์ด ๋ฐ๋ ์ ์๋ค๋ ์กฐ๊ฑด ๋๋ฌธ์ ํ๋ก๋ชจ์
๊ฐ์ด ๋ฐ๋๋ค๋ฉด ์ฝ๋๋ฅผ ์น ๋ค ๋ฐ๊ฟ์ค์ผ ํด์ enum์๋ ๋ง์ง ์๋ค๊ณ ์๊ฐํ์ต๋๋ค ์ง์ฐ๋์ ์ด๋ป๊ฒ ์๊ฐํ์๋์? |
@@ -0,0 +1,48 @@
+package store.domain;
+
+import static store.constants.NumberConstants.SINGLE_PRODUCT_QUANTITY;
+
+import java.util.ArrayList;
+import java.util.List;
+import store.exception.ProductNotExistException;
+
+public class StoreHouse {
+
+ private final List<Product> productList = new ArrayList<>();
+
+
... | Java | ์ด๋ฆ์ผ๋ก product๋ฅผ ์ฐพ์๊ฑฐ๋ผ๋ฉด List<Product>๋ณด๋ค Map<String, Product>๋ ์ด๋จ๊น์? |
@@ -0,0 +1,172 @@
+package store.domain;
+
+import static store.constants.NumberConstants.FREEBIE_QUANTITY;
+
+import java.util.List;
+import store.dto.BuyGetQuantity;
+import store.dto.PromotionInfo;
+import store.io.InputView;
+
+public class PromotionManager {
+
+ private final List<PromotionInfo> promotionInfos;... | Java | ๋์ํฉ๋๋ค |
@@ -0,0 +1,88 @@
+package store.controller;
+
+import static store.constants.InputMessages.PRODUCTS_FILE_NAME;
+import static store.constants.InputMessages.PROMOTIONS_FILE_NAME;
+
+import java.util.List;
+import store.config.IoConfig;
+import store.domain.Choice;
+import store.domain.MembershipManager;
+import store.do... | Java | ๋์ํฉ๋๋ค! |
@@ -0,0 +1,115 @@
+package store.io;
+
+import static store.constants.InputMessages.ADDITIONAL_PURCHASE_MESSAGE;
+import static store.constants.InputMessages.FREEBIE_ADDITION_MESSAGE;
+import static store.constants.InputMessages.INPUT_PRODUCT_NAME_AND_QUANTITY;
+import static store.constants.InputMessages.MEMBERSHIP_DI... | Java | inputView๋ ์ฌ์ฉ์๋ก๋ถํฐ ์
๋ ฅ์ ๋ฐ๋ UI ์ญํ ๋ก, ํ์ผ์ ์ฝ๊ณ ๋ฐ์ดํฐ๋ฅผ ์ฒ๋ฆฌํ๋ ๊ณผ์ ์ parser๋ก ๋นผ์ฃผ์๋ฉด ์ข์ ๊ฒ ๊ฐ์ต๋๋ค! (ํ์ผ ์ฝ๊ธฐ๋ FileReader๋ก, ํด๋น ํ์ผ์ ๋ฐ์ดํฐ ์ฒ๋ฆฌ๋ parser๋ก!)
์๋๋ฉด setup service๋ฅผ ๋ง๋ค์ด์ ๊ทธ๊ณณ์์ setup์ ์งํํ๊ณ controller์์ ๋ถ๋ฌ์ค๋ ๊ฒ๋ ์ข์ ๊ฒ ๊ฐ์ต๋๋ค!
๊ทธ๋ฆฌ๊ณ ํ์ผ ์ฝ๊ธฐ ๊ธฐ๋ฅ์ ์ค ๋จ์๋ก ์ฝ์ด์ ์ฒ๋ฆฌํ๋ ๊ฒ๋ ์ข์ ๋ฐฉ๋ฒ์ด์ง๋ง, readAllLines (์ง์ฐ๋๊ป์ ๋ฆฌ๋ทฐ ํด์ฃผ์
จ๋!) ๋ฉ์๋๋ฅผ ์ฌ์ฉํ๋ฉด ํ๋ฒ์ ์ฝ์ด์์ ์ฝ๋๋ฅผ ์ฝ์ด์ค๋ ๋ถ๋ถ์ ๋จ์ถ ์ํฌ ์ ์๋ต๋๋ค! |
@@ -0,0 +1,115 @@
+package store.io;
+
+import static store.constants.InputMessages.ADDITIONAL_PURCHASE_MESSAGE;
+import static store.constants.InputMessages.FREEBIE_ADDITION_MESSAGE;
+import static store.constants.InputMessages.INPUT_PRODUCT_NAME_AND_QUANTITY;
+import static store.constants.InputMessages.MEMBERSHIP_DI... | Java | ์ถ๊ฐ๋ก validator์ empty input์ ๊ฒ์ฌํ๋ ๋ฉ์๋์ ๊ฒฝ์ฐ, parser์ ํฌํจ ์ํค๋ ๊ฒ์ด ์ด๋จ๊น์?
parser๋ ์
๋ ฅ ๊ฐ์ ํด์ํ๊ณ , ์ ์ ํ ํ์์ผ๋ก ๋ณํํ๋ ์ฑ
์์ ๊ฐ์ง๋ฏ๋ก ์
๋ ฅ ๊ฐ์ ์ ํจ์ฑ ๊ฒ์ฌ๋ฅผ ํ๋ ๊ฒ๋ ๊ทธ ์ฑ
์์ ๋ง๋ค๊ณ ์๊ฐํฉ๋๋ค! |
@@ -0,0 +1,88 @@
+package store.controller;
+
+import static store.constants.InputMessages.PRODUCTS_FILE_NAME;
+import static store.constants.InputMessages.PROMOTIONS_FILE_NAME;
+
+import java.util.List;
+import store.config.IoConfig;
+import store.domain.Choice;
+import store.domain.MembershipManager;
+import store.do... | Java | ๋์ํฉ๋๋ค! |
@@ -0,0 +1,172 @@
+package store.domain;
+
+import static store.constants.NumberConstants.FREEBIE_QUANTITY;
+
+import java.util.List;
+import store.dto.BuyGetQuantity;
+import store.dto.PromotionInfo;
+import store.io.InputView;
+
+public class PromotionManager {
+
+ private final List<PromotionInfo> promotionInfos;... | Java | ๋์ํฉ๋๋ค! |
@@ -0,0 +1,23 @@
+package store.constants;
+
+import static store.constants.StringConstants.NEW_LINE;
+import static store.constants.StringConstants.ONE_SPACE;
+import static store.constants.StringConstants.TAP;
+
+public class OutputMessages {
+ public static String WELCOME_MESSAGE = "์๋
ํ์ธ์. Wํธ์์ ์
๋๋ค." + NEW_LINE + ... | Java | ์ค ๊ทธ๋ ๊ตฐ์. ์ฐธ๊ณ ํ๊ฒ ์ต๋๋ค! |
@@ -0,0 +1,15 @@
+package store.constants;
+
+public class StringConstants {
+ public static final String COMMA = ",";
+ public static final String DASH = "-";
+ public static final String NEW_LINE = "\n";
+ public static final String TAP = "\t";
+ public static final String OPEN_SQUARE_BRACKETS = "[";
+... | Java | ์นญ์ฐฌ,,, ๊ฐ์ฌํฉ๋๋ค ๐ฅน |
@@ -0,0 +1,88 @@
+package store.controller;
+
+import static store.constants.InputMessages.PRODUCTS_FILE_NAME;
+import static store.constants.InputMessages.PROMOTIONS_FILE_NAME;
+
+import java.util.List;
+import store.config.IoConfig;
+import store.domain.Choice;
+import store.domain.MembershipManager;
+import store.do... | Java | ๋์น ๋ถ๋ถ ์ง์ด์ฃผ์
์ ๊ฐ์ฌํฉ๋๋ค :) |
@@ -0,0 +1,88 @@
+package store.controller;
+
+import static store.constants.InputMessages.PRODUCTS_FILE_NAME;
+import static store.constants.InputMessages.PROMOTIONS_FILE_NAME;
+
+import java.util.List;
+import store.config.IoConfig;
+import store.domain.Choice;
+import store.domain.MembershipManager;
+import store.do... | Java | ์ข์ ์๊ฒฌ ๊ฐ์ฌํฉ๋๋ค.
์ฌ์ฉ์๋ก๋ถํฐ ์
๋ ฅ์ ๋ฐ๊ณ ํ๋ฒ์ ๋ชจ๋ ๊ฑธ ์ฒ๋ฆฌํ๋ ค๊ณ ํ๋ ๊ฒ ์ค์์๋ค์.. ์ฑ
์ ๋ถ๋ฆฌ๊ฐ ๋ถ์กฑํ๋ ๊ฒ ๊ฐ์ต๋๋ค.
๋ฆฌํฉํ ๋ง์ ์ ์ฉํด ๋ณด๋๋ก ํ๊ฒ ์ต๋๋ค :) |
@@ -0,0 +1,60 @@
+package store.domain;
+
+import static camp.nextstep.edu.missionutils.DateTimes.now;
+
+import java.time.LocalDateTime;
+
+public enum Promotion {
+
+ NULL(""),
+ SPARKLING_BUY_TWO_GET_ONE_FREE("ํ์ฐ2+1"),
+ MD_RECOMMENDATION("MD์ถ์ฒ์ํ"),
+ FLASH_SALE("๋ฐ์งํ ์ธ");
+
+ private final String promo... | Java | ์ข์ ์๊ฒฌ ๊ฐ์ฌํฉ๋๋ค.
@slay1379๋ ๋ฆฌ๋ทฐ์๋ ์งง๊ฒ ์์ฑํ๊ธด ํ์ง๋ง ์ถ๊ฐ๋ก ๋ง์๋๋ฆฌ์๋ฉด
ํ์ฌ null์ ์ ์ธํ๊ณ ๋ ์ฝ๋์์ ์ง์ ์ฌ์ฉํ๋ ๋ถ๋ถ์ด ์์ง๋ง, ๋ณ๋ ๊ฐ๋ฅ์ฑ์ด ๋๊ธฐ ๋๋ฌธ์ ๋ฌธ์์ด ํ์
์ผ๋ก ๊ด๋ฆฌํ๋ ํธ์ด ๋ ์ข์ ๊ฒ ๊ฐ์ต๋๋ค. (๋ผ๊ณ ์์ฑํ๊ณ ๋ค์ ์๊ฐํด๋ณด๋ ํ
์คํธ ์ฝ๋๊ฐ ์์๋ค์...! ^^;; ํํ) |
@@ -0,0 +1,172 @@
+package store.domain;
+
+import static store.constants.NumberConstants.FREEBIE_QUANTITY;
+
+import java.util.List;
+import store.dto.BuyGetQuantity;
+import store.dto.PromotionInfo;
+import store.io.InputView;
+
+public class PromotionManager {
+
+ private final List<PromotionInfo> promotionInfos;... | Java | ์ข์ ์๊ฒฌ ๊ฐ์ฌํฉ๋๋ค. ์ด๋ฒ ๋ฏธ์
์์๋ ์ฑ
์ ๋ถ๋ฆฌ์ ๋ฏธํกํ๋ ๊ฒ ๊ฐ์์.
PromotionManager์ ์ฌ์ค์ ์๋น์ค์ฒ๋ผ ์ฌ์ฉํ๊ณ ์์๋ ๊ฒ ๊ฐ๊ณ , ์๊ฒฌ ์ฐธ๊ณ ํด์ ๋ฆฌํฉํ ๋งํด๋ณด๋ ค๊ณ ํฉ๋๋ค! ๊ฐ์ฌํฉ๋๋ค :) |
@@ -0,0 +1,172 @@
+package store.domain;
+
+import static store.constants.NumberConstants.FREEBIE_QUANTITY;
+
+import java.util.List;
+import store.dto.BuyGetQuantity;
+import store.dto.PromotionInfo;
+import store.io.InputView;
+
+public class PromotionManager {
+
+ private final List<PromotionInfo> promotionInfos;... | Java | ๋ง์ต๋๋ค... ์ธ์งํ๊ณ ์์ผ๋ฉด์๋ ๋น์ฅ ๋์๊ฐ๋ ๊ฒ ์ฐ์ ์ด์๊ธฐ์ ์ฐ๋ ๊ธฐ๋ฅผ ๋ง๋ค์๋ค์ใ
ใ
ใ
ใ
ใ
์
๋ ฅ ๋ฐ๋ ๋ถ๋ถ์ ์ ๋ถ ๋ฐ์ผ๋ก ๋นผ์ ๋ฆฌํฉํ ๋งํ ์์ ์
๋๋ค!
ํผ๋๋ฐฑ ๊ฐ์ฌํฉ๋๋ค. |
@@ -0,0 +1,172 @@
+package store.domain;
+
+import static store.constants.NumberConstants.FREEBIE_QUANTITY;
+
+import java.util.List;
+import store.dto.BuyGetQuantity;
+import store.dto.PromotionInfo;
+import store.io.InputView;
+
+public class PromotionManager {
+
+ private final List<PromotionInfo> promotionInfos;... | Java | ๊ทธ๋ ๊ตฐ์..! ํผ๋๋ฐฑ ๊ฐ์ฌํฉ๋๋ค. ๋ ๊ณต๋ถํด๋ณด๊ณ , ์ฐธ๊ณ ํด์ ๋ฆฌํฉํ ๋งํด๋ณด๊ฒ ์ต๋๋ค. |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.