code stringlengths 41 34.3k | lang stringclasses 8
values | review stringlengths 1 4.74k |
|---|---|---|
@@ -1,10 +1,24 @@
import "./App.css";
+import { RecoilRoot } from "recoil";
+import { BrowserRouter, Route, Routes } from "react-router-dom";
+
+import CartPage from "./pages/CartPage";
+import { PATH } from "./constants/path";
+import OrderSummaryPage from "./pages/OrderSummaryPage";
+import { ErrorBoundary } from "r... | Unknown | BrowserRouter์ ๋น๊ตํด์ ๋ํ์ ์ธ ์ฐจ์ด๊ฐ ์ด๋ค ๊ฒ ์์๊น์???
๋ค์์ ํ ๋ฒ ์๋ํด ๋ณด๋๋ก ํด๋ณด๊ฒ ์ต๋๋ค! |
@@ -0,0 +1,31 @@
+import styled from "styled-components";
+
+export interface IButtonProps extends React.HTMLAttributes<HTMLButtonElement> {
+ disabled?: boolean;
+}
+
+export default function Button({ children, ...attributes }: IButtonProps) {
+ return <S.Button {...attributes}>{children}</S.Button>;
+}
+
+const S =... | Unknown | ์ค... ๋๋ฌด ์ข์ ๊ฒ ๊ฐ๋ค์!!
ํน์ ํด๋๋ค์ด๋ฐ์ ๋ํ ์๊ฒฌ๋ ์์ผ์ค๊น์~? `components/styled` ..? |
@@ -0,0 +1,91 @@
+import { useRecoilValue } from "recoil";
+import styled from "styled-components";
+import { deliveryCostState, orderAmountState, totalOrderAmountState } from "../recoil/cartAmount";
+import { ReactComponent as InfoIcon } from "../assets/info-icon.svg";
+
+export interface ICartAmountProps {}
+
+export... | Unknown | ์ฒ์์ ๊ตฌ์กฐ๋ฅผ ์๋ ์์ฑํด์ฃผ๋ ๋ฌด์จ ๋จ์ถ ๋ช
๋ น์ด๊ฐ ์์๋๋ฐ, ๊ฑ๊ฐ ๋ง๋ค์ด์คฌ๊ณ ๊ทธ๊ฑธ ์ง์ฐ์ง ์์์ต๋๋ค... ๋ค๋ฅธ ๋ง์ ์ปดํฌ๋ํธ๊ฐ ๊ทธ๋ ๋ค์...ใ
|
@@ -0,0 +1,82 @@
+import { useSetRecoilState } from "recoil";
+import CartItemView from "./CartItemView";
+import styled from "styled-components";
+import { selectedCartItemIdsState } from "../recoil/selectedCartItemIds";
+import { CartItem } from "../types/cartItems";
+import { useCartItemControl } from "../hooks/useC... | Unknown | ์..ใ
ใ
ใ
ใ
ใ
ใ
ใ
ใ
ใ
ใ
ใ
ใ
์์ต๋๋ค.
์๊ฐ ์๋ฌ ๋ฐ ๊ฑฐ๋ผ ์๊ฐํ๊ณ ์์ฐํ๋ค์. ํ์ง๋ง, `cartItem.id`๊ฐ ๋ง๋ ํํ์ด๊ณ , ์ค์๋ก `product.id`๋ก ํ ๊ฒ ๊ฐ์ต๋๋ค. |
@@ -0,0 +1,145 @@
+import { CartItem } from "../types/cartItems";
+import styled from "styled-components";
+import { UseCartItemsReturn } from "../hooks/useCartItemControl";
+
+export interface CartItemViewProps {
+ cartItem: CartItem;
+ cartItemControl: UseCartItemsReturn;
+}
+
+export default function CartItemView(... | Unknown | ~~์ผ์... ์ด๋ค ์์ผ๋ก ์จ์ผ ์ข์์ง ๊ฐ์ด ์ค์ง ์๋ค์... ํธ์ฅ์ ์งค๋งํ ์์๋ฅผ ๋ค์ด์ฃผ์ค ์ ์์ผ์ค๊น์?~~
์คํธ~ ์ข๋ค์. ๊ฟ ํ ๊ฐ์ฌํฉ๋๋ค. ํ ๊ฐ์ง ์ด์ผ๊ธฐ ๋๋ ๋ณด๊ณ ์ถ์ ๋ถ๋ถ์ด ์์ต๋๋ค!
์ด๋ค ํจ์๋ฅผ ๋ง๋ค ๋ ์ธํฐํ์ด์ค๋ฅผ ๋ง๋ค์ด๋๋ฉด ๊ตฌ์กฐ๊ฐ ๋จธ๋ฆฌ์ ์ ๋ค์ด์ค๋ ๊ฒ ๊ฐ๋ค๊ณ ์๊ฐํด์. ์ด๋ฐ ์ธก๋ฉด์์ ๋ฐํ ํ์
์ ๋ณ๋๋ก ๋ง๋๋ ๊ฒ ์ข๋ค๊ณ ์๊ฐ์ ํ๋๋ฐ, ๋ํ์ ์๊ฒฌ์ ๋ค์ด๋ณด๊ณ ์ถ๋ค์!! |
@@ -0,0 +1,91 @@
+import { RecoilRoot, useRecoilState } from "recoil";
+
+import { act } from "react";
+import { renderHook } from "@testing-library/react";
+import { updateCartItemQuantity } from "../api/cartItems";
+import { useCartItemControl } from "./useCartItemControl";
+
+jest.mock("recoil", () => ({
+ ...jest.... | TypeScript | ํ
์คํธ ์ฝ๋ ์์ฑ ์ค ํฌ๊ธฐํ ์ฝ๋์
๋๋ค! ๋ชจํนํ setSelectedCartItemIds์ ๋ด๋ถ callback์์ ๋ฌธ์ ๊ฐ ๋ฐ์ํ๊ณ ์๋๋ฐ, ํด๊ฒฐ์ ๋ชปํด์ ์ฃผ์์ผ๋ก ์ฒ๋ฆฌํ์ด์. ์์ฌ์์ ์ง์ฐ์ง ์๊ณ ๋
๋์ต๋๋ค... |
@@ -0,0 +1,22 @@
+import Header from "../components/Header";
+import styled from "styled-components";
+import CartContent from "../components/CartContent";
+import { Suspense } from "react";
+
+export default function CartPage() {
+ return (
+ <S.Container>
+ <Header hasBackButton={false} title="SHOP" />
+ ... | Unknown | ์ ํํ ๊ฐ์ ๋ถ๋ถ์ ํผํฐ์๊ฒ ์ฝ๋ฉํธ๋ฅผ ๋ฐ์์ด์! ๋ํ ๋ ์นด๋ก์์ด ๊ฑฐ์ ๋ญ ํ์ง์๋ฐ์? ๐
"์ ์ฒด ๋ ์ด์์์ด ์ ์ง๋๋๋ก ์คํ์ผ๋ง์ ํด์ฃผ๋ฉด, CLS(Cumulative Layout Shift)๋ฅผ ๋ฐฉ์งํ ์ ์์ ๊ฒ"์ด๋ผ๋ ํผํฐ์ ์ฝ๋ฉํธ๋ฅผ ๊ณต์ ํด๋๋ฆฝ๋๋ค! |
@@ -0,0 +1,31 @@
+import styled from "styled-components";
+
+export interface IButtonProps extends React.HTMLAttributes<HTMLButtonElement> {
+ disabled?: boolean;
+}
+
+export default function Button({ children, ...attributes }: IButtonProps) {
+ return <S.Button {...attributes}>{children}</S.Button>;
+}
+
+const S =... | Unknown | ps. ์ ๋ ๊ฐ์ธ์ ์ผ๋ก `common` ์ด๋ผ๋ ํด๋๋ฅผ ์ฌ์ฉํฉ๋๋ค...! |
@@ -0,0 +1,91 @@
+import { useRecoilValue } from "recoil";
+import styled from "styled-components";
+import { deliveryCostState, orderAmountState, totalOrderAmountState } from "../recoil/cartAmount";
+import { ReactComponent as InfoIcon } from "../assets/info-icon.svg";
+
+export interface ICartAmountProps {}
+
+export... | Unknown | S-dot ์ปจ๋ฒค์
์ข๋ค์๐ ๋ค์์ ์ ๋ ์จ๋ด์ผ๊ฒ ์ด์! |
@@ -0,0 +1,21 @@
+import { useNavigate } from "react-router-dom";
+import { PATH } from "../constants/path";
+import Button from "./Button";
+import { useRecoilValue } from "recoil";
+import { selectedCartItemIdsState } from "../recoil/selectedCartItemIds";
+
+export default function CartButton() {
+ const navigate = ... | Unknown | ๋ฒํผ ์ปดํฌ๋ํธ์์ disabled, onClick์ ๋ฐ์ ์ ์๊ฒ ํด์ค๋ ์ข์์ ๊ฒ ๊ฐ์์! ๊ทธ๋ผ `CartButton` ์ปดํฌ๋ํธ๋ฅผ ๋ณ๋๋ก ๋ง๋ค์ง ์๊ณ `Button` ์ปดํฌ๋ํธ๋ฅผ ๋ฐ๋ก ์ฌ์ฌ์ฉํ ์ ์์ ๊ฒ ๊ฐ์ต๋๋ค!ใ
ใ
(์๋๋ฉด ํน์ ๋ณ๋๋ก ์ด๋ ๊ฒ ๋ง๋ค์ด์ฃผ์ ์ฐ์ ๊ฐ ์์ผ์ค๊น์?) |
@@ -0,0 +1,50 @@
+import styled from "styled-components";
+import { cartItemsState } from "../recoil/cartItems";
+import { useRecoilValue } from "recoil";
+import CartTitle from "./CartTitle";
+import CartItemList from "./CartItemList";
+import CartAmount from "./CartAmount";
+import CartButton from "./CartButton";
+
+... | Unknown | ์ค! ํ๊ตญ์ด๋ก ๋ณ์๋ฅผ ์ ์ธํด์ฃผ์ ์ด์ ๊ฐ ์์ผ์ค๊น์? ๋ณดํต ๋ณ์๋ ์์ด๋ก ์ ์ธํ๋๋ฐ ์ฌ๊ธฐ ํ๊ตญ๋ง์ด๋ผ ์กฐ๊ธ ๋ฎ์ค๊ณ ์ ๊ธฐํ๋ค์! |
@@ -0,0 +1,49 @@
+import { useRecoilState, useSetRecoilState } from "recoil";
+import { removeCartItem, updateCartItemQuantity } from "../api/cartItems";
+import { CartItemId } from "../types/cartItems";
+import { rawCartItemsState } from "../recoil/rawCartItems";
+import { selectedCartItemIdsState } from "../recoil/se... | TypeScript | ๋ณ๋์ hook์ผ๋ก ๋ถ๋ฆฌํด์ฃผ์
จ๊ตฐ์! ์๊ฐํด๋ณด์ง ๋ชปํ๋ ๋ฐฉ๋ฒ์ธ๋ฐ, ์ด๋ ๊ฒ ๋ชจ์๋๋ ๊ต์ฅํ ๊ด์ฌ์ฌ ๋ถ๋ฆฌ๊ฐ ์ ์ด๋ฃจ์ด์ก๋ค๋ ์๊ฐ์ด ๋ค์์ด์๐๐๐ |
@@ -1,10 +1,24 @@
import "./App.css";
+import { RecoilRoot } from "recoil";
+import { BrowserRouter, Route, Routes } from "react-router-dom";
+
+import CartPage from "./pages/CartPage";
+import { PATH } from "./constants/path";
+import OrderSummaryPage from "./pages/OrderSummaryPage";
+import { ErrorBoundary } from "r... | Unknown | ์ ๊ฐ ์ ์๋ฏธํ ์ฐจ์ด์ ๋ํด์๋ ์์๋ณด์ง ๋ชปํด์ ๋ต๋ณ์ ์ฃ๋ถ๋ฆฌ ๋๋ฆด ์๊ฐ ์๋ค์..!
๋ค๋ง, ์กฐ๊ธ ๋ ์ต์ ๋ฌธ๋ฒ์ด๋ค ๋ณด๋ ์ต์ ๋ฌธ๋ฒ์ ๋ง์ถฐ์ ์ ์ฉํด๋ด๋ ๊ด์ฐฎ์ง ์์๊น ์ถ์์ต๋๋ค!
[ํด๋น ๋ธ๋ก๊ทธ](https://velog.io/@kimbyeonghwa/createBrowserRouter-vs-BrowserRouter)์์๋
๋ชจ๋ํ๊ฐ ๊ฐ๋ฅํ ์ ์ ๊ผฝ์๋ค์!
์ ๋ ๋ชจ๋ํ๊ฐ ๊ฐ๋ฅํ ์ ์ด ๊ฐ์ฅ ์ด์ ์ด ํฌ๋ค๊ณ ์๊ฐํ์ด์!
https://github.com/Largopie/react-shopping-cart/blob/step1/src/router.tsx
๊ฐ์ธ์ ... |
@@ -0,0 +1,31 @@
+import styled from "styled-components";
+
+export interface IButtonProps extends React.HTMLAttributes<HTMLButtonElement> {
+ disabled?: boolean;
+}
+
+export default function Button({ children, ...attributes }: IButtonProps) {
+ return <S.Button {...attributes}>{children}</S.Button>;
+}
+
+const S =... | Unknown | ์ ๋ ๊ณต์ฉ์ ์ผ๋ก ์ฌ์ฉํ๋ ์ปดํฌ๋ํธ๋ ๋ณดํต `common` ์ฌ์ฉํฉ๋๋ค! ๐
๋จ์ง ์คํ์ผ์ ์ํด์ ์ฌ์ฉํ๋ ์ฝ๋๋ผ๋ฉด styled๋ผ๊ณ ๋ถ์ฌ๋ ๊ด์ฐฎ์ ๊ฒ ๊ฐ๋ค์! |
@@ -0,0 +1,146 @@
+import pickle
+import pandas as pd
+import numpy as np
+import re
+from openai import OpenAI
+import os
+from tqdm import tqdm
+import time
+
+def clean(answer):
+ '''
+ ์ฃผ์ด์ง ๋ต๋ณ์ ์ ์ฒ๋ฆฌํ๋ ํจ์
+ Args:
+ answer (str) : FAQ์ ๋ต๋ณ ๋ฐ์ดํฐ
+ Returns:
+ answer (str) : ์ ์ฒ๋ฆฌ๋ ๋ต๋ณ ๋ฐ์ดํฐ
+ re... | Python | ํ์ผ๋ช
์ ๋์ฌ |
@@ -0,0 +1,146 @@
+import pickle
+import pandas as pd
+import numpy as np
+import re
+from openai import OpenAI
+import os
+from tqdm import tqdm
+import time
+
+def clean(answer):
+ '''
+ ์ฃผ์ด์ง ๋ต๋ณ์ ์ ์ฒ๋ฆฌํ๋ ํจ์
+ Args:
+ answer (str) : FAQ์ ๋ต๋ณ ๋ฐ์ดํฐ
+ Returns:
+ answer (str) : ์ ์ฒ๋ฆฌ๋ ๋ต๋ณ ๋ฐ์ดํฐ
+ re... | Python | ์ฃผ์์ ์ข์ผ๋ ํ์ดํ๋ |
@@ -0,0 +1,146 @@
+import pickle
+import pandas as pd
+import numpy as np
+import re
+from openai import OpenAI
+import os
+from tqdm import tqdm
+import time
+
+def clean(answer):
+ '''
+ ์ฃผ์ด์ง ๋ต๋ณ์ ์ ์ฒ๋ฆฌํ๋ ํจ์
+ Args:
+ answer (str) : FAQ์ ๋ต๋ณ ๋ฐ์ดํฐ
+ Returns:
+ answer (str) : ์ ์ฒ๋ฆฌ๋ ๋ต๋ณ ๋ฐ์ดํฐ
+ re... | Python | ์๊ฑฐ๋ ๋ฐ์ผ๋ก |
@@ -0,0 +1,146 @@
+import pickle
+import pandas as pd
+import numpy as np
+import re
+from openai import OpenAI
+import os
+from tqdm import tqdm
+import time
+
+def clean(answer):
+ '''
+ ์ฃผ์ด์ง ๋ต๋ณ์ ์ ์ฒ๋ฆฌํ๋ ํจ์
+ Args:
+ answer (str) : FAQ์ ๋ต๋ณ ๋ฐ์ดํฐ
+ Returns:
+ answer (str) : ์ ์ฒ๋ฆฌ๋ ๋ต๋ณ ๋ฐ์ดํฐ
+ re... | Python | ๋์ด์ ํ๋๊ฒ ๋์ ๊ฒ ๊ฐ๋ค |
@@ -0,0 +1,135 @@
+import pandas as pd
+import os
+from openai import OpenAI
+from sklearn.metrics.pairwise import cosine_similarity
+
+
+def embed(text):
+ '''
+ ํ
์คํธ๋ฅผ ์๋ฒ ๋ฉํ๋ ํจ์
+ Args:
+ text (str) : ์๋ฒ ๋ฉํ ํ
์คํธ
+ Returns:
+ embedding (list) : ํ
์คํธ์ ์๋ฒ ๋ฉ
+ '''
+
+ response = client.embeddings.create(input = text... | Python | ๋ฐ์ผ๋ก |
@@ -0,0 +1,135 @@
+import pandas as pd
+import os
+from openai import OpenAI
+from sklearn.metrics.pairwise import cosine_similarity
+
+
+def embed(text):
+ '''
+ ํ
์คํธ๋ฅผ ์๋ฒ ๋ฉํ๋ ํจ์
+ Args:
+ text (str) : ์๋ฒ ๋ฉํ ํ
์คํธ
+ Returns:
+ embedding (list) : ํ
์คํธ์ ์๋ฒ ๋ฉ
+ '''
+
+ response = client.embeddings.create(input = text... | Python | ํธ์ถํ ๋ ์ด๋ฆ๊น์ง |
@@ -0,0 +1,135 @@
+import pandas as pd
+import os
+from openai import OpenAI
+from sklearn.metrics.pairwise import cosine_similarity
+
+
+def embed(text):
+ '''
+ ํ
์คํธ๋ฅผ ์๋ฒ ๋ฉํ๋ ํจ์
+ Args:
+ text (str) : ์๋ฒ ๋ฉํ ํ
์คํธ
+ Returns:
+ embedding (list) : ํ
์คํธ์ ์๋ฒ ๋ฉ
+ '''
+
+ response = client.embeddings.create(input = text... | Python | ๋์ด์ฐ๊ธฐ |
@@ -0,0 +1,135 @@
+import pandas as pd
+import os
+from openai import OpenAI
+from sklearn.metrics.pairwise import cosine_similarity
+
+
+def embed(text):
+ '''
+ ํ
์คํธ๋ฅผ ์๋ฒ ๋ฉํ๋ ํจ์
+ Args:
+ text (str) : ์๋ฒ ๋ฉํ ํ
์คํธ
+ Returns:
+ embedding (list) : ํ
์คํธ์ ์๋ฒ ๋ฉ
+ '''
+
+ response = client.embeddings.create(input = text... | Python | ํ์คํ ๋ฆฌ๋ฅผ ๋ค๋ฅธ ์๋ฃํ ์ฐ๋๊ฒ ๋์๊ฒ ๊ฐ์ต๋๋ค str๋ณด๋ค๋ |
@@ -0,0 +1,5 @@
+package store.constants;
+
+public class MembershipConstants {
+ public static final double DISCOUNT_RATE = 0.30;
+} | Java | ์ด ๋ถ๋ถ์ ํด๋์ค๋ฅผ ์์ฑํ ์ ์๊ฒ๋ ์์ฑ์๋ฅผ private์ผ๋ก ๋ง๋ค๋ฉด ์ข์ ๊ฒ ๊ฐ์์. |
@@ -0,0 +1,18 @@
+package store.constants;
+
+public class ReceiptConstants {
+ public static final String ORDER_DETAIL_FORMAT = "%-10s %6s %12s";
+ public static final String PROMOTION_DETAIL_FORMAT = "%-10s %6s";
+ public static final String TOTAL_DETAIL_FORMAT = "%-10s %18s";
+ public static final Strin... | Java | Enum์ ์ฌ์ฉํ์ง ์์ผ์ ์ด์ ๊ฐ ์์๊น์?
String.format์ ์ฌ์ฉํ์ค ๋ Enum ๋ด์ ๋ณํํด์ ๋ฐํํ๋ฉด OuptView์์๋ ๋ ๊น๋ํ๊ฒ ๋ก์ง์ ์ฒ๋ฆฌํ ์ ์์ ๊ฒ ๊ฐ์์! |
@@ -0,0 +1,38 @@
+package store.controller;
+
+import java.util.List;
+import java.util.Map;
+import store.domain.Product;
+import store.domain.Promotion;
+import store.dto.StoreDto;
+import store.dto.StoreInitializationDto;
+import store.parser.ProductParser;
+import store.parser.PromotionParser;
+import store.service... | Java | ์ด๋ฐ ๋ถ๋ถ์ private๋ฅผ ํตํด ์บก์ํํ๋ ๊ฒ์ด ์ด๋จ๊น์? |
@@ -0,0 +1,23 @@
+package store.controller;
+
+import store.domain.Store;
+import store.dto.StoreDto;
+import store.service.StoreService;
+
+public class StoreController {
+
+ private final StoreService storeService;
+
+ public StoreController() {
+ this.storeService = new StoreService();
+ }
+
+ pub... | Java | ์ธ๋ถ์์ ์์กด์ฑ ์ฃผ์
ํ๋ ๋ฐฉ์์ ์ฌ์ฉํ์ง ์์ผ์ ์ด์ ๊ฐ ์์๊น์? |
@@ -0,0 +1,35 @@
+package store.domain;
+
+import java.util.LinkedHashMap;
+import java.util.List;
+import java.util.Map;
+
+public class Cart {
+ private final Map<String, CartItem> cartItems;
+
+ public Cart() {
+ this.cartItems = new LinkedHashMap<>();
+ }
+
+ public void addItem(List<CartItem> ca... | Java | Stream API๋ ๊ฐ๋
์ฑ์ ์ํด ์ํฐ๋ฅผ ์ฌ์ฉํ๋ฉด ๋ ์ข์ ๊ฒ ๊ฐ์์! |
@@ -0,0 +1,56 @@
+package store.domain;
+
+import static store.message.ErrorMessage.INSUFFICIENT_STOCK_ERROR;
+
+import store.validation.CartItemValidator;
+
+public class CartItem {
+ private final Product product;
+ private int quantity;
+ private int freeQuantity;
+
+ public CartItem(Product product, int... | Java | ๋๋ฏธํฐ ๋ฒ์น์ ์ค์ํ๊ธฐ ์ํด ์์ฑํ์ ๋ฉ์๋๋ก ๋ณด์
๋๋ค. ์ ๋ ์ด๋ฐ ๋ฐฉ์์ผ๋ก ์งํํ๋๋ฐ์, 3์ฃผ์ฐจ ํผ๋๋ฐฑ๊ณผ ์๋ฐ ์คํ์ผ ๊ฐ์ด๋์์ Getter๋ฅผ ์ฌ์ฉํ๊ธฐ๋ณด๋ค ๊ฐ์ฒด ๋ด์์ ์ฒ๋ฆฌํ๋ ๋ฐฉ์์ด ๋ ์ข๋ค๋ ๋ด์ฉ์ด ์์์ต๋๋ค.
์ด ๋ถ๋ถ์ ์ด๋ป๊ฒ ์๊ฐํ์๋์? |
@@ -0,0 +1,136 @@
+package store.domain;
+
+import static store.constants.ProductConstants.OUT_OF_STOCK;
+import static store.constants.ProductConstants.PRODUCT_DESCRIPTION_PREFIX;
+import static store.constants.ProductConstants.UNIT_QUANTITY;
+import static store.constants.ProductConstants.UNIT_WON;
+import static sto... | Java | 1์ฃผ์ฐจ ํผ๋๋ฐฑ์์, ์ฃผ์์ ์ฌ์ฉํ๊ธฐ ๋ณด๋ค๋ ๋ฉ์๋๋ช
์ ํตํด ์๋๋ฅผ ํ์
ํ๊ฒ ํ๋ ๊ฒ์ด ๋ ์ข๋ค๋ ๋ด์ฉ์ด ์์์ต๋๋ค. ์ด ๋ถ๋ถ์ ๋ฐ๋ก ์ฃผ์์ ํ์ํ ์ด์ ๊ฐ ์์๊น์? |
@@ -0,0 +1,55 @@
+package store.domain;
+
+import java.time.LocalDateTime;
+import store.dto.PromotionDto;
+import store.util.DateUtil;
+import store.validation.PromotionValidator;
+
+public class Promotion {
+
+ private String name; //ํ๋ก๋ชจ์
๋ช
+ private int buy; // ๊ตฌ๋งค์กฐ๊ฑด
+ private int get; //์ฆ์ ์๋
+ private Loc... | Java | ์๊ฒ๋ ์ฃผ์๋ณด๋ค๋ ๋ณ์๋ช
์ ์ ์ง๋๊ฒ ์ข์ ๊ฒ ๊ฐ์์! |
@@ -0,0 +1,55 @@
+package store.domain;
+
+import java.time.LocalDateTime;
+import store.dto.PromotionDto;
+import store.util.DateUtil;
+import store.validation.PromotionValidator;
+
+public class Promotion {
+
+ private String name; //ํ๋ก๋ชจ์
๋ช
+ private int buy; // ๊ตฌ๋งค์กฐ๊ฑด
+ private int get; //์ฆ์ ์๋
+ private Loc... | Java | getGet() ๋ฉ์๋๋ช
์ ๋ณด์๋ฉด ๊ฐ๋
์ฑ์ด ๋งค์ฐ ๋จ์ด์ง๋ ๊ฒ ๊ฐ์์! |
@@ -0,0 +1,152 @@
+package store.domain;
+
+import static store.constants.ReceiptConstants.EVENT_DISCOUNT;
+import static store.constants.ReceiptConstants.FINAL_AMOUNT;
+import static store.constants.ReceiptConstants.LINE_SEPARATOR;
+import static store.constants.ReceiptConstants.MEMBERSHIP_DISCOUNT;
+import static sto... | Java | ์ฌ๊ธฐ๋ ์ ๋น๋ผ์ธ์ ์ถ๊ฐํ์ง ์์ผ์
จ๋์? ์ด์ ์ฝ๋์๋ ์ผ๊ด์ฑ ์๊ฒ ์ถ๊ฐํ ๊ฒ ๊ฐ์์์! |
@@ -0,0 +1,152 @@
+package store.domain;
+
+import static store.constants.ReceiptConstants.EVENT_DISCOUNT;
+import static store.constants.ReceiptConstants.FINAL_AMOUNT;
+import static store.constants.ReceiptConstants.LINE_SEPARATOR;
+import static store.constants.ReceiptConstants.MEMBERSHIP_DISCOUNT;
+import static sto... | Java | ๊ฐํ ๋ฌธ์๋ ์์ํํ๋ฉด ์ด๋ ์ ๊ฐ์? |
@@ -0,0 +1,68 @@
+package store.parser;
+
+import static store.message.ErrorMessage.INVALID_DATA_FORMAT;
+
+import java.util.List;
+import store.dto.ProductDto;
+import store.dto.PromotionDto;
+
+public class FileReaderParser {
+
+ private static final String COMMA_DELIMITER = ",";
+ private static final String N... | Java | ํ์ ๊ฐ์ ๊ฒฝ์ฐ๋ ์ ํธ ํด๋์ค๋ก ๋ฐ๋ก ์์ฑํ์ง ์์ผ์ ์ด์ ๊ฐ ์์๊น์? |
@@ -0,0 +1,21 @@
+package store;
+
+import store.controller.FileReaderController;
+import store.controller.StoreController;
+import store.domain.Store;
+import store.dto.StoreDto;
+
+public class FrontController {
+ private final FileReaderController fileReaderController;
+ private final StoreController storeCont... | Java | frontController๋ฅผ ์ด์ฉํด์ ํ์ผ ๋จผ์ ์
๋ ฅ์ ๋ฐ์ผ์
จ๊ตฐ์ ์ข์๊ฒ ๊ฐ์์! ๐ |
@@ -0,0 +1,136 @@
+package store.domain;
+
+import static store.constants.ProductConstants.OUT_OF_STOCK;
+import static store.constants.ProductConstants.PRODUCT_DESCRIPTION_PREFIX;
+import static store.constants.ProductConstants.UNIT_QUANTITY;
+import static store.constants.ProductConstants.UNIT_WON;
+import static sto... | Java | ์ด๋ฆ์ ๋ณ๊ฒฝ ๊ฐ๋ฅ์ฑ์ด ์๊ธฐ๋๋ฌธ์ final๋ก ์ ์ธํด์ฃผ๋ฉด ์ข์ ๊ฒ ๊ฐ์์! |
@@ -0,0 +1,136 @@
+package store.domain;
+
+import static store.constants.ProductConstants.OUT_OF_STOCK;
+import static store.constants.ProductConstants.PRODUCT_DESCRIPTION_PREFIX;
+import static store.constants.ProductConstants.UNIT_QUANTITY;
+import static store.constants.ProductConstants.UNIT_WON;
+import static sto... | Java | Optional ์ข๋ค์ ๐ |
@@ -0,0 +1,136 @@
+package store.domain;
+
+import static store.constants.ProductConstants.OUT_OF_STOCK;
+import static store.constants.ProductConstants.PRODUCT_DESCRIPTION_PREFIX;
+import static store.constants.ProductConstants.UNIT_QUANTITY;
+import static store.constants.ProductConstants.UNIT_WON;
+import static sto... | Java | Model์์ DTO๋ฅผ ์์กดํ๋ฉด View์ ์์กดํ๋๊ฒ๊ณผ ๋น์ทํ๋ค๊ณ ์๊ฐํฉ๋๋ค.
DTO์ ๋ณ๊ฒฝ์ Model์ ์ฝ๋๊ฐ ๋ณ๊ฒฝ๋์ด์ผํด์!
Service์์ DTO๊ด๋ จ๋ ๋ก์ง์ ์ ์ฒ๋ฆฌ ํด์ฃผ๋ฉด ์ข์ ๊ฒ ๊ฐ์์๐ |
@@ -0,0 +1,136 @@
+package store.domain;
+
+import static store.constants.ProductConstants.OUT_OF_STOCK;
+import static store.constants.ProductConstants.PRODUCT_DESCRIPTION_PREFIX;
+import static store.constants.ProductConstants.UNIT_QUANTITY;
+import static store.constants.ProductConstants.UNIT_WON;
+import static sto... | Java | Optional์ ๊ธฐ๋ฅ์ ํ์ฉํด๋ณด๋ฉด ์ด๋จ๊น์!?
```suggestion
public boolean isEligibleForStandardPromotion(int orderedQuantity) {
return promotion.map(promotionInfo ->
orderedQuantity <= quantity &&
getRemainingItemsForPromotion(orderedQuantity, promotionInfo) + promotionInfo.getGet() <= quantity
... |
@@ -0,0 +1,136 @@
+package store.domain;
+
+import static store.constants.ProductConstants.OUT_OF_STOCK;
+import static store.constants.ProductConstants.PRODUCT_DESCRIPTION_PREFIX;
+import static store.constants.ProductConstants.UNIT_QUANTITY;
+import static store.constants.ProductConstants.UNIT_WON;
+import static sto... | Java | ๊ผผ๊ผผํจ์ด ๋ณด์ด๋ค์ ๐ |
@@ -0,0 +1,152 @@
+package store.domain;
+
+import static store.constants.ReceiptConstants.EVENT_DISCOUNT;
+import static store.constants.ReceiptConstants.FINAL_AMOUNT;
+import static store.constants.ReceiptConstants.LINE_SEPARATOR;
+import static store.constants.ReceiptConstants.MEMBERSHIP_DISCOUNT;
+import static sto... | Java | Model๋ ์ด์ด์์ View์ ๋ด์ฉ์ ๊ฐ๊ณตํ๊ธฐ ๋ณด๋จ, Controller or Service์์ ์งํํด์ฃผ๋๊ฑด ์ด๋จ๊น์?
์ง๊ธ์ View๊ฐ ๋ณ๊ฒฝ๋๋ฉด Model๋ ๋ณ๊ฒฝ๋์ด์ผ ํ ๊ฒ ๊ฐ์์! |
@@ -0,0 +1,152 @@
+package store.domain;
+
+import static store.constants.ReceiptConstants.EVENT_DISCOUNT;
+import static store.constants.ReceiptConstants.FINAL_AMOUNT;
+import static store.constants.ReceiptConstants.LINE_SEPARATOR;
+import static store.constants.ReceiptConstants.MEMBERSHIP_DISCOUNT;
+import static sto... | Java | ํจ์ํ ์ธํฐํ์ด์ค๋ depth๊ฐ ์๋ค๊ณ ์๊ฐํฉ๋๋ค!
๋ชจ๋ํ๋ฅผ ํด๋ณด๋๊ฑด ์ด๋จ๊น์? |
@@ -0,0 +1,68 @@
+package store.parser;
+
+import static store.message.ErrorMessage.INVALID_DATA_FORMAT;
+
+import java.util.List;
+import store.dto.ProductDto;
+import store.dto.PromotionDto;
+
+public class FileReaderParser {
+
+ private static final String COMMA_DELIMITER = ",";
+ private static final String N... | Java | ๋งค์ง ๋๋ฒ๋ฅผ ์์ํ ํด์ฃผ๋ฉด ์ข์๊ฒ๊ฐ๋ค์๐ |
@@ -0,0 +1,153 @@
+package store.parser;
+
+import static store.message.ErrorMessage.INVALID_INPUT_FORMAT_ERROR;
+
+import java.util.ArrayList;
+import java.util.HashSet;
+import java.util.List;
+import java.util.Set;
+import store.dto.CartItemDto;
+
+public class InputParser {
+ private static final String ITEM_SEP... | Java | confirm๊ณผ ๊ฐ์ ๋ณ์๋ช
์ ์ด๋จ๊น์? |
@@ -0,0 +1,128 @@
+package store.parser;
+
+import static store.constants.PromotionConstants.NO_PROMOTION_SUFFIX;
+import static store.constants.PromotionConstants.PROMOTION_SUFFIX;
+import static store.message.ErrorMessage.EMPTY_DATA;
+
+import java.util.ArrayList;
+import java.util.LinkedHashMap;
+import java.util.Li... | Java | depth๊ฐ ๋ค์ ๊น์ ๊ฒ ๊ฐ์์!
๋ชจ๋ํ๋ฅผ ํด๋ณด๋๊ฑด ์ด๋จ๊น์? |
@@ -1,7 +1,20 @@
package christmas;
+import christmas.domain.EventController;
+import christmas.global.config.Dependency;
+import christmas.global.view.output.OutputView;
+
+import static christmas.global.exception.CommonExceptionMessage.EXCEPTION_PREFIX;
+
public class Application {
public static void main(St... | Java | ์๋ชป๋ ์
๋ ฅ์ ๋ชจ๋ ์์ธ ํด๋์ค๋ก ๋ง๋ค์ด์ Application ๋ด์์ catch๋๋๊ฒ ํฅ๋ฏธ๋กญ๊ณ ํจ์จ์ ์ธ ๊ฒ ๊ฐ๋ค์! ์ ๋ฐฐ์ฐ๊ณ ๊ฐ๋๋ค |
@@ -0,0 +1,114 @@
+package christmas.domain.order;
+
+import christmas.domain.order.enums.food.Food;
+import christmas.domain.order.enums.food.FoodCategory;
+
+import java.util.*;
+
+import static christmas.global.exception.OrderExceptionMessage.INVALID_ORDERS;
+import static christmas.domain.order.enums.OrderNumberDef... | Java | ์ค๋ณต๊ฒ์ฆ์ ๋ก์ง์ ์จ์ ํ validateDuplicateMenu ๋ฉ์๋๋ก ๋๊ธฐ๋ ๊ฒ๋ ์ข์ง ์์๊น ์๊ฐํด๋ด
๋๋ค! |
@@ -0,0 +1,32 @@
+package christmas.domain.sale.enums;
+
+import christmas.domain.calendar.enums.Week;
+import christmas.domain.order.enums.food.FoodCategory;
+
+import java.util.Arrays;
+
+import static christmas.domain.calendar.enums.Week.WEEKDAY;
+import static christmas.domain.calendar.enums.Week.WEEKEND;
+import s... | Java | SaleTarget์ด๋ผ๋ enum์ผ๋ก ํ์ผ๊ณผ ์ฃผ๋ง์ ํ ์ธ์ ์ฒ๋ฆฌํ์ ๋ถ๋ถ์ด ๊ต์ฅํ ํฅ๋ฏธ๋ก์ด๋ฐ ์ผ๋ฐ ํด๋์ค๊ฐ ์๋๋ผ enum์ผ๋ก ํ์ ์ด์ ๊ฐ ๋ฌด์์ธ๊ฐ์? |
@@ -0,0 +1,114 @@
+package christmas.domain.order;
+
+import christmas.domain.order.enums.food.Food;
+import christmas.domain.order.enums.food.FoodCategory;
+
+import java.util.*;
+
+import static christmas.global.exception.OrderExceptionMessage.INVALID_ORDERS;
+import static christmas.domain.order.enums.OrderNumberDef... | Java | ์ฃผ๋ฌธํ ๋ฉ๋ด ๋ชฉ๋ก์ ์์ฑํ๊ธฐ ์ํด Food.generateOrderedMenu๋ฅผ ํธ์ถํ์ ์ด์ ๊ฐ ๊ถ๊ธํฉ๋๋ค.
์ถ๋ ฅ ํ์์ ๋ณํ ์๊ธฐ๋ฉด Food enum์ด ์ํฅ์ ๋ฐ๋ ๋์ Orders๊ฐ ์ํฅ์ ๋ฐ๋ ๊ฒ์ด ๋ ์์ฐ์ค๋ฝ์ง ์์๊น ํ๋ ์๊ฐ์์ ์ง๋ฌธ๋๋ฆฝ๋๋ค! |
@@ -0,0 +1,25 @@
+package christmas.domain.calendar.dto;
+
+import static christmas.global.exception.DateExceptionMessage.INVALID_DATE;
+
+public record DateDto(String date) {
+
+ public DateDto {
+ validateDateIsNotNull(date);
+ validateDateIsNumber(date);
+ }
+
+ private void validateDateIsNotN... | Java | ์ฝ๋ ์ฝ๋ค๊ฐ record์ ๋ํด ์๋กญ๊ฒ ์๊ฒ ๋์์ต๋๋ค. ์ ๋ง ๊ฐ์ฌํฉ๋๋ค ๐ฅน |
@@ -0,0 +1,94 @@
+package christmas.domain.sale;
+
+import christmas.domain.calendar.EventCalendar;
+import christmas.domain.calendar.enums.Week;
+import christmas.domain.order.Orders;
+import christmas.domain.order.enums.food.FoodCategory;
+import christmas.domain.sale.enums.BenefitCategory;
+import christmas.domain.s... | Java | christmasDDaySale ์ฒ๋ผ starDateSale๋ก ๊ด๋ฆฌํ๋ฉด ๋ ์ผ๊ด์ฑ ์์ด ์ข์ ๊ฒ ๊ฐ์ต๋๋ค :> |
@@ -0,0 +1,38 @@
+package christmas.domain.calendar.enums;
+
+import christmas.domain.sale.enums.BenefitCategory;
+
+import java.time.DayOfWeek;
+import java.time.LocalDate;
+
+import static christmas.domain.sale.enums.BenefitCategory.WEEKDAY_SALE;
+import static christmas.domain.sale.enums.BenefitCategory.WEEKEND_SALE... | Java | enum ํด๋์ค์ ํ์ฉ๋๊ฐ ๊ต์ฅํ ๋์ผ์ ๊ฒ ๊ฐ์์! enum ์ฌ์ฉ๋ฒ ๋ง์ด ๋ฐฐ์๊ฐ๋๋ค ใ
ใ
|
@@ -0,0 +1,49 @@
+package christmas.domain;
+
+import christmas.global.view.io.EventCalendarView;
+import christmas.global.view.io.OrdersView;
+import christmas.global.view.io.BenefitDetailsView;
+import christmas.global.view.output.OutputView;
+
+import static christmas.global.view.message.OrderDynamicMessage.SHOW_EVE... | Java | P5: ํจํค์ง์ด ๋ฌํ ๊ฒ์ด์ด์ ใ
ใ
ใ
์ด๋ค ๋ชฉ์ ์ผ๋ก ํจํค์ง์ ํ์
จ๋์ง ๊ถ๊ธํฉ๋๋น ๐ค
(docs/README.md์ ์ถ๊ฐํด์ฃผ์
๋ ์ข์์ ๊ฒ ๊ฐ๊ณ ์?!) |
@@ -0,0 +1,29 @@
+package christmas.global.view.io;
+
+import christmas.domain.calendar.EventCalendar;
+import christmas.domain.calendar.dto.DateDto;
+import christmas.global.view.input.InputView;
+import christmas.global.view.output.OutputView;
+
+import static christmas.global.view.message.OrderStaticMessage.EXPECTED... | Java | P2: ์ด ๋ทฐ์ ์ญํ ์ด ์ด๋ค ๊ฑด์ง ๋ช
ํํ ํด์ผํ ๊ฒ ๊ฐ์์. ๐ค
์ง๊ธ์ ๋ทฐ ๊ณ์ธต๋ ์ฌ๋ฌ ๋จ๊ณ๋ก ์ถ์ํ ๋์ด์๊ณ , ์ปจํธ๋กค๋ฌ์์ ๋ฐ...์๊ฒ๋ง ๊ฐ์ DTO๋ ๋์
์ด ๋์ด์๋๋ฐ, ์ ์ ํธ์ถํ ์ชฝ์ผ๋ก ๋์๊ฐ๋ ๊ฑด `int` ํ์
์ ๊ฐ ํ๋๋ ๋ง์ด์ฃ . '์ ์ก๋์ง ์๋ ์ ์ก๊ฐ์ฒด(DTO)๋ ์ ์กด์ฌํ๋ ๊ฑฐ์ง?....' ์ด๋ฐ ์๊ฐ์ด ์ถฉ๋ถํ ๋ค ์ ์๋ ์ฝ๋์ธ ๊ฒ ๊ฐ๊ฑฐ๋ ์.
- ์ `InputView`์ `EventCalendarView`๊ฐ ๋๋์๋๊ฐ
- ์ DateDto๋ฅผ ๋์
ํ๋๊ฐ
- ์ ๋ฐํ๊ฐ์ `View`๊ฐ ์๋ `eventCalendar`๊ฐ ๋ง๋ค์ด ๋ฐํํ๋... |
@@ -0,0 +1,49 @@
+package christmas.domain;
+
+import christmas.global.view.io.EventCalendarView;
+import christmas.global.view.io.OrdersView;
+import christmas.global.view.io.BenefitDetailsView;
+import christmas.global.view.output.OutputView;
+
+import static christmas.global.view.message.OrderDynamicMessage.SHOW_EVE... | Java | P4: 30๋ผ์ธ์ ์ฝ๋๋ ๋ทฐ ๊ฐ์ฒด๋ก ์ด์ ํ ์ ์์ ๊ฑฐ ๊ฐ์์..!
์ ๊ทผ๋ฐ ์ด๋ฒคํธ ์๋ด ๋ฌธ๊ตฌ ์ถ๋ ฅ ์ฝ๋๊ฐ `takeReservation()` ์์.... ๐ญ |
@@ -0,0 +1,114 @@
+package christmas.domain.order;
+
+import christmas.domain.order.enums.food.Food;
+import christmas.domain.order.enums.food.FoodCategory;
+
+import java.util.*;
+
+import static christmas.global.exception.OrderExceptionMessage.INVALID_ORDERS;
+import static christmas.domain.order.enums.OrderNumberDef... | Java | P5: orderMap์ ๋ํํ ์ปฌ๋ ์
๋ ํน์ ๊ณ ๋ คํด๋ณด์๋ฉด ์ด๋จ๊น์? ๐ |
@@ -0,0 +1,92 @@
+package christmas.domain.order.enums.food;
+
+import java.util.*;
+
+import static christmas.global.exception.OrderExceptionMessage.INVALID_ORDERS;
+
+public enum Food {
+ ์์ก์ด์ํ(FoodCategory.APPETIZER,"์์ก์ด์ํ", 6000),
+ ํํ์ค(FoodCategory.APPETIZER, "ํํ์ค", 5500),
+ ์์ ์๋ฌ๋(FoodCategory.APPETIZER, ... | Java | P3: `generateOrderedMenu()`์ ํ๋ผ๋ฏธํฐ๋ก ํต์งธ๋ก ๋งต์ ๋๊ฒจ์ฃผ์ง ์๊ณ , ๋ฐ์์ ๋งต์ ์ํํ๋ฉด์ `Food`์๋ `getOrderedFoodName(food:Food)` ๊ฐ์ ๋ฉ์๋๋ง ํธ์ถํด์ ๊ฒฐ๊ณผ๋ฅผ ๋ฐ์๋ณด๊ฒ ํ๋ฉด ๋ ์ข์ ๊ฒ ๊ฐ์์ ๐ ๐ |
@@ -0,0 +1,75 @@
+package christmas.global.view.io;
+
+import christmas.domain.badge.Enum.EventBadge;
+import christmas.domain.sale.BenefitDetails;
+import christmas.domain.sale.enums.Giveaway;
+import christmas.global.view.output.OutputView;
+
+import static christmas.global.view.message.PriceMessage.getDiscountPriceM... | Java | P5: 25๋ผ์ธ์ `calculateTotalPrice()`๊ฐ
-> `BenefitDetails#calculateTotalPrice()`
-> `SaleDetails#calculateTotalPrice()`
-> `Orders#calculateTotalPrice(foodMap)`
-> `Food.calculateTotalPrice(foodMap)`
์ด๋ฐ์์ผ๋ก ํธ์ถ์ด ๋๋๋ฐ์.
BenefitDetails์ SaleDetails๋ ์ด๋ค ๋ชฉ์ ์ผ๋ก ๊ฑฐ์ณ๊ฐ๋๋ก ๊ตฌํํ์
จ๋์ง ๊ถ๊ธํฉ๋๋ค! |
@@ -0,0 +1,75 @@
+package christmas.global.view.io;
+
+import christmas.domain.badge.Enum.EventBadge;
+import christmas.domain.sale.BenefitDetails;
+import christmas.domain.sale.enums.Giveaway;
+import christmas.global.view.output.OutputView;
+
+import static christmas.global.view.message.PriceMessage.getDiscountPriceM... | Java | P5: benefitDetails๋ฅผ ํ๋๋ก ๋๊ณ , ์ด๋ ๊ฒ showResult() ์์์ ์ฌ์ฉํ๋ ์ฝ๋๊ฐ ๊น๋ํด์ง๊ณ ์ข๋ค์ ๐ ๐ |
@@ -0,0 +1,39 @@
+package christmas.domain.badge.Enum;
+
+import static christmas.global.exception.CommonExceptionMessage.UNEXPECTED_EXCEPTION;
+
+public enum EventBadge {
+ NONE("์์", 0)
+ ,STAR("๋ณ", 5_000)
+ ,TREE("ํธ๋ฆฌ", 10_000)
+ ,SANTA("์ฐํ", 20_000)
+ ;
+
+ private final String badge;
+ private ... | Java | P4: ์ ์ ๋ฉ์๋์์ ์ ํจ์ฑ ๊ฒ์ฆ์ ํ๋ฒ ๋ ๊ฑฐ์น๋ ๊ฒ ์ ๋ง ๊ผผ๊ผผํ๊ณ ์ข๋ค์ ๐
P4: 22~31๋ผ์ธ์ ๋ค์ค if ๋ฌธ์ enum์ ๊ธฐ๋ฅ์ ํ์ฉํด์ ํด๊ฒฐ ํ ์ ์์ง ์์๊น์? ๐ |
@@ -0,0 +1,38 @@
+package christmas.global.config;
+
+import christmas.domain.EventController;
+import christmas.domain.calendar.EventCalendar;
+import christmas.domain.order.Orders;
+import christmas.domain.sale.BenefitDetails;
+import christmas.domain.sale.ChristmasDDaySale;
+import christmas.domain.sale.SaleDetails;... | Java | P3: ์ฐ๊ด๊ด๊ณ ์ ๋ณด๊ฐ ์์ ํ ๋ถ๋ฆฌ๋์ง ์์ ๊ฒ ๊ฐ์์..!
์ฝ๋ ์์์๋ง ๋ถ๋ฆฌํ ๊ฑฐ๋ผ๋ฉด Application์ชฝ์ ๋ฉ์๋๋ก๋ง ๋ถ๋ฆฌํด๋ ์ถฉ๋ถํ ๊ฑฐ ๊ฐ๊ณ , ์ง๊ธ์ฒ๋ผ Dependency ํ์ผ์ ์์ ๋ฐ๋ก ๋บ ๊ฑฐ๋ผ๋ฉด, Orders๊ฐ ์์ ์ ์ธ์คํด์ค๊ฐ ๋ฌด์์ธ์ง ์ ํ ์์ง ๋ชปํ๊ฒ ๋ฐ์์ ์ฃผ์
ํ๋๋ก ๋ง๋ค์ด์ฃผ๋๊ฒ ์ข์ ๊ฒ ๊ฐ์์. |
@@ -1,7 +1,16 @@
package christmas;
+import christmas.config.Dependency;
+
public class Application {
public static void main(String[] args) {
- // TODO: ํ๋ก๊ทธ๋จ ๊ตฌํ
+
+ try {
+ EventPlanner eventPlanner = Dependency.eventPlannner();
+ eventPlanner.run();
+ } catch (Excep... | Java | P5: ์๊ตฌ์ฌํญ์ด ๋ค ๊ตฌํ๋์ง ์์ ๊ฒ ๊ฐ์์ ๐ญ ... |
@@ -1,7 +1,16 @@
package christmas;
+import christmas.config.Dependency;
+
public class Application {
public static void main(String[] args) {
- // TODO: ํ๋ก๊ทธ๋จ ๊ตฌํ
+
+ try {
+ EventPlanner eventPlanner = Dependency.eventPlannner();
+ eventPlanner.run();
+ } catch (Excep... | Java | P5: ์ง์ง ์ฌ์ํ ๊ฑด๋ฐ์.
์ด ๊ณต๋ฐฑ ์ถ๋ ฅ์ ์๋ฏธ...๋ ๋ญ๊น์?... ๐ค ... |
@@ -0,0 +1,42 @@
+package christmas.domain;
+
+import christmas.constant.Calendar;
+import christmas.constant.FoodName;
+import christmas.validator.DateValidator;
+import christmas.view.InputView;
+import christmas.view.OutputView;
+
+public class Date {
+ int date;
+
+ public void saveDate(){
+ String inp... | Java | P2: `Date`๊ฐ ๋จ์ ๊ฐํ์
์ ์๋๊ณ ์๊ธฐ๋ง์ ์ญํ ์ ๊ฐ์ง ๊ฐ์ฒด๋ก ๋ณด์ฌ์ง๋๋ฐ์!
๊ทธ๋ ๋ค๋ฉด ์ฌ๊ธฐ์ ๋ทฐ๋ฅผ ํธ์ถํ๊ฒ ๋๋ฉด, ๋ทฐ์ ๋น์ฆ๋์ค ๋ก์ง์ด ๊ฐํ๊ฒ ์ฐ๊ด๋๋ค๋ ์๊ฐ์ด ๋ค์ด์.
์ฐํ
์ฝ ์๊ตฌ์ฌํญ์ ์์๋ฏ์ด ๋ทฐ๋ฅผ ๋ถ๋ฆฌํด์ฃผ๋ ค๋ฉด, ์นํ๋๊ป์ ๊ตฌํํด๋์ผ์ ์ปจํธ๋กค๋ฌ๋, `EventPlanner`๋, ์๋๋ฉด ์๋น์ค ๋ณด๋ค ์์์๋ ์ด๋ค ์ 3์ ๊ฐ์ฒด์์, ๋ทฐ๋ฅผ ์ฒ๋ฆฌํ๊ณ ๊ฐ๋ง `Date`์ชฝ์ผ๋ก ๋๊ฒจ์ฃผ๋ฉด ๋ ๊ฒ ๊ฐ์์..! |
@@ -0,0 +1,33 @@
+package christmas.validator;
+
+import jdk.jshell.spi.ExecutionControl.RunException;
+
+public class DateValidator {
+
+ public static int validateDate(String input) {
+ validateInputType(input);
+
+ try {
+ if (input == null) {
+ throw new IllegalArgumentExc... | Java | P5: ํ์
๊น์ง ๊ฒ์ฆํ์๋ ค๊ณ ๋
ธ๋ ฅํ์ ๋ถ๋ถ์ด ๋ณด์ฌ์ ์ ๋ง ์ข์ ๊ฒ ๊ฐ์์ ๐ ๐
๊ทธ๋ฐ๋ฐ ์์ฒ input์ ํ์
์ ๋ฌด์กฐ๊ฑด String์ด ๋ ์ ๋ฐ์ ์์ด์! ์ผ๋ถ๋ฌ ์์์ ํ์
์ ๋ณํํ์ง ์๋ ์ด์์์(๋ง์ฝ ๊ทธ๋ ๋ค๋ฉด, ์๋์ ๋ฐ๋ผ ๋ฐ๋ ๊ฒ์ด๋ ์์ธ์ ์ธ ์ํฉ์ด ์๋๊ฒ ์ฃ ..!)
๊ทธ๋์ ์ด ๋ถ๋ถ์ ์ฝ๋๋ ์ ๊ฑฐํด๋ ์ข์ ๊ฒ ๊ฐ์ต๋๋ค..! |
@@ -0,0 +1,60 @@
+package christmas.constant;
+
+import java.util.Arrays;
+import java.util.stream.Stream;
+
+public enum FoodName {
+ MUSHROOM_SOUP("์์ก์ด์ํ",6000,"APPITIZER"),
+ TAPAS("ํํ์ค", 6000,"APPITIZER"),
+ CEASAR_SALAD("์์ ์๋ฌ๋", 6000,"APPITIZER"),
+ T_BONE_STAKE("ํฐ๋ณธ์คํ
์ดํฌ", 6000,"MAIN"),
+ BARBECUE_RI... | Java | P4: enum์ผ๋ก ๋ฉ๋ด๋ฅผ ๊ตฌํํ์ ๋ถ๋ถ ์ ๋ง ์ข์ ๊ฒ ๊ฐ์์ ๐
๊ทธ๋ฐ๋ฐ ์ดํ๋ฆฌ์ผ์ด์
์ด ์ ์๋์ ํ์ง ์๋ ์ด์ ์ค ์ผ๋ถ๊ฐ ์ฌ๊ธฐ ์จ์ด์์๊ตฐ์
๊ฐ๊ฒฉ์ด ์ ๋ถ 6000์... ๐ญ
ํ๊ฐ์ง๋ง ์๊ฒฌ์ ๋ด๋ณด์๋ฉด, ์์์ ์นดํ
๊ณ ๋ฆฌ(`sort`)๋ enum์ผ๋ก ๊ด๋ฆฌํด๋ณด๋ฉด ์ข์ ๊ฑฐ ๊ฐ์์! |
@@ -0,0 +1,27 @@
+package christmas;
+
+import christmas.controller.EventController;
+
+public class EventPlanner {
+ private final EventController eventController;
+
+ public EventPlanner(EventController eventController) {
+ this.eventController = eventController;
+ }
+
+ public void run(){
+ ... | Java | P5: ์ง๋ฌธ๋๋ฆฝ๋๋ค..!
EventPlanner์ EventController์ ์ญํ ์ด ๋ค์ ์ค์ฒฉ๋๋ ๊ฒ ๊ฐ์๋ฐ์(๋ค๋ฅด๊ฒ ๋งํ๋ฉด, ํ ๊ฐ์ฒด๋ก ํ ์ ์๋ ์ญํ ์ ๋๋ก ์ชผ๊ฐ ๊ฒ ๊ฐ์๋ฐ์)
๋๋์ ์ด์ ๊ฐ ์ด๋ค๊ฑด์ง ๊ถ๊ธํฉ๋๋ค! |
@@ -0,0 +1,68 @@
+package christmas.domain;
+
+import christmas.view.OutputView;
+import java.util.Map;
+
+public class Price {
+
+ int totalPriceBeforeDiscount;
+ EventPrices eventPrices;
+
+
+ public Price(int totalPrice) {
+ this.totalPriceBeforeDiscount = totalPrice;
+ this.eventPrices = new ... | Java | P5: ์ด ๋ถ๋ถ๋, ๋ทฐ๋ ๋ถ๋ฆฌํ๋๊ฒ ์ข์ ๊ฒ ๊ฐ์์!
๋ค๋ฅธ ๋ถ๋ถ์๋ ์ฝ๋ฉํธ ๋จ๊ฒผ์ง๋ง, ์ด ๊ณณ์ ์์ System.out์ ์ฌ์ฉํ๊ณ ์์ด์ ํ ๋ฒ ๋ ๋จ๊ฒจ๋ณด์์..! ๐
๊ทธ๋ฆฌ๊ณ ์ด ๋ถ๋ถ ๊ธ์ก ํฌ๋งทํ
๋ ์ถ๊ฐ๋๋ฉด ๋ ์ข๊ฒ ๋ค์ฉ..! (๋ค๋ฅธ ๋ถ๋ถ์ ๋์ด์๋๋ฐ ์ฌ๊ธฐ๋ง ๋น ์ ธ์์ด์์) |
@@ -0,0 +1,68 @@
+package christmas.domain;
+
+import christmas.view.OutputView;
+import java.util.Map;
+
+public class Price {
+
+ int totalPriceBeforeDiscount;
+ EventPrices eventPrices;
+
+
+ public Price(int totalPrice) {
+ this.totalPriceBeforeDiscount = totalPrice;
+ this.eventPrices = new ... | Java | P3: ์ฌ๊ธฐ์ if-else๋ก์ง์ด... ๋ญ๊ฐ ์ด์ํ๊ฒ ์จ์ด์๋ ๊ฒ ๊ฐ์๋ฐ์ ๐ต๏ธโโ๏ธ (์ฌ์ฉํ์ง ์๊ธฐ๋ก ํ๋ if-else๊ฐ ์๋ ๊ฒ์ ์ ์ธํ๊ณ ์๋ผ๋...) |
@@ -0,0 +1,90 @@
+package christmas.domain;
+
+import christmas.constant.BenefitList;
+import christmas.view.OutputView;
+import java.text.DecimalFormat;
+import java.util.HashMap;
+import java.util.Map;
+
+public class EventPrices {
+ Map<String,Integer> benefitList;
+ int totalPrice;
+
+ public EventPrices()... | Java | P2: if-else ๋ฌธ์๋ return์ด ํ์ํ์ง ์์์..! ๋๊ตฐ๋ค๋ ๋ฐํํ์
์ด void์ธ ์ํฉ์์๋์!
๋ฌผ๋ก ๋ช
์์ ์ธ return์ ์จ์ ํท๊ฐ๋ฆด๋งํ ์ฝ๋๋ ์ฌ์ด๋์ดํํธ๋ฅผ ๋ง๋ ๊ฒฝ์ฐ๋ ์๋๋ฐ, ์ง๊ธ์ ํด๋น๋์ง ์๋ ์ฝ๋ ๊ฐ์์ ๋ง์๋๋ ค๋ณด์์ต๋๋ค ๐ |
@@ -0,0 +1,25 @@
+package christmas.controller;
+
+import christmas.service.EventService;
+
+public class EventController {
+ private final EventService eventService;
+
+ public EventController(EventService eventRepository) {
+ this.eventService = eventRepository;
+ }
+
+ public void requestInfo() {
... | Java | EventPlanner EventController EventService๋ก ๊ตฌ์กฐ๋ฅผ ๊ฐ์ ธ๊ฐ์ ์ด์ ๊ฐ ๊ถ๊ธํฉ๋๋ค. ์ด๋ค ์ด์ ์ด ์๋ค ์๊ฐ์ด ๋ค์ด์ ์ด๋ ๊ฒ ๊ตฌ์กฐ๋ฅผ ๊ฐ์ ธ๊ฐ์ ๊ฑธ๊น์?
๋ํ ๋ทฐ๋ก์ง์ด ๋๋ฉ์ธ๊ณผ ๊ฐํ๊ฒ ๊ฒฐํฉ๋๋ค ์๊ฐํ๋๋ฐ ์ด๋ป๊ฒ ์๊ฐํ์ค๊น์? |
@@ -0,0 +1,112 @@
+package store.custom.service.editor;
+
+import java.util.ArrayList;
+import java.util.List;
+import store.custom.model.order.OrderSheet;
+import store.custom.model.order.OrderedProduct;
+import store.custom.model.product.Product;
+import store.custom.model.product.Products;
+
+public class ProductsEd... | Java | [์ง๋ฌธ] `OrderSheetEditor`์ ๊ฒฝ์ฐ์๋ ๊ฐ์ฒด๋ฅผ ์ง์ ์์ฑํ์ฌ ์ฌ์ฉํ๋ ๋ฐฉ์์ ์ ํํ์
จ๋๋ฐ, `ProductsEditor`๋ ์ ํธ๋ฆฌํฐ ํด๋์ค์ ๊ฐ์ ํํ๋ก ์์ฑํ ์ด์ ๊ฐ ์์๊น์? |
@@ -0,0 +1,35 @@
+package store.custom.model.product;
+
+public class Product {
+ private final String name;
+ private final int price;
+ private int quantity;
+ private final String promotion;
+
+ public Product(String name, int price, int quantity, String promotion) {
+ this.name = name;
+ ... | Java | `product`์ `promotion` ํ๋๊ฐ `null` ๊ฐ์ ๊ฐ์ง ์ ์์ด Editor ๋ก์ง๋ค์์ `null` ์ ๋ํ ์ฒ๋ฆฌ๊ฐ ํ์ํฉ๋๋ค.
`Optional`์ ์ฌ์ฉํ์ฌ `promotion` ํ๋๊ฐ ๊ฐ์ด ์๋ ๊ฒฝ์ฐ๋ฅผ ๋ช
์์ ์ผ๋ก ์ฒ๋ฆฌํ๊ฑฐ๋, "" ์ ๊ฐ์ ๊ธฐ๋ณธ ๊ฐ์ ๊ฐ์ง๋๋ก ํ๋ฉด ์ด๋จ๊น์? |
@@ -0,0 +1,21 @@
+package store.custom.service.filehandler;
+
+import static store.custom.validator.CustomErrorMessages.FILE_READING_FAIL;
+
+import java.io.IOException;
+import java.nio.file.Files;
+import java.nio.file.Path;
+import java.util.List;
+import store.custom.validator.Validator;
+
+public class FileReader ... | Java | readAllLines๋ผ๋ ๋ฉ์๋๊ฐ ์์๋ค์! ์ ๋ while๋ฌธ์ผ๋ก ํ์ผ์ ๋๊น์ง ์ฝ์ด์ค๋๋ก ํ๋๋ฐ, ์ฌ์ฉํ์ ๋ฐฉ๋ฒ์ด ์ฐธ ๊ฐ๋จํ ๊ฒ ๊ฐ์์. |
@@ -0,0 +1,112 @@
+package store.custom.service.editor;
+
+import java.util.ArrayList;
+import java.util.List;
+import store.custom.model.order.OrderSheet;
+import store.custom.model.order.OrderedProduct;
+import store.custom.model.product.Product;
+import store.custom.model.product.Products;
+
+public class ProductsEd... | Java | ์ ๋ ํ๋ก๋ชจ์
์ํ๋ง ์๋ ๊ฒฝ์ฐ ์ผ๋ฐ ์ํ์ ์ถ๊ฐํ๋ ๊ธฐ๋ฅ์ ์ถ๊ฐํ์ง ๋ชปํ๋๋ฐ, ๊ทธ๋์ ๊ทธ๋ฐ์ง ๋ ์ธ์์ ์ด์์...๐
๊ผผ๊ผผํ ๋ก์ง์์ ๋ง์ด ๋ฐฐ์๋๋ค. |
@@ -0,0 +1,105 @@
+package store.custom.validator;
+
+import static store.custom.constants.RegexConstants.PRODUCT_ORDER_REGEX;
+import static store.custom.constants.StringConstants.RESPONSE_NO;
+import static store.custom.constants.StringConstants.RESPONSE_YES;
+import static store.custom.validator.CustomErrorMessages.... | Java | ์ ๊ท ํํ์์ ์ฌ์ฉํ๋ ์ ๋ง ๊ฐ๋จํ๊ฒ ์ฒ๋ฆฌ๋๋ค์!! ๋งค๋ฒ ๋๋ผ๋ ๊ฑฐ์ง๋ง ํจ์จ์ ์ธ ๋ฐฉ๋ฒ์ ์ ์ฌ์ฉํ์๋ ๊ฒ ๊ฐ์ต๋๋ค. |
@@ -0,0 +1,99 @@
+package store.custom.service.maker;
+
+import static store.custom.constants.NumberConstants.NOT_FOUND;
+import static store.custom.constants.StringConstants.AFTER_PROMOTION_END;
+import static store.custom.constants.StringConstants.BEFORE_PROMOTION_START;
+
+import java.util.ArrayList;
+import java.ut... | Java | ์ ๋ฉ์๋๋ช
์ฌ๊ธฐ๋์...! |
@@ -0,0 +1,153 @@
+package store.custom.service.editor;
+
+import static store.custom.constants.StringConstants.AFTER_PROMOTION_END;
+import static store.custom.constants.StringConstants.BEFORE_PROMOTION_START;
+import static store.custom.constants.StringConstants.RESPONSE_NO;
+import static store.custom.constants.Stri... | Java | OrderSheetEditor ํด๋์ค ๋ถ๋ถ์ ์ฐธ๊ณ ํ๋ฉด ์ ๊ฐ ์ฌ์
๋ ฅ๊ณผ ๊ด๋ จํด ๊ณ ๋ฏผํ๋ ๋ถ๋ถ์ด ์ผ๋ถ ํด๊ฒฐ๋ ๊ฒ ๊ฐ์์.
์ถ๊ฐ๋ก, ์ ์ฒด์ ์ผ๋ก ์ ์ ์ ์ฝํ๋ ์ฝ๋์ ๋ก์ง์ ๊ฐํํ๊ณ ๊ฐ๋๋ค. |
@@ -0,0 +1,35 @@
+package store.custom.model.product;
+
+public class Product {
+ private final String name;
+ private final int price;
+ private int quantity;
+ private final String promotion;
+
+ public Product(String name, int price, int quantity, String promotion) {
+ this.name = name;
+ ... | Java | promotion ํ๋๋ ํ๋ก๋ชจ์
๊ฐ์ฒด๋ฅผ ์ง์ ์ฐธ์กฐํ๋๋ก ํ๋ฉด ์ด๋จ๊น์? |
@@ -0,0 +1,153 @@
+package store.custom.service.editor;
+
+import static store.custom.constants.StringConstants.AFTER_PROMOTION_END;
+import static store.custom.constants.StringConstants.BEFORE_PROMOTION_START;
+import static store.custom.constants.StringConstants.RESPONSE_NO;
+import static store.custom.constants.Stri... | Java | OrderSheetEditor์์ ๋ง์ ์ญํ ์ ํ๊ณ ์๋๋ฏ ํฉ๋๋ค ์ฃผ๋ฌธ์ ํธ์ง, ํ๋ก๋ชจ์
์ ์ฉ, ์ฌ๊ณ ๊ด๋ฆฌ ๋ฑ์ ๊ธฐ๋ฅ์ ๊ฐ๊ฐ ๋ถ๋ฆฌํ๋ ๊ฒ ์ด๋จ๊น์? ์ฌ์ค ์ด๋ฐ ๋ถ๋ถ์์ ์ ๋ ๊ณ ๋ฏผ์ด ๋ง์ ํฐ๋ผ ๋ผ์ ค๋์ ๋ค๋ฅธ ์๊ฒฌ์ด ์๋ค๋ฉด ๋ฃ๊ณ ์ถ์ต๋๋ค! |
@@ -0,0 +1,63 @@
+package store.custom.model.order;
+
+public class OrderedProduct {
+ private final String name;
+ private int quantity;
+ private int totalPrice;
+ private String promotion;
+ private int buy;
+ private int get;
+
+ public OrderedProduct(String name, int quantity, int totalPrice, ... | Java | setter๋ฅผ ์ด์ด๋๋๊ฒ์ ์ข์ง ์๋ค๊ณ ๋ฐฐ์ ๋ ๊ฒ ๊ฐ์ต๋๋ค! ์ฌ๊ณ ๋ฅผ ์ฐจ๊ฐํ๋ค๋๊ฐ ๋ค๋ฅธ ๊ฐ๋ค์ ๊ฐ์ฒด๋ฅผ ์์ฑํ ๋ ํ ๋นํ๋ค๋๊ฐ ํ๋ ๋ก์ง์ ๋ฐ๋ก ๋ง๋ค์ด์ ์ฒ๋ฆฌํ๋ฉด ์ด๋จ๊น์? |
@@ -0,0 +1,58 @@
+package store.custom.service.parser;
+
+import static store.custom.constants.RegexConstants.SINGLE_COMMA;
+import static store.custom.constants.StringConstants.NO_PROMOTION;
+
+import java.util.ArrayList;
+import java.util.List;
+import store.custom.model.product.Product;
+import store.custom.model.pr... | Java | ๋ณ๊ฑฐ ์๋ ๋ถ๋ถ์ด๊ธด ํ๋ฐ, ์ธ๋ฑ์ค๋ฅผ ํ๋์ฝ๋ฉํ๋ ๊ฒ ๋ณด๋ค ์์๋ก ๋นผ์ nameIndex, priceIndex ์ฒ๋ผ ๋์์ผ๋ฉด ๋ ์ข์์ ๊ฒ ๊ฐ์์! |
@@ -0,0 +1,153 @@
+package store.custom.service.editor;
+
+import static store.custom.constants.StringConstants.AFTER_PROMOTION_END;
+import static store.custom.constants.StringConstants.BEFORE_PROMOTION_START;
+import static store.custom.constants.StringConstants.RESPONSE_NO;
+import static store.custom.constants.Stri... | Java | OrderSheetEditor์ ์ญํ ์ด ๋ง๋ค๋ ์ ์์ ์ ๋ ๋น์ทํ ์๊ฐ์
๋๋ค!
+ **3์ฃผ์ฐจ ํผ๋๋ฐฑ ์ค ๊ฐ์ฒด๋ฅผ ๊ฐ์ฒด๋ต๊ฒ ์ฌ์ฉํ๋ค** ํผ๋๋ฐฑ์ด ๋ ์ฌ๋์ด์. ์ผ๋ถ ๋ก์ง ์ค์์๋ ๋ชจ๋ธ ๋ด๋ถ์์ ์ฑ
์์ ๊ฐ์ ธ๊ฐ ์ ์๋ ๊ฒ๋ค๋ ์๋ ๊ฒ ๊ฐ์ต๋๋ค.
๋ํ์ ์ผ๋ก ์๋ ๋ฉ์๋๊ฐ ๊ทธ๋ฐ ๊ฒ ๊ฐ์์!
```
private void setPromotionIfExist(OrderedProduct orderProduct, Product product) {
if (product.getPromotion() != null) {
orderP... |
@@ -0,0 +1,63 @@
+package store.custom.model.order;
+
+public class OrderedProduct {
+ private final String name;
+ private int quantity;
+ private int totalPrice;
+ private String promotion;
+ private int buy;
+ private int get;
+
+ public OrderedProduct(String name, int quantity, int totalPrice, ... | Java | ์์ ์ธ๊ธ๋๋ฆฐ 3์ฃผ์ฐจ ํผ๋๋ฐฑ ๊ฐ์ฒด๋ฅผ ๊ฐ์ฒด๋ต๊ฒ ์ฌ์ฉํ๊ธฐ์ ์ฐ๊ด๋ ๋ฆฌ๋ทฐ๊ฐ ์๋๊น ์ถ๋ค์!
3์ฃผ์ฐจ ํผ๋๋ฐฑ ์ค ๋ฐ์ท
>Lotto์์ ๋ฐ์ดํฐ๋ฅผ ๊บผ๋ด์ง(get) ๋ง๊ณ ๋ฉ์์ง๋ฅผ ๋์ง๋๋ก ๊ตฌ์กฐ๋ฅผ ๋ฐ๊ฟ ๋ฐ์ดํฐ๋ฅผ ๊ฐ์ง๋ ๊ฐ์ฒด๊ฐ ์ผํ๋๋ก ํ๋ค. ์ด์ฒ๋ผ Lotto ๊ฐ์ฒด์์ ๋ฐ์ดํฐ๋ฅผ ๊บผ๋ด(get) ์ฌ์ฉํ๊ธฐ๋ณด๋ค๋, ๋ฐ์ดํฐ๊ฐ ๊ฐ์ง๊ณ ์๋ ๊ฐ์ฒด๊ฐ ์ค์ค๋ก ์ฒ๋ฆฌํ ์ ์๋๋ก ๊ตฌ์กฐ๋ฅผ ๋ณ๊ฒฝํด์ผ ํ๋ค. ์๋์ ๊ฐ์ด ๋ฐ์ดํฐ๋ฅผ ์ธ๋ถ์์ ๊ฐ์ ธ์(get) ์ฒ๋ฆฌํ์ง ๋ง๊ณ , ๊ฐ์ฒด๊ฐ ์์ ์ ๋ฐ์ดํฐ๋ฅผ ์ค์ค๋ก ์ฒ๋ฆฌํ๋๋ก ๋ฉ์์ง๋ฅผ ๋์ง๊ฒ ํ๋ค. |
@@ -0,0 +1,190 @@
+package store.custom.controller;
+
+import static store.custom.constants.StringConstants.PRODUCTS_FILE_PATH;
+import static store.custom.constants.StringConstants.PROMOTIONS_FILE_PATH;
+import static store.custom.constants.StringConstants.RESPONSE_YES;
+
+import java.util.List;
+import store.custom.m... | Java | while(true)์ try-catch๊ฐ ๋ฐ๋ณต๋๋๋ฐ, ๋ฐํ๊ฐ์ด ๊ฐ์ ๊ฒ ๊ฐ์์์! ํธ๋ค๋ฌ๋ก ๋นผ์ ์ฒ๋ฆฌํ๋ฉด ๋ ์ ์ฐํ ์ฝ๋๊ฐ ๋์ง ์์๊น ์ถ์ต๋๋ค |
@@ -0,0 +1,63 @@
+package store.custom.model.order;
+
+public class OrderedProduct {
+ private final String name;
+ private int quantity;
+ private int totalPrice;
+ private String promotion;
+ private int buy;
+ private int get;
+
+ public OrderedProduct(String name, int quantity, int totalPrice, ... | Java | ๋์ํฉ๋๋ค! ๊ฐ์ฒด๊ฐ ์๋์ ์ธ ๊ฒ์ด ์๋, '๋ฅ๋์ '์ธ ์ธ์คํด์ค๋ผ๋ ๊ฒ์ ๊ณ ๋ คํ์๋ฉด ๋ ์ข์ ์ฝ๋๊ฐ ๋ ๊ฒ ๊ฐ์์ |
@@ -0,0 +1,35 @@
+package store.custom.model.product;
+
+public class Product {
+ private final String name;
+ private final int price;
+ private int quantity;
+ private final String promotion;
+
+ public Product(String name, int price, int quantity, String promotion) {
+ this.name = name;
+ ... | Java | ๋์ํฉ๋๋ค! |
@@ -0,0 +1,153 @@
+package store.custom.service.editor;
+
+import static store.custom.constants.StringConstants.AFTER_PROMOTION_END;
+import static store.custom.constants.StringConstants.BEFORE_PROMOTION_START;
+import static store.custom.constants.StringConstants.RESPONSE_NO;
+import static store.custom.constants.Stri... | Java | ๋์ํฉ๋๋ค! ํ์ฌ ํด๋์ค์์ ์ญํ ์ ๋ง์ด ๊ฐ๊ณ ์์ด์ ๊ฐ์ฒด ๋ด๋ถ์์ ์ฒ๋ฆฌํ๊ฑฐ๋, ๋ถ๋ฆฌํ๋ฉด ์ข์ ๊ฒ ๊ฐ์ต๋๋ค |
@@ -0,0 +1,190 @@
+package store.custom.controller;
+
+import static store.custom.constants.StringConstants.PRODUCTS_FILE_PATH;
+import static store.custom.constants.StringConstants.PROMOTIONS_FILE_PATH;
+import static store.custom.constants.StringConstants.RESPONSE_YES;
+
+import java.util.List;
+import store.custom.m... | Java | ์ธ๋ฑ์ค๋ก ์ ๊ทผํ๊ธฐ ๋ณด๋ค๋,,, ์์๋ก ์ ๊ทผํด๋ ์ข์ง ์์์๊น์? ๋ก์ง์์ผ๋ก๋ ๊ฐ ์์๊ฐ ์์ผ๋ก ๋ค์ด์ค์ง๋ง ๊ทธ๊ฑธ ์ดํดํ๋ ค๋ฉด ์ฝ๋๋ฅผ ๊ณ์ ๋ฐ๋ผ๊ฐ์ผํ๋๊น,,,
๋ ๊ฐ์ ๋ค๋ฅธ ๊ฐ์ฒด๋ฅผ ์ ๊ทผํด์ผํ๋ค๋๊ฒ ๋ฌธ์ ๊ธด ํ๋ฐ, ์ด์ฐจํผ ๋ค์๋ ๋ ๊ฐ์ ํ๋ผ๋ฏธํฐ๋ฅผ ๊ณ์ ์ฐ๊ณ , ๋ ๋ฐ๋ณต์ํค๋ ๊ฒ ๊ฐ์์promotionResults๋ฅผ ๋ฝ์ ๋ orderSheet์ ์์์ ๋ด์ฉ์ ํฌํจํ๋ ๋ฌด์ธ๊ฐ๋ก ๋งคํ์ํค๊ฑฐ๋ ํ ์๋ ์์ง ์์๊น์? |
@@ -0,0 +1,58 @@
+package store.custom.service.parser;
+
+import static store.custom.constants.RegexConstants.SINGLE_COMMA;
+import static store.custom.constants.StringConstants.NO_PROMOTION;
+
+import java.util.ArrayList;
+import java.util.List;
+import store.custom.model.product.Product;
+import store.custom.model.pr... | Java | ์๊ฒ๋ ์ธ๋ฑ์ค ์ ๊ทผ๋ณด๋ค ์์ ์ ๊ทผ์ผ๋ก ๋ฐ๊พธ๋๊ฒ ๋ ์ง๊ด์ ์ด๊ณ ํจ์จ์ ์ผ ๊ฒ ๊ฐ์์ |
@@ -0,0 +1,112 @@
+package store.custom.service.editor;
+
+import java.util.ArrayList;
+import java.util.List;
+import store.custom.model.order.OrderSheet;
+import store.custom.model.order.OrderedProduct;
+import store.custom.model.product.Product;
+import store.custom.model.product.Products;
+
+public class ProductsEd... | Java | ์ข ๋ ๋ช
๋ฃํ ์ฝ๋ ํ๋ฆ์ด ์์๊น์? ์... ArrayList์ฌ์ ๋ ๋นํจ์จ์ ์ผ ์๋ ์์ง๋ง promotion์ด ์๋ ์ํ๋ค๋ง ๋ฐ๋ณต์ํค๋ฉด์ ์ผ๋ฐ ์ฌ๊ณ ๋ฅผ ๊ฒ์ํ๊ณ ์์ผ๋ฉด ์์ฑํ๋...?๊ฒ๋ ์ฌ๋ฐ์ง ์์๊น์? |
@@ -0,0 +1,29 @@
+package store.custom.model.product;
+
+import static store.custom.validator.CustomErrorMessages.INVALID_INDEX;
+
+import java.util.ArrayList;
+import java.util.List;
+
+public class Products {
+ private final List<Product> productCatalog;
+
+ public Products(List<Product> productCatalog) {
+ ... | Java | ์ ๊ฐ ์ผ๊ธ์ปฌ๋ ์
์ ์ ๋ชจ๋ฅด๊ธด ํ์ง๋ง,,, ์ ๊ฐ ์ดํดํ ๋ฐ๋ก๋ ์ข ๋ ๋ฉฑํํ๊ฒ ์บก์ํํ๋๊ฒ ์ฅ์ ์ธ ๊ฒ์ผ๋ก ์ดํดํ๊ณ ์์ด์! ๊ทผ๋ฐ ์ผ๊ธ ์ปฌ๋์
์ ๊ตฌํ์ด ๋ด๋ถ์ ์์๋ฅผ ์ธ๋ถ๋ก ๋ฐ์ถ์ํค๋ ๊ฒ๋ง ์๋๊ฒ ์คํ๋ ค ์บก์ํ, ์๋ํ๋ฅผ ํด์น ์ ์์ง ์์๊น์? ์ธ๋ถ์์ product๋ products์์ ํ์ฉํ๋ ์ฌ๋ฌ ๋ฉ์๋๋ค ์ญ์ ๋ชจ๋ธ์ ์ฑ
์ ์๋์ ์์ผ๋๊น ๋ด๋ถ๋ก ํฌํจ์ํค๋ ๊ฒ๋ ์ข์ ๊ฒ ๊ฐ์์! |
@@ -0,0 +1,190 @@
+package store.custom.controller;
+
+import static store.custom.constants.StringConstants.PRODUCTS_FILE_PATH;
+import static store.custom.constants.StringConstants.PROMOTIONS_FILE_PATH;
+import static store.custom.constants.StringConstants.RESPONSE_YES;
+
+import java.util.List;
+import store.custom.m... | Java | ํธ๋ค๋ฌ ์๊ฐ์ ๋ชปํ๋ค์! ์ข์ ๋ฐฉ๋ฒ ์๋ ค์ฃผ์
์ ๊ฐ์ฌํฉ๋๋ค! |
@@ -0,0 +1,63 @@
+package store.custom.model.order;
+
+public class OrderedProduct {
+ private final String name;
+ private int quantity;
+ private int totalPrice;
+ private String promotion;
+ private int buy;
+ private int get;
+
+ public OrderedProduct(String name, int quantity, int totalPrice, ... | Java | ๊ฐ์ฒด์ ๋ํ ๊ณต๋ถ๋ฅผ ๋ ํด๋ด์ผ๊ฒ ์ต๋๋ค! ์๋ ค์ฃผ์
์ ๊ฐ์ฌํฉ๋๋ค! |
@@ -0,0 +1,35 @@
+package store.custom.model.product;
+
+public class Product {
+ private final String name;
+ private final int price;
+ private int quantity;
+ private final String promotion;
+
+ public Product(String name, int price, int quantity, String promotion) {
+ this.name = name;
+ ... | Java | ๊ทธ ์๊ฐ์ ๋ชปํด๋ดค๋ค์! ํ์คํ ํ๋ก๋ชจ์
๊ฐ์ฒด๋ฅผ ์ฐธ์กฐํ๋ฉด ๋ ์ข์ ๊ฒ ๊ฐ๋ค์! |
@@ -0,0 +1,153 @@
+package store.custom.service.editor;
+
+import static store.custom.constants.StringConstants.AFTER_PROMOTION_END;
+import static store.custom.constants.StringConstants.BEFORE_PROMOTION_START;
+import static store.custom.constants.StringConstants.RESPONSE_NO;
+import static store.custom.constants.Stri... | Java | OrdersheetEditor์ ์ญํ ์ ์ด๋ฏธ ์์ฑ๋ ์ฃผ๋ฌธ์์ ๋ณ๊ฒฝ(์ฃผ๋ฌธ์์ ์ด๊ธฐ ์ค์ , ํ๋ก๋ชจ์
๋ด์ฉ ์ ์ฉ)์ผ๋ก ์๊ฐํ๊ณ ์์ฑํ์๋๋ฐ, ๊ฐ์ฒด๊ฐ ๊ฐ์ง ์ ์๋ ์ญํ ์ ๋ฒ์๋ฅผ ์ ํ์
ํ์ง ๋ชปํด ๊ธฐ๋ณธ์ ์ธ ๊ฒ์ ์ ์ธํ๊ณ editor์ ๋ชจ๋ ์์ฑํ์์ต๋๋ค. ๋ชจ๋ธ ๋ด๋ถ์์ ์ฑ
์์ ๊ฐ์ ธ๊ฐ ์ ์๋ ๋ถ๋ถ์ ๊ณ ๋ฏผํด ๋ณด์์ผ๊ฒ ์ต๋๋ค. ์ข์ ์๊ฒฌ ๊ฐ์ฌํฉ๋๋ค! |
@@ -0,0 +1,153 @@
+package store.custom.service.editor;
+
+import static store.custom.constants.StringConstants.AFTER_PROMOTION_END;
+import static store.custom.constants.StringConstants.BEFORE_PROMOTION_START;
+import static store.custom.constants.StringConstants.RESPONSE_NO;
+import static store.custom.constants.Stri... | Java | ์นญ์ฐฌํด์ฃผ์
์ ๊ฐ์ฌํฉ๋๋ค! |
@@ -0,0 +1,369 @@
+# 4์ฃผ ์ฐจ - ํธ์์
+
+---
+## ๊ธฐ๋ฅ ์๊ตฌ์ฌํญ
+
+---
+
+๊ตฌ๋งค์์ ํ ์ธ ํํ๊ณผ ์ฌ๊ณ ์ํฉ์ ๊ณ ๋ คํ์ฌ ์ต์ข
๊ฒฐ์ ๊ธ์ก์ ๊ณ์ฐํ๊ณ ์๋ดํ๋ ๊ฒฐ์ ์์คํ
์ ๊ตฌํํ๋ค.
+
+* ์ฌ์ฉ์๊ฐ ์
๋ ฅํ ์ํ์ ๊ฐ๊ฒฉ๊ณผ ์๋์ ๊ธฐ๋ฐ์ผ๋ก ์ต์ข
๊ฒฐ์ ๊ธ์ก์ ๊ณ์ฐํ๋ค.
+ * ์ด๊ตฌ๋งค์ก์ ์ํ๋ณ ๊ฐ๊ฒฉ๊ณผ ์๋์ ๊ณฑํ์ฌ ๊ณ์ฐํ๋ฉฐ, ํ๋ก๋ชจ์
๋ฐ ๋ฉค๋ฒ์ญ ํ ์ธ ์ ์ฑ
์ ๋ฐ์ํ์ฌ ์ต์ข
๊ฒฐ์ ๊ธ์ก์ ์ฐ์ถํ๋ค.
+* ๊ตฌ๋งค ๋ด์ญ๊ณผ ์ฐ์ถํ ๊ธ์ก ์ ๋ณด๋ฅผ ์์์ฆ์ผ๋ก ์ถ๋ ฅํ๋ค.
+* ์์์ฆ ์ถ๋ ฅ ํ ์ถ๊ฐ ๊ตฌ๋งค๋ฅผ ์งํํ ์ง ๋๋ ์ข
๋ฃํ ์ง๋ฅผ ์ ํํ ์ ์๋ค.
+* ์ฌ... | Unknown | ์ด๋ฒ ๋ฏธ์
์ด ์ ๋ง ๋ณต์กํด์ ์ด๋ ค์ ๋๋ฐ ์ ๋ ์ค๊ณ๋ฅผ ์งํํ ๋ ํ๋ก์ฐ ์ฐจํธ์ ๋น์ทํ๊ฒ ๋์ ๊ณผ์ ์ ์ ๋ฆฌํ๊ณ ๊ฐ๋ฐ์ ์งํํ๋๊ฒ ๊ฐ์๋ฐ ๋ฌธ์ํ๋๋ ๋น์ทํ๊ฒ ์งํํ ๊ฒ ๋ณด๊ณ ๋๋๋ค์ |
@@ -0,0 +1,137 @@
+package store.controller;
+
+import camp.nextstep.edu.missionutils.DateTimes;
+import java.util.ArrayList;
+import java.util.List;
+import store.domain.BuyProductParser;
+import store.domain.BuyProducts;
+import store.domain.FileReader;
+import store.domain.CustomerReceipt;
+import store.domain.Produ... | Java | ๋ค๋ฅธ ์ฌ๋๋ค์ ์ฝ๋๋ฅผ ๋ชฐ๋๋ชฐ๋ ๋ดค์๋ ์ด๋ฐ์ฉ์ผ๋ก ์ฒ๋ฆฌํด์ ๋ณ์๋ฅผ ์ค์ด๋ ๋ฐฉ๋ฒ๋ ์๋๊ตฐ์. ์๊ฐ์ ๋ฐ๋ผ ์ข์์๋ ์๊ณ ์์ข๋ค๊ณ ์๊ฐํ ์๋ ์์ง๋ง ์ฝ๋๋ณด๋ค๊ฐ ์๊ฐ๋์ ๋ฃ์ด๋๊ฒ์
```suggestion
do {
showInventory(products);
BuyProducts buyProducts = buyProducts(promotions, products);
CustomerReceipt customerReceipt = makeCustomerReceipt(products, bu... |
@@ -0,0 +1,137 @@
+package store.controller;
+
+import camp.nextstep.edu.missionutils.DateTimes;
+import java.util.ArrayList;
+import java.util.List;
+import store.domain.BuyProductParser;
+import store.domain.BuyProducts;
+import store.domain.FileReader;
+import store.domain.CustomerReceipt;
+import store.domain.Produ... | Java | ๋ค์ .equals(YES)๋ผ๊ณ ํ๋ ๊ฒฝ์ฐ ํ๋จ์ controller์์ ์งํํ๋ ๊ฒ๋ณด๋ค๋ view์์ YES๋ฉด true๋ฅผ ๋ฃ์ด controller์ ์ฑ
์์ ์ค์ฌ์ฃผ๋๊ฒ์ ๋ํด์๋ ์ด๋ป๊ฒ ์๊ฐํ์๋์? |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.