code stringlengths 41 34.3k | lang stringclasses 8
values | review stringlengths 1 4.74k |
|---|---|---|
@@ -0,0 +1,130 @@
+package store.view.formatter;
+
+import store.model.order.Payment;
+import store.model.store.StoreRoom;
+import store.model.store.product.Product;
+import store.model.store.product.Products;
+
+public class OutputFormatter {
+ private static final String WELCOME_MESSAGE = "μλ
νμΈμ. WνΈμμ μ
λλ€.\nνμ¬ λ³΄μ νκ³ ... | Java | ,λ₯Ό μ΄λ κ²λ λ£μ μ μκ΅°μ!
μ’μ λ°©λ²μ΄λ€μ! |
@@ -0,0 +1,20 @@
+package store.util.reader;
+
+import java.util.function.Consumer;
+import java.util.function.Function;
+import java.util.function.Supplier;
+
+public class RepeatableReader {
+ public static <T> T handle(Supplier<String> viewMethod,
+ Function<String, T> converter,
+ ... | Java | ν¨μν μΈν°νμ΄μ€λ₯Ό λ무 μ μ¬μ©νμ κ±° κ°μμ! |
@@ -0,0 +1,100 @@
+package store;
+
+import java.util.Map;
+import store.model.order.Payment;
+import store.model.order.PurchaseOrder;
+import store.model.store.StoreRoom;
+import store.util.parser.ClosedQuestionsParser;
+import store.util.parser.PurchaseParser;
+import store.util.reader.RepeatableReader;
+import store... | Java | do-whileλ μ¬μ©ν΄λ³΄μλ©΄ λ κ°λ
μ±μ΄ μ’μμ§ κ±° κ°μμ! |
@@ -0,0 +1,10 @@
+package store.view;
+
+public class ErrorView {
+
+ private static final String ERROR_PREFIX = "[ERROR] ";
+
+ public void errorPage(String message) {
+ System.out.println(ERROR_PREFIX + message);
+ }
+} | Java | κ°μ¬ν©λλ€ π |
@@ -0,0 +1,44 @@
+package store.util.reader;
+
+import static store.exception.reader.FileReadErrorStatus.INVALID_FILE_PATH;
+import static store.exception.reader.FileReadErrorStatus.UNEXPECTED_IO_ERROR;
+
+import java.io.BufferedReader;
+import java.io.IOException;
+import java.nio.charset.StandardCharsets;
+import jav... | Java | μ’μ μ견 κ°μ¬ν©λλ€! |
@@ -0,0 +1,20 @@
+package store.util.reader;
+
+import java.util.function.Consumer;
+import java.util.function.Function;
+import java.util.function.Supplier;
+
+public class RepeatableReader {
+ public static <T> T handle(Supplier<String> viewMethod,
+ Function<String, T> converter,
+ ... | Java | μ λ μ λ² λ―Έμ
μ½λ리뷰 λ€λλ©΄μ λ΄€λλ° μ’λ€κ³ μκ°ν΄μ μ΄λ² λ―Έμ
μ μ μ©ν΄λ³΄μμ΄μ! |
@@ -0,0 +1,100 @@
+package store;
+
+import java.util.Map;
+import store.model.order.Payment;
+import store.model.order.PurchaseOrder;
+import store.model.store.StoreRoom;
+import store.util.parser.ClosedQuestionsParser;
+import store.util.parser.PurchaseParser;
+import store.util.reader.RepeatableReader;
+import store... | Java | μ’μ μ견 κ°μ¬ν©λλ€ π |
@@ -0,0 +1,100 @@
+package store;
+
+import java.util.Map;
+import store.model.order.Payment;
+import store.model.order.PurchaseOrder;
+import store.model.store.StoreRoom;
+import store.util.parser.ClosedQuestionsParser;
+import store.util.parser.PurchaseParser;
+import store.util.reader.RepeatableReader;
+import store... | Java | μ¬μ€λ³΄μ κ² μλ²½ν μ΄ν΄λ₯Ό λͺ»νμ§λ§ λ΅λ³ λ리면 `λ©€λ²μ ν μΈμ λ°μΌμκ² μ΅λκΉ? (Y/N)`λ₯Ό λ¬Όμ΄λ³΄λ λ©μλλ `askMembership`μ΄λΌκ³ μ§κ΄μ μΌλ‘ μμ±νμκ³ , κ·Έλ₯Ό λ΄λ λ³μλ λ©€λ²μ ν μΈ μ 무μ΄κΈ° λλ¬Έμ hasλΌλ ν€μλλ₯Ό μ΄μ©νμ΅λλ€! |
@@ -0,0 +1,29 @@
+package store.exception.store;
+
+public enum StoreErrorStatus {
+
+ INSUFFICIENT_STOCK("μ¬κ³ μλμ μ΄κ³Όνμ¬ κ΅¬λ§€ν μ μμ΅λλ€. λ€μ μ
λ ₯ν΄ μ£ΌμΈμ."),
+ NON_EXIST_PRODUCT("μ‘΄μ¬νμ§ μλ μνμ
λλ€. λ€μ μ
λ ₯ν΄ μ£ΌμΈμ."),
+ DUPLICATE_GENERAL_PRODUCT("μνμ΄ μ€λ³΅λμμ΅λλ€."),
+ DUPLICATE_PROMOTION_PRODUCT("νλμ μνμ λκ°μ νλ‘λͺ¨μ
μ΄ μ μ©λ μ μμ΅λλ€."),
+
... | Java | κ°μ¬ν©λλ€ π |
@@ -0,0 +1,92 @@
+package store.model.order;
+
+import camp.nextstep.edu.missionutils.DateTimes;
+import java.util.Map;
+import java.util.stream.Collectors;
+import store.model.store.StoreRoom;
+import store.model.store.product.Product;
+
+public class Payment {
+ private final PurchaseOrder purchaseOrder;
+ priv... | Java | μ λ `of`, `from`λ©μλ λ€μ΄λ°μ λν΄μ κ³ λ―Όμ λ§μ΄νλλ° μ΄λ€ λΈλ‘κ·Έμλ νλΌλ―Έν°κ° 2κ° μ΄μμ΄λ©΄ `of` νλλ©΄ `from`μΌλ‘ νλ€λ κΈμ λ΄€μ΅λλ€.
λ€λ₯Έ κΈμμλ μ 보λ₯Ό μ‘°ν©ν΄μ κ°μ²΄λ₯Ό λ§λλ κ²½μ°λ `of`λΌ νκ³ νλΌλ―Έν°λ‘ λ€μ΄μ€λ μ 보λ₯Ό μ΄μ©ν΄μ κ°μ²΄λ₯Ό λ§λλ κ²½μ°λ `from`μ΄λΌκ³ λ€μ΄λ°νλ€λ κΈλ μμλλ° μ λ μ΄ κΈμ λ 곡κ°μ λκ»΄μ μ κ²½μ°λ `from`μ΄λΌλ λ©μλ λ€μμ΄ μ λ§λ€λ μκ°μ νμ΅λλ€. |
@@ -0,0 +1,94 @@
+package store.model.store.product;
+
+import static store.exception.store.StoreErrorStatus.INVALID_PRODUCT_PRICE;
+import static store.exception.store.StoreErrorStatus.INVALID_PRODUCT_STOCK;
+
+import java.time.LocalDateTime;
+import store.exception.store.StoreException;
+import store.model.store.prom... | Java | Productκ° μ΄λ¦κ³Ό κ°κ²©λ§μ κ°μ§κ³ , Stockμ΄λΌλ λͺ¨λΈμ λ§λ€μ΄ `Product product`, `int stock` μ κ°μ§κ² ν κΉ μκ°νμ§λ§, μΌλ¨ λΉ λ₯΄κ² ꡬννλκ² λͺ©νκΈ°λ νκ³ ν° λ¬Έμ κ° μμ κ² κ°μμ μμ κ°μ΄ μ€κ³νμ΅λλ€.
Service λ μ΄μ΄μ Repository λ μ΄μ΄λ₯Ό λμ
μμ΄ MVC ν¨ν΄λ§μΌλ‘ μ€κ³ν΄μ λͺ¨λΈμ΄ μ¬κ³ μλμ λ€κ³ μλ κ²μ λ¬Έμ λ μλ€κ³ μκ°ν©λλ€. |
@@ -0,0 +1,61 @@
+package store.model.store.promotion;
+
+import static store.exception.store.StoreErrorStatus.INVALID_PROMOTION_BUY_AMOUNT;
+import static store.exception.store.StoreErrorStatus.INVALID_PROMOTION_GIVE_AMOUNT;
+
+import java.time.LocalDateTime;
+import store.exception.store.StoreException;
+
+public cla... | Java | μ°ν
μ½μμ μ 곡νλ λΌμ΄λΈλ¬λ¦¬μ `DateTimes` ν΄λμ€μ `now()` λ©μλμ λ°νκ°μ΄ LocalDateTimeμ΄μ¬μ LocalDateλ‘ λ³ννμ§ μκ³ λ°λ‘ λΉκ΅ν μ μκ² μμ κ°μ΄ μ¬μ©νμ΅λλ€. |
@@ -0,0 +1,20 @@
+package store.util.reader;
+
+import java.util.function.Consumer;
+import java.util.function.Function;
+import java.util.function.Supplier;
+
+public class RepeatableReader {
+ public static <T> T handle(Supplier<String> viewMethod,
+ Function<String, T> converter,
+ ... | Java | κ°μ¬ν©λλ€ π |
@@ -0,0 +1,100 @@
+package store;
+
+import java.util.Map;
+import store.model.order.Payment;
+import store.model.order.PurchaseOrder;
+import store.model.store.StoreRoom;
+import store.util.parser.ClosedQuestionsParser;
+import store.util.parser.PurchaseParser;
+import store.util.reader.RepeatableReader;
+import store... | Java | μ‘°κΈ λ νμ΄μ λ§μλ리면
`boolean λ©€λ²μ½ν μΈμλ°κΈ°λ‘νλκ°` κ° μλ,
`boolean λ©€λ²μ½μκ°μ‘λκ°` λ‘ λͺ
λͺ
λμ΄μ μ¬μ€λ΄€μ΅λλ€. |
@@ -0,0 +1,94 @@
+package store.model.store.product;
+
+import static store.exception.store.StoreErrorStatus.INVALID_PRODUCT_PRICE;
+import static store.exception.store.StoreErrorStatus.INVALID_PRODUCT_STOCK;
+
+import java.time.LocalDateTime;
+import store.exception.store.StoreException;
+import store.model.store.prom... | Java | λ§μ΅λλ€. μ½λλ₯Ό 보면μ λΆνΈν¨μ΄ μ ν μμμ΅λλ€! |
@@ -0,0 +1,92 @@
+package store.model.order;
+
+import camp.nextstep.edu.missionutils.DateTimes;
+import java.util.Map;
+import java.util.stream.Collectors;
+import store.model.store.StoreRoom;
+import store.model.store.product.Product;
+
+public class Payment {
+ private final PurchaseOrder purchaseOrder;
+ priv... | Java | κ°μ¬ν©λλ€! μ°Έκ³ νκ² μ΅λλ€. |
@@ -0,0 +1,100 @@
+package store;
+
+import java.util.Map;
+import store.model.order.Payment;
+import store.model.order.PurchaseOrder;
+import store.model.store.StoreRoom;
+import store.util.parser.ClosedQuestionsParser;
+import store.util.parser.PurchaseParser;
+import store.util.reader.RepeatableReader;
+import store... | Java | μν κ·Έ λ»μ΄μκ΅°μ.
μ λ λ©€λ²μ μ 무μλ§ μ κ²½μ¨μ μ λ κ² λ€μ΄λ°μ νλλ° λ§μμ λ£κ³ 보λ μλκ° λ€ λ³μμ λ΄κΈ°μ§ μμ λ― λ³΄μ΄λ€μ. |
@@ -0,0 +1,94 @@
+package store.model.store.product;
+
+import static store.exception.store.StoreErrorStatus.INVALID_PRODUCT_PRICE;
+import static store.exception.store.StoreErrorStatus.INVALID_PRODUCT_STOCK;
+
+import java.time.LocalDateTime;
+import store.exception.store.StoreException;
+import store.model.store.prom... | Java | κ·Έλ κ² λ§μν΄μ£Όμλ κ°μ¬ν©λλ€ π |
@@ -0,0 +1,100 @@
+package store;
+
+import java.util.Map;
+import store.model.order.Payment;
+import store.model.order.PurchaseOrder;
+import store.model.store.StoreRoom;
+import store.util.parser.ClosedQuestionsParser;
+import store.util.parser.PurchaseParser;
+import store.util.reader.RepeatableReader;
+import store... | Java | μλ¨ μ κ° μ‘°κΈ μ΅μ§λ‘ μ¬μ€λ³Έ κ²λ μμ΄μ. νΉλ³ν μλκ° μλ€λ©΄ λ°°μ°κ³ μΆμμ΅λλ€ γ
γ
|
@@ -0,0 +1,16 @@
+package store.view;
+
+import store.model.order.Payment;
+import store.model.store.StoreRoom;
+import store.view.formatter.OutputFormatter;
+
+public class OutputView {
+
+ public void printProducts(StoreRoom storeRoom) {
+ System.out.println(OutputFormatter.buildStoreStock(storeRoom));
+ ... | Java | `MVC` κ΄μ μμ λ·°κ° λͺ¨λΈμ μ°Έμ‘°νλ κ²μ΄ μλλ κ²μ μλμ§λ§ `λ·°λ λͺ¨λΈκ³Ό 컨νΈλ‘€λ¬λ₯Ό μ νμκ° μλ€`λΌλ λ§μ΄ μλ κ±°μ²λΌ λλλ‘ λͺ¨λ₯΄λ κ²μ΄ μ’μ κ²μΌλ‘ μκ³ μμ΅λλ€!
κ·Έλ° μΈ‘λ©΄μμ `StoreRoom`μ μΈμλ‘ λ°μμ μ²λ¦¬νλ κ² λ³΄λ€ λ©μΈμ§ ν¬λ§·μ μν λ°μ΄ν°λ§ λ°μμ μ²λ¦¬νλ λ°©μμ μ΄λ¨κΉμ? |
@@ -0,0 +1,130 @@
+package store.view.formatter;
+
+import store.model.order.Payment;
+import store.model.store.StoreRoom;
+import store.model.store.product.Product;
+import store.model.store.product.Products;
+
+public class OutputFormatter {
+ private static final String WELCOME_MESSAGE = "μλ
νμΈμ. WνΈμμ μ
λλ€.\nνμ¬ λ³΄μ νκ³ ... | Java | `getPurchaseOrder`λΌλ λ©μλκ° λ λ² μ°μλμ΄ λͺ¨νΈν κ°μ΄ μλ κ² κ°μ΅λλ€!
λ λ©μλμ λ€μ΄λ°μ λ¬λ¦¬ νλ©΄ μ’μ κ² κ°μμ!
μΆκ°μ μΌλ‘ 첫 `getPurchaseOrder` μμλ `PurchaseOrder` κ°μ²΄κ° λ°νλκ³ λ λ²μ§Έμμλ μμ΄ν
μ 보λ€μ΄ λ΄κΈ΄ `Map`μ΄ λ°νλλ κ² κ°μ΅λλ€! μ΄λ `λλ―Έν°μ λ²μΉ`μ μλ°°λλ κ²μΌλ‘ 보μ΄λλ°μ! μ°ν
μ½μμ μ μνλ ν΄λ¦°μ½λ μ¬νμ `λλ―Έν° λ²μΉ`μ΄ ν¬ν¨λ λ§νΌ μ°μμ μΌλ‘ μ¬μ©νλ κ²μ μ§μνλ κ²λ μ’μ κ² κ°μμ! |
@@ -0,0 +1,130 @@
+package store.view.formatter;
+
+import store.model.order.Payment;
+import store.model.store.StoreRoom;
+import store.model.store.product.Product;
+import store.model.store.product.Products;
+
+public class OutputFormatter {
+ private static final String WELCOME_MESSAGE = "μλ
νμΈμ. WνΈμμ μ
λλ€.\nνμ¬ λ³΄μ νκ³ ... | Java | `OutputFrmatter`κ° λ€μ λ¬΄κ±°μ΄ κ°μ²΄λΌλ λλμ΄ λλλ€!
ν¬λ§€ν°μμ λ§μ λ‘μ§μ λ΄λΉνκ³ μλ κ²μΌλ‘ μκ° λλλ°μ νΉν `payment.calculateActualPrice()` λ± λͺ¨λΈ κ°μ²΄λ€μ λ΄λΆ κΈ°λ₯λ€μ νμ©ν΄μ λ°μ΄ν°λ€μ κ°μ Έμ€λ λ°©μμΌλ‘ 보μ
λλ€!
λ€μν λͺ¨λΈλ€μ κΈ°λ₯μ ν¬λ§€ν° λ΄λΆμ μΌλ‘ λ§μ΄ μ¬μ©ν΄μ λ·° κ°μ²΄ 보λ€λ μλΉμ€μ κ°κΉμ§ μμκΉλΌλ μκ°μ΄ λλλ°μ μ΄ λΆλΆμ λν΄μ μ΄λ»κ² μκ°νμλμ??
ν¬λ§€ν°κ° λͺ¨λΈ κ°μ²΄λ€μ λ°λ κ²μ΄ μλ μ΄λ―Έ κ³μ°λ λ°μ΄ν°λ₯Ό λ°λ κ²μΌλ‘ νλ©΄ λ·° κ°μ²΄λ‘μ λ·°μ ν¬λ§€ν° μν μ λ μ§μ€λ μ μμ ... |
@@ -0,0 +1,108 @@
+package store.contoller;
+
+import store.Utils;
+import store.model.*;
+import store.view.InputView;
+import store.view.OutputView;
+
+import java.time.LocalDate;
+import java.util.*;
+
+import camp.nextstep.edu.missionutils.DateTimes;
+
+public class StoreController {
+ private static final Map<S... | Java | μνλ€μ μΆλ ₯νλ λ‘μ§μ OutputView μμ νμΌλ©΄ μ΄λ¨κΉ μΆμ΄μ!!! |
@@ -0,0 +1,17 @@
+package store.model;
+
+import store.view.InputView;
+
+public class MembershipDiscount {
+ public int applyMembershipDiscount(int totalNonPromotionPrice) {
+ if (InputView.askMemberShip()) {
+ return calculateMembershipDiscount(totalNonPromotionPrice);
+ }
+ return ... | Java | λ©€λ²μ ν μΈ λΉμ¨μ μμλ‘ λ½μΌλ©΄ μ΄λ¨κΉ μΆμ΅λλ€!!! |
@@ -0,0 +1,17 @@
+package store.model;
+
+import store.view.InputView;
+
+public class MembershipDiscount {
+ public int applyMembershipDiscount(int totalNonPromotionPrice) {
+ if (InputView.askMemberShip()) {
+ return calculateMembershipDiscount(totalNonPromotionPrice);
+ }
+ return ... | Java | μ λ μ΄λ κ² ν κ±Έ κ·Έλ¬μ΅λλ€!! μ λ°°μ°κ³ κ°λλ€!!!! |
@@ -0,0 +1,81 @@
+package store.model;
+
+import store.message.ViewMessage;
+
+import java.text.NumberFormat;
+import java.util.Locale;
+
+public class Product {
+ private final String name;
+ private final int price;
+ private int quantity;
+ private int promotionQuantity;
+ private final Promotion prom... | Java | μ¬κ³ μλμ λ³λμ setter λμ μλ μ¦κ°μ `increaseQuantity()` μ¬κ³ κ°μμ 'decreaseQuantiy()` μ΄λ°μμΌλ‘ μλ―Έλ₯Ό λΆμ¬νλ λ©μλλ₯Ό λ§λ€λ©΄ λ μ’μ κ² κ°μ΅λλ€!!! |
@@ -0,0 +1,69 @@
+package store.model;
+
+import store.message.ReceiptMessage;
+import store.view.OutputView;
+
+import java.text.NumberFormat;
+import java.util.Locale;
+import java.util.Map;
+
+public class Receipt {
+ private final Map<String, PurchaseItem> purchase;
+ private final Map<String, PurchaseItem> f... | Java | MVC ν¨ν΄μ λν λ΄μ©μ μ΄ν΄λ³΄λ©΄ λͺ¨λΈμ λ·°λ 컨νΈλ‘€λ¬λ₯Ό μμ‘΄νλ©΄ μλλ€κ³ λμ΄ μλ κΈμ 보μμ΅λλ€!! Recipt μ λν μ 보λ₯Ό DTO λ‘ λ§λ λ€ μ»¨νΈλ‘€λ¬μ λ겨 컨νΈλ‘€λ¬κ° OutputViewλ‘ μμμ¦μ λν λ΄μ©μ λκ²ΌμΌλ©΄ μ΄λ¨κΉ μΆμ΅λλ€!! |
@@ -0,0 +1,34 @@
+package store.model;
+
+import org.junit.jupiter.api.BeforeEach;
+import org.junit.jupiter.api.Test;
+import static org.junit.jupiter.api.Assertions.assertEquals;
+
+class MembershipTest {
+ private MembershipDiscount membershipDiscount;
+
+ @BeforeEach
+ void setUp() {
+ membershipDis... | Java | ν
μ€νΈ μ½λμ λν λ§μ κ³ λ―Όμ΄ λ³΄μ΄λ κ² κ°μ΅λλ€!!! μ λ§ κ³ μνμ
¨μ΅λλ€!!!! |
@@ -0,0 +1,35 @@
+package calculator.controller.validation
+
+class UserInputValidator {
+ fun validateUserInput(numbers: List<String>): List<Int> {
+ val newNumbers = checkIsEmpty(numbers)
+ checkIsInteger(newNumbers)
+ val allNumbers = changeInteger(newNumbers)
+ changeNegativeNumber(al... | Kotlin | μ ν¨μ± κ²μ¬λ₯Ό νλ ν¨μμΈμ§λΌ chaneλΌλ λ€μ΄λ°μ μ‘°κΈ μ΄μνκ² κ°μμ ! γ
γ
anyλ₯Ό μ¬μ©νλ©΄ ν¨μλ₯Ό μ‘°κΈ λ μ€μΌ μ μμ κ² κ°μ΅λλ€ !
```
private fun changeNegativeNumber(allNumbers: List<Int>) {
if (allNumbers.any { it < 0 }) {
throw IllegalArgumentException(UserInputErrorType.NEGATIVE_NUMBER.errorMessage)
}
}
``` |
@@ -0,0 +1,45 @@
+package calculator.controller.domain
+
+import calculator.constants.Delimiter.CLONE
+import calculator.constants.Delimiter.COMMA
+import calculator.constants.Delimiter.CUSTOM_DELIMITER_PREFIX
+import calculator.constants.Delimiter.CUSTOM_DELIMITER_SUFFIX
+
+class DelimiterController(
+ private val ... | Kotlin | μ±μ±λ! μ λ 첫 μ£Όμ°¨ λ 컀μ€ν
ꡬλΆμλ₯Ό μλ°μμΌλ‘ μΆμΆνμλλ°μ
λ€λ₯Έ λΆλ€ ꡬννκ±Έ 보λκΉ λ κΈμ μ΄μμΌ λ λ ꡬλΆμλ‘ μ¬μ©ν μ μλλ‘ λ§λμ
¨λλΌκ΅¬μ
κ·Έλμ μ΄λ κ² νλ©΄ 컀μ€ν
ꡬλΆμκ° 2κΈμ μ΄μμΌ κ²½μ° μμκ³Όλ λ€λ₯Έ μ€λ₯λ₯Ό 보μ¬μ£Όλ κ² κ°μμ
λ¬Όλ‘ ! λ¬Έμ μꡬ μ¬νμ μμκΈ° λλ¬Έμ λ°°μ νκ³ κ΅¬νν΄λ μ ν λ¬Έμ μμ§λ§ μ λ
μ΄λ° λΆλΆμ 첫 μ£Όμ°¨ λ λμ³μ μ΄λ² 리ν©ν λ§μμ μ μ©ν΄λ΄€λλ° νΉμ μΌλΆλ¬ ꡬνμ μνμ κ±΄μ§ κΆκΈν©λλ€ γ
γ
<img width="926" alt="image" src="https://github.com/user-attach... |
@@ -0,0 +1,45 @@
+package calculator.controller.domain
+
+import calculator.constants.Delimiter.CLONE
+import calculator.constants.Delimiter.COMMA
+import calculator.constants.Delimiter.CUSTOM_DELIMITER_PREFIX
+import calculator.constants.Delimiter.CUSTOM_DELIMITER_SUFFIX
+
+class DelimiterController(
+ private val ... | Kotlin | μ 5λΌλ μμλ μ΄λ¦μ λΆνμ£Όλ건 μ΄λ¨κΉμ ? |
@@ -0,0 +1,45 @@
+package calculator.controller.domain
+
+import calculator.constants.Delimiter.CLONE
+import calculator.constants.Delimiter.COMMA
+import calculator.constants.Delimiter.CUSTOM_DELIMITER_PREFIX
+import calculator.constants.Delimiter.CUSTOM_DELIMITER_SUFFIX
+
+class DelimiterController(
+ private val ... | Kotlin | νΉμ μ¬κΈ°μ 3μ΄ μλ―Ένλκ² λμ§ κΆκΈνλ€μ..! |
@@ -0,0 +1,35 @@
+package calculator.controller.validation
+
+class UserInputValidator {
+ fun validateUserInput(numbers: List<String>): List<Int> {
+ val newNumbers = checkIsEmpty(numbers)
+ checkIsInteger(newNumbers)
+ val allNumbers = changeInteger(newNumbers)
+ changeNegativeNumber(al... | Kotlin | checkλ₯Ό νκ³ μλ‘μ΄ μ«μλ€μ λ°νν΄λ³Ό μκ°μ λͺ»νλλ°, μ λ μ¨λ΄μΌκ² μ΅λλ€γ
γ
κ·Έλ°λ° μλ‘μ΄ μ«μλ€μ λ°ννλ€λ©΄ λ° ν¨μμ²λΌ μ΄λ¦μ changeλ‘ ν΄λ μ’μ κ² κ°μ΅λλΉ |
@@ -0,0 +1,45 @@
+package calculator.controller.domain
+
+import calculator.constants.Delimiter.CLONE
+import calculator.constants.Delimiter.COMMA
+import calculator.constants.Delimiter.CUSTOM_DELIMITER_PREFIX
+import calculator.constants.Delimiter.CUSTOM_DELIMITER_SUFFIX
+
+class DelimiterController(
+ private val ... | Kotlin | μ€ μλμ§ μλμ§ νμΈνκ³ , κ²°κ³Όλ numberλ‘ ν΅μΌνλ λ°©λ² λ°°μκ°λλ€! |
@@ -0,0 +1,35 @@
+package calculator.controller.validation
+
+class UserInputValidator {
+ fun validateUserInput(numbers: List<String>): List<Int> {
+ val newNumbers = checkIsEmpty(numbers)
+ checkIsInteger(newNumbers)
+ val allNumbers = changeInteger(newNumbers)
+ changeNegativeNumber(al... | Kotlin | μ...! any!! μ’μ ν¨μ μλ €μ€μ κ°μ¬ν©λλ€! |
@@ -0,0 +1,45 @@
+package calculator.controller.domain
+
+import calculator.constants.Delimiter.CLONE
+import calculator.constants.Delimiter.COMMA
+import calculator.constants.Delimiter.CUSTOM_DELIMITER_PREFIX
+import calculator.constants.Delimiter.CUSTOM_DELIMITER_SUFFIX
+
+class DelimiterController(
+ private val ... | Kotlin | μ λ΅μ
λλ€. μΌλΆλ¬ ꡬν μνμ΅λλ€! μ λ λ¬Έμ ν΄μνλ©΄μ ꡬλΆμλ νκΈμλ§ μμΌνλ€λΌκ³ μκ°μ ν΄μ μμ κ°μ΄ μ
λ ₯νλ©΄ μλ¬λΌκ³ νλ¨νμ΅λλ€! λ¬Έμ ν΄μμ΄ μ μΌ μ΄λ €μ΄ κ±° κ°μμ γ
γ
|
@@ -0,0 +1,45 @@
+package calculator.controller.domain
+
+import calculator.constants.Delimiter.CLONE
+import calculator.constants.Delimiter.COMMA
+import calculator.constants.Delimiter.CUSTOM_DELIMITER_PREFIX
+import calculator.constants.Delimiter.CUSTOM_DELIMITER_SUFFIX
+
+class DelimiterController(
+ private val ... | Kotlin | CUSTOM_DELIMITER_SUFFIXμ indexκ° 3μ΄λ©΄ CUSTOM_DELIMITER_PREFIXμ CUSTOM_DELIMITER_SUFFIX μ¬μ΄μ 컀μ€ν
ꡬλΆμλ₯Ό μ
λ ₯μ νλ€κ³ νλ¨μ νμ΅λλ€! |
@@ -0,0 +1,35 @@
+package calculator.controller.validation
+
+class UserInputValidator {
+ fun validateUserInput(numbers: List<String>): List<Int> {
+ val newNumbers = checkIsEmpty(numbers)
+ checkIsInteger(newNumbers)
+ val allNumbers = changeInteger(newNumbers)
+ changeNegativeNumber(al... | Kotlin | μ λ§λ€μ! κ·ΈλΌ ν¨μλͺ
μ΄ λ ν΅μΌμ±μ΄ μμ΄μ μ’μκ±° κ°μμ! μ’μ μ견 κ°μ¬ν©λλ€! |
@@ -0,0 +1,28 @@
+import { Country } from "../types/country";
+
+const CountryCard = ({
+ country,
+ handleToggleCountry,
+}: {
+ country: Country;
+ handleToggleCountry: (country: Country) => void;
+}) => {
+ return (
+ <div
+ className="flex flex-col border rounded gap-2 px-4"
+ onClick={() => handl... | Unknown | h2 νκ·Έλ₯Ό μ¬μ©νκΈ°μ λ무 λ§μ μ§ κ² κ°μλ°, μ 체μ μΈ κ΄μ μΌλ‘ λ΄€μλ h2μ λ 벨μ κ°μ§ ν
μ€νΈλ μλ κ² κ°μμμ! strong νκ·Έλμ h2λ₯Ό μ°μ μ΄μ κ° κΆκΈν©λλ€! |
@@ -0,0 +1,66 @@
+import { useQuery } from "@tanstack/react-query";
+import { getCountries } from "../api/countryAPI";
+import CountryCard from "./CountryCard";
+import { useEffect } from "react";
+import { Country } from "../types/country";
+import useCountryStore from "../zustand/countryStore";
+
+const CountryList =... | Unknown | early if pattern μΆμ²λ립λλ€ .. >_< |
@@ -0,0 +1,66 @@
+import { useQuery } from "@tanstack/react-query";
+import { getCountries } from "../api/countryAPI";
+import CountryCard from "./CountryCard";
+import { useEffect } from "react";
+import { Country } from "../types/country";
+import useCountryStore from "../zustand/countryStore";
+
+const CountryList =... | Unknown | countryList μ»΄ν¬λνΈλ₯Ό 보λ, λ¨μ UIλ§ μ 곡νλ κ²μ΄ μλ ν΅μ¬ λ‘μ§λ€μ μ λΆ λ€ κ°μ§κ³ μλ κ²μΌλ‘ 보μ
λλ€.
νμΌλͺ
μΌλ‘λ§ λ³΄μμλ, UI μν λ§ νκ³ μμ κ²μΌλ‘ μΆμΈ‘λμλλ° μ¬νμ© κ°λ₯ν μ»΄ν¬λνΈλ μλ κ² κ°μμμ~
κ°μΈμ μΈ μ견μΌλ‘λ Listμλ λ¨μ λ΄λ €μ€ λ°μ΄ν°λ₯Ό λ
ΈμΆνκ²λ§ νκ³ , λΉμ¦λμ€ λ‘μ§μ μμμ μ λ¬ν΄μ£Όλ κ²μ΄ μ΄λ€μ§ μ½λ©νΈ λ립λλ€! |
@@ -0,0 +1,15 @@
+import axios from "axios";
+import { Country } from "../types/country";
+
+export const countryApi = axios.create({
+ baseURL: "https://restcountries.com/v3.1",
+});
+
+export const getCountries = async (): Promise<Country[]> => {
+ try {
+ const response = await countryApi.get("/all");
+ retu... | TypeScript | λ³λ‘ μ€μν κ²μ μλμ§λ§ γ
γ
throw new Error() μκΈ°μ λκ°λ₯Ό λ£μ΄μ£Όμλ©΄ μ’μμ
```javascript
throw new Error(error.response?.data.message);
```
μ΄λ°μμΌλ‘μ γ
γ
|
@@ -0,0 +1,66 @@
+import { useQuery } from "@tanstack/react-query";
+import { getCountries } from "../api/countryAPI";
+import CountryCard from "./CountryCard";
+import { useEffect } from "react";
+import { Country } from "../types/country";
+import useCountryStore from "../zustand/countryStore";
+
+const CountryList =... | Unknown | νν°λ₯Ό νκΈ° μν μλλ‘ setCountries λ₯Ό λ§λ€μ΄ κ°μ λ³κ²½νκ³ μλ κ²μΌλ‘ 보μ
λλ€!
favoriteCountries λΌλ μνλ₯Ό λ°λ‘ μ§λκ³ μκΈ°μ countriesλ₯Ό λ³κ²½νλ κ²λ³΄λ€ μλμμ filterλ§ ν΄μ£Όλ λ‘μ§μΌλ‘ λ³κ²½νλ κ²μ΄ μ΄λ¨μ§ μ μ λ립λλ€! |
@@ -0,0 +1,66 @@
+import { useQuery } from "@tanstack/react-query";
+import { getCountries } from "../api/countryAPI";
+import CountryCard from "./CountryCard";
+import { useEffect } from "react";
+import { Country } from "../types/country";
+import useCountryStore from "../zustand/countryStore";
+
+const CountryList =... | Unknown | μ΄κ²λ μμ£Ό μ¬μν κ±°μ§λ§ γ
γ
isDone λ³΄λ€ isFavorite μ΄ μκΈ° μ¬μΈκ² κ°μμ©γ
γ
|
@@ -0,0 +1,66 @@
+import { useQuery } from "@tanstack/react-query";
+import { getCountries } from "../api/countryAPI";
+import CountryCard from "./CountryCard";
+import { useEffect } from "react";
+import { Country } from "../types/country";
+import useCountryStore from "../zustand/countryStore";
+
+const CountryList =... | Unknown | λμΌν©λλ€! |
@@ -0,0 +1,18 @@
+import CountryList from "../components/CountryList";
+
+const Home = () => {
+ return (
+ <>
+ <h1 className="flex justify-center items-center mt-8 mb-8 text-2xl font-bold">
+ Favorite Countries
+ </h1>
+ <CountryList isDone={true} />
+ <h1 className="flex justify-center... | Unknown | h1μ΄ λ무 λ§μ΅λλ€! νμ΄μ§μ νλλ§ μ‘΄μ¬ν΄μΌν©λλ€.
νμ§λ§ μ½λμμλ νΌλμ μΌκΈ°ν μ μλ ν€λ©νκ·Έλ₯Ό μ§μνλ κ²μ μ μλ립λλ€ :) |
@@ -0,0 +1,15 @@
+import axios from "axios";
+import { Country } from "../types/country";
+
+export const countryApi = axios.create({
+ baseURL: "https://restcountries.com/v3.1",
+});
+
+export const getCountries = async (): Promise<Country[]> => {
+ try {
+ const response = await countryApi.get("/all");
+ retu... | TypeScript | μ κ° μ΄λ²μ μ€μ€λ‘ μ¨λ³Έκ±΄ μ²μμ΄λΌ μ λͺ°λλλ° μλ μ½λ 보면μ κΉ¨λ¬μμ΅λλ€ κ°μΌλ |
@@ -0,0 +1,66 @@
+import { useQuery } from "@tanstack/react-query";
+import { getCountries } from "../api/countryAPI";
+import CountryCard from "./CountryCard";
+import { useEffect } from "react";
+import { Country } from "../types/country";
+import useCountryStore from "../zustand/countryStore";
+
+const CountryList =... | Unknown | μλ§ κ³΅λΆλ₯Ό μν΄μ νμ λ― ν©λλ€λ§..!
zustand μ€ν μ΄μ countries μ favoriteCountries κ° μκ³ μ€μ λ‘
```javascript
const isDoneCountries = isDone ? favoriteCountries : countries;
```
μ΄λ° λΆλΆμμλ useQuery μ data λ₯Ό λ°λ‘ μ°μ§λ μμΌλ, μ΄λ° κ²½μ°λΌλ©΄ tanstackμ μμ°λ λ°©ν₯λ μμ κ² κ°μ΅λλ€~
λ¬Όλ‘ κ³΅λΆμ©μ΄κΈ° λλ¬Έμ 무μνμ
λ λ©λλ€ ^^;; |
@@ -0,0 +1,28 @@
+import { Country } from "../types/country";
+
+const CountryCard = ({
+ country,
+ handleToggleCountry,
+}: {
+ country: Country;
+ handleToggleCountry: (country: Country) => void;
+}) => {
+ return (
+ <div
+ className="flex flex-col border rounded gap-2 px-4"
+ onClick={() => handl... | Unknown | μ κ·Έλ₯..h1λ°μ νμλ‘ μλ€ μκ°ν΄μ μ무 μκ°μμ΄ h2λ₯Ό μ΄κ²λλ€.. κ·Έλ κ΅°μ¬.. html cssμ λν΄μ λ°λ‘ 곡λΆλ₯Ό μνκ³ νμν λλ§λ€ κ·Έλ₯ κ·Έ λ κ·Έλ μ°λ€λ³΄λ μ΄λ° λΆλΆμ΄ μμ§ λ§μ΄ λ―Έν‘νλ―νλ€μ¬ ν... |
@@ -0,0 +1,66 @@
+import { useQuery } from "@tanstack/react-query";
+import { getCountries } from "../api/countryAPI";
+import CountryCard from "./CountryCard";
+import { useEffect } from "react";
+import { Country } from "../types/country";
+import useCountryStore from "../zustand/countryStore";
+
+const CountryList =... | Unknown | μ€μ€ κ°μ μκ°μ
λλ€~~ |
@@ -0,0 +1,66 @@
+import { useQuery } from "@tanstack/react-query";
+import { getCountries } from "../api/countryAPI";
+import CountryCard from "./CountryCard";
+import { useEffect } from "react";
+import { Country } from "../types/country";
+import useCountryStore from "../zustand/countryStore";
+
+const CountryList =... | Unknown | λ§λ λ§μμ
λλ€ ν¨μ¬ μ’κ²κ΅°μ¬ |
@@ -0,0 +1,18 @@
+import CountryList from "../components/CountryList";
+
+const Home = () => {
+ return (
+ <>
+ <h1 className="flex justify-center items-center mt-8 mb-8 text-2xl font-bold">
+ Favorite Countries
+ </h1>
+ <CountryList isDone={true} />
+ <h1 className="flex justify-center... | Unknown | h1νκ·Έλ νμ΄μ§λΉ 1κ°λ§ μ¨μΌνλμ§ λͺ°λλ€μ¬... λͺ
μ¬νκ² μ΅λλΉ |
@@ -0,0 +1,15 @@
+import axios from "axios";
+import { Country } from "../types/country";
+
+export const countryApi = axios.create({
+ baseURL: "https://restcountries.com/v3.1",
+});
+
+export const getCountries = async (): Promise<Country[]> => {
+ try {
+ const response = await countryApi.get("/all");
+ retu... | TypeScript | μ£Όμ :: νμ
μ€ν¬λ¦½νΈ μ λͺ°λΌμ μ΄μν μλ¦¬μΌ μ μμ΅λλ€ γ
getCountires ν¨μμ λ°νκ°μ΄ Promise<Country[]>μμ λͺ
μν΄μ£Όκ³ κ³μλ κ² κ°μ΅λλ€.
μ λ μ΄λ² API κ΅¬μ‘°κ° λ³΅μ‘ν΄μμΈμ§ λ¬΄μ¨ μλ¬μλμ§ μμΈν κΈ°μ΅μ μ λμ§λ§ μλ¬λ₯Ό κ³μ κ²ͺμμ΅λλ€~!
tryλ¬Έ μμμ get μμ² λΆλΆμ 보면 μλ΅κ°μ νμ
μ§μ μ΄ μ λμ΄ μλλ°, μ λ μ΄ λΆλΆμμ λ¬Έμ λ₯Ό ν΄κ²°ν μ μμλ κ²μΌλ‘ κΈ°μ΅ν©λλ€!
`const response = await countryApi.get<Country[]>("/all");`
μλ₯Ό λ€μ΄μ dat... |
@@ -0,0 +1,66 @@
+import { useQuery } from "@tanstack/react-query";
+import { getCountries } from "../api/countryAPI";
+import CountryCard from "./CountryCard";
+import { useEffect } from "react";
+import { Country } from "../types/country";
+import useCountryStore from "../zustand/countryStore";
+
+const CountryList =... | Unknown | ννμ΄μ§ κ΄λ ¨ν΄μ μ μ΄μ£Όμ κ²μ²λΌ νκ·Έ μ΄λ¦μ λ°κΎΈλκ² μ’λ€λ λ§μμ΄μ κ°μ? |
@@ -0,0 +1,28 @@
+import { Country } from "../types/country";
+
+const CountryCard = ({
+ country,
+ handleToggleCountry,
+}: {
+ country: Country;
+ handleToggleCountry: (country: Country) => void;
+}) => {
+ return (
+ <div
+ className="flex flex-col border rounded gap-2 px-4"
+ onClick={() => handl... | Unknown | μ°Έκ³ :
- https://techblog.woowahan.com/15541/
- https://webactually.com/2020/03/03/%3Csection%3E%EC%9D%84-%EB%B2%84%EB%A6%AC%EA%B3%A0-HTML5-%3Carticle%3E%EC%9D%84-%EC%8D%A8%EC%95%BC-%ED%95%98%EB%8A%94-%EC%9D%B4%EC%9C%A0/ |
@@ -0,0 +1,66 @@
+import { useQuery } from "@tanstack/react-query";
+import { getCountries } from "../api/countryAPI";
+import CountryCard from "./CountryCard";
+import { useEffect } from "react";
+import { Country } from "../types/country";
+import useCountryStore from "../zustand/countryStore";
+
+const CountryList =... | Unknown | κ·Έ μκ°μ λͺ»ν΄λ΄€λλ° λμΌν κ²°κ³Όκ°...λμ€λμ§ ν΄λ³΄κ² μ΅λλ€ γ
γ
... νλ²μ λμμΌλ‘ μ 쑰건문μ κ°μ νλ©΄ λκ² κ΅°μ¬! |
@@ -0,0 +1,66 @@
+import { useQuery } from "@tanstack/react-query";
+import { getCountries } from "../api/countryAPI";
+import CountryCard from "./CountryCard";
+import { useEffect } from "react";
+import { Country } from "../types/country";
+import useCountryStore from "../zustand/countryStore";
+
+const CountryList =... | Unknown | μ΄κ±΄ μ κ° λ λ§μνμλμ§ μ λͺ°λΌμ...νμ΅νκ² μ΅λλ€ γ
.. |
@@ -0,0 +1,66 @@
+import { useQuery } from "@tanstack/react-query";
+import { getCountries } from "../api/countryAPI";
+import CountryCard from "./CountryCard";
+import { useEffect } from "react";
+import { Country } from "../types/country";
+import useCountryStore from "../zustand/countryStore";
+
+const CountryList =... | Unknown | μ΄ λΆλΆμ home.tsxμμλ μ 체μ μΈ UI λ° νμ΄μ§ κ΄λ ¨λ§ λνλ΄κ³ Listμμ Cardλ₯Ό νΈλ€λ§ ν μ μλλ‘ μκ°μ ν΄μ λ‘μ§μ ꡬννλλ° μ΄λ° νΈλ€λ§ λ‘μ§μ home.tsxκ° λ μ μ νλ¨ λ§μμ΄μ€κΉμ¬?? |
@@ -0,0 +1,15 @@
+import axios from "axios";
+import { Country } from "../types/country";
+
+export const countryApi = axios.create({
+ baseURL: "https://restcountries.com/v3.1",
+});
+
+export const getCountries = async (): Promise<Country[]> => {
+ try {
+ const response = await countryApi.get("/all");
+ retu... | TypeScript | μ κ·Έλ κ΅°μ¬! μ λ μΌλ¨ jsνλ―μ΄ μμ± ν νμ strictλͺ¨λκ° μ€μ λμ΄μμΌλ tsμμ μλ‘ λ°μν μ€λ₯μ λ§μΆ° μμ νμ΄κ°μ§κ³ λ°νκ°λ§ λͺ
μνκ³ μ€λ₯κ° μ¬λΌμ‘κΈΈλ κ·Έ λΆλΆμ λ―Έμ² μκ°μ λͺ»νμ΅λλ€.
μ무λλ λͺ¨λ κ°μ μ νν νμ
μ λͺ
μνλ건 μ λ ν΄μΌκ² λ€ μκ°νλλ° κ°μ¬ν©λλ€! |
@@ -0,0 +1,66 @@
+import { useQuery } from "@tanstack/react-query";
+import { getCountries } from "../api/countryAPI";
+import CountryCard from "./CountryCard";
+import { useEffect } from "react";
+import { Country } from "../types/country";
+import useCountryStore from "../zustand/countryStore";
+
+const CountryList =... | Unknown | prop νμ
μ μΈλΌμΈμΌλ‘ μ μν μ΄μ κ° μλμ§ κΆκΈν©λλ€! |
@@ -0,0 +1,66 @@
+import { useQuery } from "@tanstack/react-query";
+import { getCountries } from "../api/countryAPI";
+import CountryCard from "./CountryCard";
+import { useEffect } from "react";
+import { Country } from "../types/country";
+import useCountryStore from "../zustand/countryStore";
+
+const CountryList =... | Unknown | μ...μλ dataλ‘ mpaμ λλ Έμλλ°...;; μ΄κ² isDoneκ°μ κΌ μ¨λ³΄λ €κ³ λ
Έλ ₯νλ€λ³΄λ μ΄μ©λ€ κ·Έλ κ² λμμ΅λλ€ γ
γ
... λ§μλλ‘ μ§κΈ μΏΌλ¦¬κ° μ΄κΈ°κ° λ£μ΄μ£Όλκ±°λ§κ³ λ±ν μμ°μ΄κΈ΄ν©λλ€.. |
@@ -0,0 +1,66 @@
+import { useQuery } from "@tanstack/react-query";
+import { getCountries } from "../api/countryAPI";
+import CountryCard from "./CountryCard";
+import { useEffect } from "react";
+import { Country } from "../types/country";
+import useCountryStore from "../zustand/countryStore";
+
+const CountryList =... | Unknown | μ λ κΆκΈν©λλ€..!!! |
@@ -0,0 +1,84 @@
+export interface Country {
+ name: {
+ common: string;
+ official: string;
+ nativeName: {
+ [key: string]: {
+ official: string;
+ common: string;
+ };
+ };
+ };
+ tld: string[];
+ cca2: string;
+ ccn3: string;
+ cca3: string;
+ cioc: string;
+ independent:... | TypeScript | μ λ μ¬μ€ λͺ¨λ λ°μ΄ν°λ₯Ό λ€ λ³΄μ§ μμμ§λ§, λͺλͺ λ°μ΄ν°λ μ νμ μΌλ‘ λ€μ΄μ€λ κ² κ°λλΌκ΅¬μ..!! κ·Έλμ λͺ¨λ λ°μ΄ν°μ λ€ λ€μ΄μ€λ κ²μ΄ μλλΌλ©΄ μ΅μ
λμ λΆμ¬μ£Όλ©΄ μ’μ κ² κ°μ΅λλ€..!! |
@@ -6,6 +6,7 @@
import java.time.LocalDateTime;
import java.util.List;
+import java.util.Set;
import java.util.UUID;
import org.springframework.data.domain.Page;
@@ -14,12 +15,14 @@
import org.springframework.data.support.PageableExecutionUtils;
import com.ioteam.order_management_platform.global.exception.C... | Java | μꡬμ¬νμ λ§κ² κΉλνκ² μ½λ ꡬννμλ λͺ¨μ΅ λ¨Έμ―μ΅λλ€!!! |
@@ -6,6 +6,7 @@
import java.time.LocalDateTime;
import java.util.List;
+import java.util.Set;
import java.util.UUID;
import org.springframework.data.domain.Page;
@@ -14,12 +15,14 @@
import org.springframework.data.support.PageableExecutionUtils;
import com.ioteam.order_management_platform.global.exception.C... | Java | QueryProjectionμ μ¬μ©ν΄ DTO λ§€νμ μλμΌλ‘ ν΄μ£Όλ κ΅°μ!! μ½λκ° ν¨ κ°κ²°ν΄μ§κ³ DTO λ§ μμ νλ©΄ λλ μ μ§λ³΄μμλ μ’μ κ² κ°μ΅λλ€! |
@@ -1,7 +1,17 @@
package store;
+import store.controller.StoreController;
+import store.global.util.FileUtil;
+import store.view.InputView;
+import store.view.OutputView;
+
public class Application {
public static void main(String[] args) {
- // TODO: νλ‘κ·Έλ¨ κ΅¬ν
+ FileUtil fileInputView = new FileUt... | Java | FileUtil μ΄λΌλ μλͺ
μ΄ μ§κ΄μ μ΄μ΄μ μ’λ€μ! μ λ StoreInitializerλ‘ νλλ° λκ° μ μλΏμμ μμ¬μ μ΄μ |
@@ -1 +1,325 @@
-# java-convenience-store-precourse
+# νΈμμ πͺ
+
+## κΈ°λ₯ ꡬν λͺ©λ‘
+
+### β
νμΌ μ½κΈ° κΈ°λ₯
+- [x] νμΌ λ΄μ©μ μ
λ ₯ λ°μ 리μ€νΈλ‘ λ°ννλ€
+ - `products.md`, `promotions.md` νμΌ μ
λ ₯
+ - λ΄μ© `(,)` μΌνλ‘ κ΅¬λΆ
+ - μ 체 λ΄μ© λΆλ¦¬ ν 리μ€νΈλ‘ λ°ν
+- [x] `μμΈμ²λ¦¬` μΌμΉνλ νμΌλͺ
μ΄ μμ κ²½μ° μμΈκ° λ°μνλ€
+- [x] `μμΈμ²λ¦¬` νμΌμμ λ΄μ©μ΄ μμ κ²½μ° μμΈκ° λ°μνλ€
+- [x] `μμΈμ²λ¦¬` λΆλ¦¬ν λ°°μ΄ μμκ° ... | Unknown | μκ°νκΈ° μ½μ§ μμ μ μλ μ£μ§ μΌμ΄μ€μμν
λ° μ μ§μΌμ
¨λ€μ! |
@@ -0,0 +1,223 @@
+package store.controller;
+
+import camp.nextstep.edu.missionutils.DateTimes;
+import java.time.LocalDateTime;
+import java.util.ArrayList;
+import java.util.List;
+import java.util.Map;
+import store.domain.PaymentProductList;
+import store.domain.Product;
+import store.domain.Products;
+import stor... | Java | do {} whileμ΄ μμ£Ό μ μ°μ΄λ ꡬ문μ΄λΌμ μ¬μ© ν μκ°μ νλκ²μ΄ μ½μ§ μμΌμ
¨μν
λ° μ΄κ²λ μ νμ
¨λ€μ! |
@@ -0,0 +1,223 @@
+package store.controller;
+
+import camp.nextstep.edu.missionutils.DateTimes;
+import java.time.LocalDateTime;
+import java.util.ArrayList;
+import java.util.List;
+import java.util.Map;
+import store.domain.PaymentProductList;
+import store.domain.Product;
+import store.domain.Products;
+import stor... | Java | ```java
private <T> T process(Supplier<T> supplier) {
while (true) {
try {
return supplier.get();
} catch (IllegalArgumentException e) {
outputView.printErrorMessage(e.getMessage());
}
}
}
process(inputView::read~~);... |
@@ -0,0 +1,223 @@
+package store.controller;
+
+import camp.nextstep.edu.missionutils.DateTimes;
+import java.time.LocalDateTime;
+import java.util.ArrayList;
+import java.util.List;
+import java.util.Map;
+import store.domain.PaymentProductList;
+import store.domain.Product;
+import store.domain.Products;
+import stor... | Java | μ΄ λκ°μ λ©μλλ₯Ό, purchase.canApplyPromotion() μΌλ‘ λ¬Άλ κ²λ κ°λ
μ±μ λμ΄λλ°μ μ’μ 보μ
λλ€. |
@@ -0,0 +1,223 @@
+package store.controller;
+
+import camp.nextstep.edu.missionutils.DateTimes;
+import java.time.LocalDateTime;
+import java.util.ArrayList;
+import java.util.List;
+import java.util.Map;
+import store.domain.PaymentProductList;
+import store.domain.Product;
+import store.domain.Products;
+import stor... | Java | StoreControllerμ μ μ½μΌλ©° λ μκ°μ΄, λ¬Όλ‘ μκ°μ΄ μ΄λ°νκ³ μ΄μ© μ μμμ§λ§ 컨νΈλ‘€λ¬μ λ무 λ§μ μ±
μκ³Ό ꡬνμ΄ μ§μ€λμ΄ μλ κ² κ°μ΅λλ€. 컨νΈλ‘€λ¬λ μ λ§ λ¨μν μ μ΄ μν μ νκ³ , λΉμ¦λμ€κ° ν¬ν¨λ ꡬν λΆλΆμ Service λ μ΄μ΄λ‘ λ°λ‘ λΉΌλ λ°©λ²μ μ΄λ¨κΉμ? |
@@ -0,0 +1,223 @@
+package store.controller;
+
+import camp.nextstep.edu.missionutils.DateTimes;
+import java.time.LocalDateTime;
+import java.util.ArrayList;
+import java.util.List;
+import java.util.Map;
+import store.domain.PaymentProductList;
+import store.domain.Product;
+import store.domain.Products;
+import stor... | Java | λΉμ¦λμ€ λ‘μ§μ΄ 컨νΈλ‘€λ¬μ ν¬ν¨λμ΄ μλ κ²μ μ΄μν κ² κ°μ΅λλ€! 컨νΈλ‘€λ¬μ μλΉμ€λ₯Ό λΆλ¦¬νλ€λ©΄ λ λμ μ½λκ° λμμ κ² κ°μμ. |
@@ -0,0 +1,223 @@
+package store.controller;
+
+import camp.nextstep.edu.missionutils.DateTimes;
+import java.time.LocalDateTime;
+import java.util.ArrayList;
+import java.util.List;
+import java.util.Map;
+import store.domain.PaymentProductList;
+import store.domain.Product;
+import store.domain.Products;
+import stor... | Java | μ΄λ° λΆλΆλ remainingStockμ΄λΌλ λ‘컬 λ³μκ° μ¬μ€ purchaseμ νλλκΉ ifλ¬Έμ &&λ₯Ό μμ κ³ purchaseμ νλμ λ©μμ§λ₯Ό 보λ΄λ μͺ½μΌλ‘ ꡬννλ€λ©΄ κ°λ
μ±μ΄ ν¨μ¬ μ’μμ κ² κ°μμ! |
@@ -0,0 +1,39 @@
+package store.domain.product;
+
+import static store.global.constant.ErrorMessage.INVALID_PRICE_NUMERIC;
+import static store.global.constant.ErrorMessage.INVALID_PRICE_OUT_OF_RANGE;
+import static store.global.validation.CommonValidator.validateNotNumeric;
+
+import java.text.DecimalFormat;
+
+public... | Java | Priceκ°μ²΄μ νμκ° λ°λ‘ μλ κ² κ°μ 보μ΄λλ°, λ¨μν "κ°κ²©"μ΄λΌλ λλ©μΈ μ μ½ κ²μ¦κ³Ό, κ΄λ ¨λ μμλ€μ λ¬Άμ΄λκΈ° μν΄ μ¬μ©νμ 건κ°μ? |
@@ -0,0 +1,77 @@
+package store.global.util;
+
+import static store.global.constant.ErrorMessage.INVALID_INPUT_PURCHASE;
+import static store.global.validation.CommonValidator.validateBlank;
+import static store.global.validation.CommonValidator.validateNotNumeric;
+
+import java.util.LinkedHashMap;
+import java.util.M... | Java | κ³΅ν΅ νΌλλ°±μμ λ³μ μ΄λ¦μ μλ£νμ λ£μ§ λ§λΌκ³ νλλΌκ΅¬μ! |
@@ -0,0 +1,15 @@
+package store.domain.product;
+
+public class Name {
+
+ private final String name;
+
+ public Name(final String name) {
+ this.name = name;
+ }
+
+ @Override
+ public String toString() {
+ return name;
+ }
+} | Java | Nameν΄λμ€μ μ©λκ° κΆκΈν΄μ! |
@@ -0,0 +1,223 @@
+package store.controller;
+
+import camp.nextstep.edu.missionutils.DateTimes;
+import java.time.LocalDateTime;
+import java.util.ArrayList;
+import java.util.List;
+import java.util.Map;
+import store.domain.PaymentProductList;
+import store.domain.Product;
+import store.domain.Products;
+import stor... | Java | κ°μΈμ μΌλ‘λ 컨νΈλ‘€λ¬κ° λΆλ΄μ΄ μ‘°κΈ ν° κ² κ°μμ!
λΉμ¦λμ€ λ‘μ§μ μμνμ§μκ³ μΌλΆλ₯Ό λ΄λΉνκ³ μλ€λ λλμ΄ λ€μ΄μ. μ΄λ»κ² μκ°νμλμ?! |
@@ -0,0 +1,89 @@
+package store.domain;
+
+import static store.global.constant.MessageConstant.FORMAT;
+
+import java.text.DecimalFormat;
+import java.util.ArrayList;
+import java.util.List;
+
+public class PaymentProductList {
+
+ private static final DecimalFormat PRICE_FORMAT = new DecimalFormat("###,###");
+
+ ... | Java | μ΅λ ν μΈ κΈμ‘μ΄ λμ΄μ°λμ§ νμΈνλ λ©μλλ‘ λ°λ‘ λΆλ¦¬λ₯Ό νμΌλ©΄ λ μ’μμ κ² κ°λ€λ μκ°μ΄ λ€μμ΄μ! |
@@ -0,0 +1,46 @@
+package store.domain;
+
+import java.time.LocalDate;
+
+public class Promotions {
+
+ private final String name;
+ private final int buy;
+ private final int get;
+ private final LocalDate startDate;
+ private final LocalDate endDate;
+
+ public Promotions(String name, String buy, St... | Java | νΉμ, Name νμ
μΌλ‘ νμ§ μμΌμ μ΄μ κ° μλμ©?? |
@@ -0,0 +1,223 @@
+package store.controller;
+
+import camp.nextstep.edu.missionutils.DateTimes;
+import java.time.LocalDateTime;
+import java.util.ArrayList;
+import java.util.List;
+import java.util.Map;
+import store.domain.PaymentProductList;
+import store.domain.Product;
+import store.domain.Products;
+import stor... | Java | μλ
νμΈμ!
κ°μ²΄λ₯Ό κ°μ²΄λ΅κ² νμ©νκΈ° μν΄, λ©μμ§λ₯Ό μ λ¬ν΄ κ°μ²΄κ° μ€μ€λ‘ μμ
μ μννλλ‘ νλ κ²μ΄ μ’λ€λ κ³΅ν΅ νΌλλ°±μ νμΈνμ΅λλ€.
νμ¬ λ©μλλ μλ(quantity)μ 1μ© μ¦κ°μν€λ λ¨μν λ‘μ§μ κ°μ§κ³ μλλ°μ,
μ΄ κ²½μ° λ§€λ² νΈμΆν λλ§λ€ μλμ 1μ© μ¦κ°μν€λ λμ , νλΌλ―Έν°λ‘ μ¦κ°ν μλμ μ λ¬νκ³ μ΄λ₯Ό λ°μνλ λ°©λ²λ κ³ λ €ν΄λ³Ό μ μμ κ² κ°μ΅λλ€.
```
public void increaseQuantity(int number) {
this.quantity += number;
}
```
νμ§λ§ μ΄μ λμμ λ무 λ¨μ... |
@@ -0,0 +1,39 @@
+package store.domain.product;
+
+import static store.global.constant.ErrorMessage.INVALID_PRICE_NUMERIC;
+import static store.global.constant.ErrorMessage.INVALID_PRICE_OUT_OF_RANGE;
+import static store.global.validation.CommonValidator.validateNotNumeric;
+
+import java.text.DecimalFormat;
+
+public... | Java | λμΌν νμμ μμλ₯Ό Quantityμμλ 보μμ΄μ!
νΉμ, 곡ν΅μ μΌλ‘ μ¬μ©νλ μμλ λ°λ‘ λΆλ¦¬λ₯Ό νμλ κ²μ μ΄λ»κ² μκ°νμλμ? |
@@ -0,0 +1,58 @@
+package store.view;
+
+import static store.global.constant.MessageConstant.FORMAT;
+import static store.global.constant.MessageConstant.NEW_LINE;
+import static store.global.constant.MessageConstant.OUTPUT_HEADER_PROMOTION;
+import static store.global.constant.MessageConstant.OUTPUT_HEADER_SEPARATOR;
... | Java | μλ
νμΈμ!
νΉμ μλμ κ°μ΄ ν¬λ§·μ μ€μ νμ
¨μ λ, λμ΄μ°κΈ° λλ¬Έμ μΆλ ₯μ΄ μ¬λ°λ₯΄κ² μ λ ¬μ΄ κ°λ₯νμ
¨λμ?
4μ£Ό μ°¨ μ§ννλ©΄μ μμμ¦ μΆλ ₯ λΆλΆμ 보기 μ’κ² μ 리νλ κ²μ΄ μꡬμ¬νμ΄μμ΄μ λ§μ΄ μ°Ύμλ΄€μ΅λλ€!
κ·Έ κ³Όμ μμ μκ² λ μ μ, νκ΅μ΄λ 2κΈμλ‘ μ·¨κΈλμ§λ§, λμ΄μ°κΈ°μ μμ΄λ 1κΈμλ‘ μ·¨κΈλλ€λ κ²μ
λλ€. κ·Έλμ λμ΄μ°κΈ°λ₯Ό νκΈμ²λΌ 2κΈμ μν μ ν μ μλ λ°©λ²μ΄ μμκΉ κ³ λ―Όνλ€κ°, \u3000 (μ λμ½λ 곡백)μ μκ² λμμ΅λλ€!
μλ₯Ό λ€μ΄, μλμ κ°μ΄ μ¬μ©ν μ μμ΅λλ€:
`String name = String.format("%-14... |
@@ -0,0 +1,89 @@
+package store.domain;
+
+import static store.global.constant.MessageConstant.FORMAT;
+
+import java.text.DecimalFormat;
+import java.util.ArrayList;
+import java.util.List;
+
+public class PaymentProductList {
+
+ private static final DecimalFormat PRICE_FORMAT = new DecimalFormat("###,###");
+
+ ... | Java | μλ
νμΈμ!
μ λ κ³΅ν΅ νΌλλ°±μμ λλ©μΈ κ°μ²΄λ μΆλ ₯κ³Ό κ΄λ ¨λ λ‘μ§μ μ΅λν λ°°μ νκ³ ,
νμν κ²½μ° toStringμ μ€λ²λΌμ΄λνλ μ λλ‘ μ ννλ κ²μ΄ μ’λ€κ³ λ³Έ κ² κ°μ΅λλ€.
νμ¬ ν΄λΉ λΆλΆμ λλ©μΈμμ μΆλ ₯ λ‘μ§μ μ²λ¦¬νκ³ μλ κ²μΌλ‘ 보μ¬μ!
viewμμ μ²λ¦¬νλ λ°©μμ΄ λ μ’μ κ² κ°μλ° μ΄λ»κ² μκ°νμλμ? |
@@ -0,0 +1,223 @@
+package store.controller;
+
+import camp.nextstep.edu.missionutils.DateTimes;
+import java.time.LocalDateTime;
+import java.util.ArrayList;
+import java.util.List;
+import java.util.Map;
+import store.domain.PaymentProductList;
+import store.domain.Product;
+import store.domain.Products;
+import stor... | Java | μ λ μκ°μ΄ μ‘°κΈ λ€λ₯Έ κ², μ λ κ² μ«μλ₯Ό ν΅ν΄ κ°μ μ‘°μν μ μκ² νλ©΄ λ¨μν +1 νλ κ²λ³΄λ€ μ‘°κΈ λ μ±
μμ μ κ°νλ κ²μ΄λΌκ³ ν΄μν μλ μμ§ μλμ? |
@@ -0,0 +1,58 @@
+package store.view;
+
+import static store.global.constant.MessageConstant.FORMAT;
+import static store.global.constant.MessageConstant.NEW_LINE;
+import static store.global.constant.MessageConstant.OUTPUT_HEADER_PROMOTION;
+import static store.global.constant.MessageConstant.OUTPUT_HEADER_SEPARATOR;
... | Java | ν .. ! λ무λλ μ’μ κΏν κ°μ¬λ립λλ€. |
@@ -0,0 +1,48 @@
+package store.domain;
+
+import static store.global.constant.MessageConstant.FORMAT;
+
+import java.text.DecimalFormat;
+
+public class PaymentProduct {
+
+ private static final DecimalFormat PRICE_FORMAT = new DecimalFormat("###,###");
+
+ private final String name;
+ private final int quant... | Java | DecimalFormatμ΄λΌλ ν΄λμ€λ μ²μ 보λ€μ ! λ°°μκ°λλ€ |
@@ -0,0 +1,48 @@
+package store.domain;
+
+import static store.global.constant.MessageConstant.FORMAT;
+
+import java.text.DecimalFormat;
+
+public class PaymentProduct {
+
+ private static final DecimalFormat PRICE_FORMAT = new DecimalFormat("###,###");
+
+ private final String name;
+ private final int quant... | Java | promotion λ³μμ μ νν λ»μ΄ 무μμΈκ°μ?
νλ‘λͺ¨μ
μ¬λΆμΈκ°μ? νλ‘λͺ¨μ
κ°κ²©μΈκ°μ? κ΅³μ΄ int νμ
μΌλ‘ μμ±νμ μ΄μ κ° κΆκΈν©λλ€! |
@@ -0,0 +1,89 @@
+package store.domain;
+
+import static store.global.constant.MessageConstant.FORMAT;
+
+import java.text.DecimalFormat;
+import java.util.ArrayList;
+import java.util.List;
+
+public class PaymentProductList {
+
+ private static final DecimalFormat PRICE_FORMAT = new DecimalFormat("###,###");
+
+ ... | Java | μ°μνν
ν¬μ½μ€μ κ³΅ν΅ νΌλλ°±μμ λ³μλͺ
μ μλ£ν(List) κ°μ κ±Έ λ£μ§ λ§λΌκ³ νλλ°, μ΄μ λν΄ λ³μλ μλμ§λ§ PaymentProductList λΌλ ν΄λμ€ λͺ
μ λν΄ μ΄λ»κ² μκ°νμλμ? |
@@ -0,0 +1,89 @@
+package store.domain;
+
+import static store.global.constant.MessageConstant.FORMAT;
+
+import java.text.DecimalFormat;
+import java.util.ArrayList;
+import java.util.List;
+
+public class PaymentProductList {
+
+ private static final DecimalFormat PRICE_FORMAT = new DecimalFormat("###,###");
+
+ ... | Java | μ¬κΈ°μ - κ°μ κ²μ μμλ‘ μ²λ¦¬νλ κ²μ΄ λμ κ² κ°μλ° μ΄λ»κ² μκ°νμλμ? |
@@ -0,0 +1,89 @@
+package store.domain;
+
+import static store.global.constant.MessageConstant.FORMAT;
+
+import java.text.DecimalFormat;
+import java.util.ArrayList;
+import java.util.List;
+
+public class PaymentProductList {
+
+ private static final DecimalFormat PRICE_FORMAT = new DecimalFormat("###,###");
+
+ ... | Java | μ 체μ μΌλ‘ μ¬κΈ° 8000 μ΄λΌλ μ«μλ κ·Έλ κ³ , μμνλ₯Ό νμΌλ©΄ λ κ°λ
μ±μ΄ μ’μμ κ² κ°μμ! |
@@ -0,0 +1,83 @@
+package store.domain;
+
+import java.time.LocalDate;
+import store.domain.product.Name;
+import store.domain.product.Price;
+import store.domain.product.Quantity;
+
+public class Product {
+
+ private static final String INFO_DELIMITER = " ";
+
+ private final Name name;
+ private final Price... | Java | λͺ¨λ νλκ° λνλμ΄ μλ κ²μ΄ κ°λ
μ±κ³Ό λ‘μ§ λΆλ¦¬μ μ’μ μν₯μ λΌμΉλ κ² κ°μμ! π |
@@ -0,0 +1,46 @@
+package store.domain;
+
+import java.time.LocalDate;
+
+public class Promotions {
+
+ private final String name;
+ private final int buy;
+ private final int get;
+ private final LocalDate startDate;
+ private final LocalDate endDate;
+
+ public Promotions(String name, String buy, St... | Java | μ λ κΆκΈν©λλ€! |
@@ -0,0 +1,32 @@
+package store.global.constant;
+
+public enum ErrorMessage {
+ INVALID_INPUT_PURCHASE("μ¬λ°λ₯΄μ§ μμ νμμΌλ‘ μ
λ ₯νμ΅λλ€. λ€μ μ
λ ₯ν΄ μ£ΌμΈμ."),
+ INVALID_INPUT("μλͺ»λ μ
λ ₯μ
λλ€. λ€μ μ
λ ₯ν΄ μ£ΌμΈμ."),
+
+ INVALID_PRICE_NUMERIC("λ¬Όν κ°κ²©μ μ«μλ§ κ°λ₯ν©λλ€. λ€μ νμΈν΄ μ£ΌμΈμ."),
+ INVALID_PRICE_OUT_OF_RANGE("λ¬Όν κ°κ²©μ λ²μλ΄λ§ λ±λ‘ν μ μμ΅λλ€. λ€μ νμΈν΄ μ£ΌμΈμ... | Java | μ΄λ κ² [ERROR]μ νλ²μ μ²λ¦¬νλ λ°©μ μ’λ€μ. |
@@ -0,0 +1,13 @@
+package store.global.exception;
+
+import store.global.constant.ErrorMessage;
+
+public class FileException extends RuntimeException {
+ public FileException(ErrorMessage error, String fileName) {
+ super(String.format(error.getMessage(), fileName));
+ }
+
+ public FileException(ErrorM... | Java | FileExceiptionμ λ°λ‘ μ μνμ μ΄μ κ° μμκΉμ? κΆκΈν©λλ€. |
@@ -0,0 +1,61 @@
+package store.global.util;
+
+import java.util.ArrayList;
+import java.util.List;
+import store.domain.Product;
+import store.domain.PromotionsList;
+import store.domain.product.Name;
+import store.domain.product.Price;
+import store.domain.product.Quantity;
+
+public class ProductParser {
+ privat... | Java | μ λ FileUtilμμ μ¬μ€ λͺ¨λ νμ±λ μ²λ¦¬νλλ‘ μμ±νλλ°, μ΄λ κ² Parserμ λ°λ‘ ꡬλΆνλ κ²μ΄ λ μ’μ μ€κ³μΈ κ² κ°μ΅λλ€! μΉμ°¬ν΄μ :) |
@@ -0,0 +1,66 @@
+package christmas.domain;
+
+import static christmas.exception.ErrorMessage.DAY_NOT_IN_RANGE;
+import static christmas.exception.ErrorMessage.ENDS_WITH_DELIMITER;
+
+import christmas.domain.constant.EventConstraint;
+import christmas.exception.OrderException;
+
+public class Day {
+ private final i... | Java | EventConstraintμμ μ μΈν μμλ₯Ό κ°μ Έλ€ μ°μ§ μμ μ΄μ κ° μλμ? |
@@ -0,0 +1,64 @@
+package christmas.domain;
+
+import static org.assertj.core.api.Assertions.assertThat;
+import static org.assertj.core.api.Assertions.assertThatThrownBy;
+
+import christmas.domain.constant.EventConstraint;
+import christmas.exception.ErrorMessage;
+import christmas.exception.OrderException;
+import o... | Java | @ParamiterizedTestμ μ΄λ
Έν
μ΄μ
μ νμ©ν΄μ μ€λ³΅μ μ€μΌ μ μμκ±° κ°μ΅λλ€. |
@@ -0,0 +1,5 @@
+const API_URL = `${import.meta.env.VITE_API_URL}`;
+
+export const PRODUCTS_ENDPOINT = `${API_URL}/products`;
+export const CART_ITEMS_ENDPOINT = `${API_URL}/cart-items`;
+export const CART_ITEMS_COUNTS_ENDPOINT = `${CART_ITEMS_ENDPOINT}/counts`; | TypeScript | μ΄λ° endpointλ€μ νλμ κ°μ²΄λ‘ κ΄λ¦¬ν΄λ μ’μ κ² κ°μμ! |
@@ -0,0 +1,49 @@
+const generateBasicToken = (userId: string, userPassword: string): string => {
+ const token = btoa(`${userId}:${userPassword}`);
+ return `Basic ${token}`;
+};
+
+const API_URL = `${import.meta.env.VITE_API_URL}`;
+const USER_ID = `${import.meta.env.VITE_USER_ID}`;
+const USER_PASSWORD = `${import.... | TypeScript | fetchμ νμν μ€λ³΅λ λ‘μ§μ λΆλ¦¬ν λΆλΆ. μΈμμ μ
λλ€. |
@@ -0,0 +1,25 @@
+import { useEffect } from "react";
+import { useErrorContext } from "../../hooks/useErrorContext";
+import { ErrorToastStyle } from "./ErrorToast.style";
+
+const ErrorToast = () => {
+ const { error, hideError } = useErrorContext();
+
+ useEffect(() => {
+ setTimeout(() => {
+ hideError();
... | Unknown | toastλ₯Ό λμ΄μ€ μκ°μ λ°λ‘ μμλ‘ κ΄λ¦¬νλ κ²λ μ’μ κ² κ°μμ |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.