code stringlengths 41 34.3k | lang stringclasses 8
values | review stringlengths 1 4.74k |
|---|---|---|
@@ -0,0 +1,27 @@
+package christmas.system;
+
+public final class IOMessage {
+ public static final String VISIT_DATE_PROMPT_MESSAGE = "์๋
ํ์ธ์! ์ฐํ
์ฝ ์๋น 12์ ์ด๋ฒคํธ ํ๋๋์
๋๋ค.\n" +
+ "12์ ์ค ์๋น ์์ ๋ฐฉ๋ฌธ ๋ ์ง๋ ์ธ์ ์ธ๊ฐ์? (์ซ์๋ง ์
๋ ฅํด ์ฃผ์ธ์!)";
+
+ public static final String ORDER_PROMPT_MESSAGE = "์ฃผ๋ฌธํ์ค ๋ฉ๋ด๋ฅผ ๋ฉ๋ด์ ๊ฐ์๋ฅผ ์๋ ค ์ฃผ์ธ์. (e.g. ... | Java | ์์ฑ์๋ฅผ `private`์ผ๋ก ๋ง์๋์ ๋ชจ์ต์ด ๋ณด๊ธฐ ์ข์ต๋๋ค! ๐ |
@@ -0,0 +1,54 @@
+package christmas.controller;
+
+import christmas.domain.entity.Day;
+import christmas.domain.entity.Order;
+import christmas.view.InputView;
+import java.util.function.Supplier;
+
+import static christmas.domain.verifier.RuntimeVerifier.RUNTIME_VERIFIER;
+import static christmas.system.IOMessage.ORDE... | Java | static์ด ์๋๊ฒ ๊ตฌํํด์ ์์กด๊ด๊ณ๋ฅผ ๊ฐ์ง๊ฒ ํด์ผํ ๊น ๊ณ ๋ฏผํด๋ดค์ต๋๋ค. ํ์คํ ์์กด์ฑ ์ฃผ์
์ด ํ์ํ ๊ด๊ณ์ด๋ค ์ถ์๊ฑฐ๋ ์ฃผ์
์ ์์ผฐ๋๋ฐ inputview์ outputview๊น์ง ์์ผ์ผํ๋ ํด์์. ์ํค๋๊ฒ ๋ง์๊น์? |
@@ -0,0 +1,54 @@
+package christmas.controller;
+
+import christmas.domain.entity.Day;
+import christmas.domain.entity.Order;
+import christmas.view.InputView;
+import java.util.function.Supplier;
+
+import static christmas.domain.verifier.RuntimeVerifier.RUNTIME_VERIFIER;
+import static christmas.system.IOMessage.ORDE... | Java | ํ ๋ชฐ๋์ต๋๋ค. ๊ฐ์ฌํฉ๋๋ค.!! |
@@ -0,0 +1,32 @@
+package christmas.controller;
+
+import christmas.domain.entity.Day;
+import christmas.domain.entity.DiscountRecord;
+import christmas.domain.entity.Order;
+import christmas.domain.manager.BonusEventManager;
+import christmas.domain.manager.DiscountManager;
+
+import static christmas.domain.entity.Eve... | Java | ์ด๊ฒ ์ฌ๋ฌ๊ฐ์ง๋ก ๋๋ ๋ณผ๋ ค๊ณ ํ๋๋ฐ ๋๋ฌด ์ด๋ ต๋๋ผ๊ตฌ์... ๋๋ ์ผ ๊น๋ํ ๊ฑฐ ๊ฐ๊ธฐ๋ ํ๋ฐ...
๊ทธ๋ฅ ์ ํฌ๊ฐ plannerSystem์ ๊ตฌํํ๋๊ฑฐ์๊ณ , ๊ธฐ๋ฅ๋ค์ด ๋ค ์ ์ฐ(๊ธ์ต)๊ณผ ๊ด๋ จ๋ ๋ถ๋ถ์ด๋ผ์ settlementSystem์ ๋์์ต๋๋ค. |
@@ -0,0 +1,76 @@
+package christmas.domain.entity;
+
+import static christmas.domain.verifier.VisitDateVerifier.VISIT_DATE_VERIFIER;
+import static christmas.system.Constant.CHRISTMAS;
+import static christmas.system.Constant.FIRST_DAY_OF_MONTH;
+
+public class Day {
+
+ private static final int WEEK_LENGTH = 7;
+ ... | Java | ๋ฉ์๋๋ช
์ ์ ๋ง ์ ์ง์ผ์ ๊ฑฐ ๊ฐ์์! ๐ |
@@ -0,0 +1,48 @@
+package christmas.domain.entity;
+
+import christmas.domain.util.Util;
+
+import java.util.Arrays;
+
+import static christmas.system.IOMessage.EMPTY_STRING;
+import static christmas.system.IOMessage.QUANTITY_UNIT;
+
+public enum BonusMenu {
+ CHAMPAGNE(Menu.CHAMPAGNE, 1);
+
+ private final Menu ... | Java | ์ฒ์์๋ ๊ทธ๋ฐ ๋ฐฉ์์ผ๋ก ํ์๋๋ฐ,
๊ฐ ํด๋์ค์์, ํด๋์ค์ ๋ํด ์ถ๋ ฅํ ์ ๋ณด๋ฅผ ๋ง๋๋๊ฑฐ๊น์ง๋ ๊ฐ์ฒด๊ฐ ๋ด๋นํด์ผํ ๋ชซ์ด์ง ์์๊น ํด์ ๋ฐ๊ฟจ์์ด์...
์ถ๋ ฅ์ outputview์์ ํฉ๋๋ค. ์ด ๋ถ๋ถ์ ๋ค๋ฅธ๋ถ๋ถ์ ์๊ฒฌ๋ ๋ฃ๊ณ ์ถ์ด์!!
1. outputview์์ getter๊ฐ ์๋๋๋ผ๋, ์ธ์๋ฅผ ํตํด ์ถ๋ ฅํ ํด๋์ค์ ์ ๋ณด๋ฅผ ๊บผ๋ด์ ์ถ๋ ฅ ๋ฉ์์ง๋ฅผ ๋ง๋ค๊ณ ์ถ๋ ฅ๊น์ง ํ๋๊ฑธ ๋ด๋นํด์ผํ ๊น?
2. ์ถ๋ ฅํด์ผํ ํด๋์ค์ ์ ๋ณด๋ ํด๋์ค ๋ด์์ ๋ง๋ค๊ณ , ์ถ๋ ฅ๋ง outputview์์ ํด์ผํ๋๊ฒ ๋ง์๊น์? |
@@ -0,0 +1,12 @@
+package christmas.domain.util;
+
+
+import java.text.DecimalFormat;
+
+public final class Util {
+ public static String createFormattedAmount(int target) {
+ DecimalFormat formatter = new DecimalFormat("###,##0");
+ return formatter.format(target);
+ }
+
+} | Java | ์ฐธ๊ณ ํ๊ฒ ์ต๋๋ค. ๋๋ฌด๋๋ฌด ํผ๋๋ฐฑ ์ด์ฌํ ํด์ฃผ์
์ ๊ฐ์ฌํด์ ์์ฌ๋ ๐ |
@@ -0,0 +1,76 @@
+package christmas.domain.entity;
+
+import static christmas.domain.verifier.VisitDateVerifier.VISIT_DATE_VERIFIER;
+import static christmas.system.Constant.CHRISTMAS;
+import static christmas.system.Constant.FIRST_DAY_OF_MONTH;
+
+public class Day {
+
+ private static final int WEEK_LENGTH = 7;
+ ... | Java | ๊ฐ์ธ์ ์ธ ์๊ฒฌ์ธ๋ฐ, `isFriday() || isSaturday()`๊ฐ `isWeekend()`๋ฉ์๋์ ๋๊ฐ์ผ๋, ์ด๊ฑธ ํ์ฉํ๋๊ฒ ์ด๋จ๊น์?
```java
public boolean isWeekday() {
return !isWeekend();
}
```
์ด๋ ๊ฒ์! ๐ |
@@ -0,0 +1,59 @@
+package christmas.domain.entity;
+
+import java.util.HashMap;
+import java.util.Map;
+
+import static christmas.domain.entity.MenuType.*;
+
+public enum Menu {
+
+ MUSHROOM_SOUP("์์ก์ด์ํ", 6_000, APPETIZER),
+ TAPAS("ํํ์ค", 5_500, APPETIZER),
+ CAESAR_SALAD("์์ ์๋ฌ๋", 8_000, APPETIZER),
+
+ T_B... | Java | ๋ฐ๋ก `HashMap`์ ๋ง๋ค์ด ๋ ์ด์ ๊ฐ ๊ถ๊ธํฉ๋๋ค! `getMenuItemByName`๋ฉ์๋์์ ๊ฒ์์๋๋ฅผ ๋์ด๊ธฐ ์ํจ์ธ๊ฐ์? |
@@ -0,0 +1,12 @@
+package christmas.domain.util;
+
+
+import java.text.DecimalFormat;
+
+public final class Util {
+ public static String createFormattedAmount(int target) {
+ DecimalFormat formatter = new DecimalFormat("###,##0");
+ return formatter.format(target);
+ }
+
+} | Java | split์ ํ ๊ฒฐ๊ณผ๊ฐ ์ฌ์ด์ฆ๊ฐ 1์ด์ด์ `orderItemSpec[1]`์ ์ ๊ทผ์ด `IndexOutOfBoundsException`์ ์ผ์ผํฌ ๊ฒฝ์ฐ๋ ์๋์? ์ด๋ฅผ ์ผ๋ํด๋์
จ๋๋ฉด ์ด๋ป๊ฒ ๊ฒ์ฆ์ ํ์
จ๋์ง ๊ถ๊ธํฉ๋๋ค! |
@@ -0,0 +1,96 @@
+package christmas.domain.verifier;
+
+
+import christmas.domain.entity.Menu;
+import java.util.HashSet;
+import java.util.Set;
+import java.util.regex.Matcher;
+import java.util.regex.Pattern;
+
+import static christmas.system.ExceptionMessage.*;
+
+public class OrderMenuVerifier implements Verifier<S... | Java | ๋ฐ๋ก ์ธ์์ ๋ฐ๋ผ์ ํจํด์ด ๋ฌ๋ผ์ง๋ ๊ฒ ๊ฐ์ง ์์๋ฐ, ํ๋์์ ๋ฐ๋ก ์ด๊ธฐํํ์ง ์๊ณ , ์์ฑ์ ๋ด๋ถ์์ ์ด๊ธฐํํ์ ์ด์ ๊ฐ ๊ถ๊ธํฉ๋๋ค! ๋ญ๊ฐ ๋ ์ข์ ๋ฐฉ๋ฒ์ธ์ง ์ ๋ ์ ๋ชจ๋ฅด๊ฒ ์ด์.. ๐ |
@@ -0,0 +1,14 @@
+package christmas.domain.verifier;
+
+public interface Verifier<T> {
+
+ abstract public void validate(T input);
+
+ static void throwIllegalArgumentError(String errorMessage) {
+ throw new IllegalArgumentException(errorMessage);
+ }
+
+ static void throwIllegalStateError(String err... | Java | ์ด ์ธํฐํ์ด์ค๋ฅผ ๊ตฌํํ ํด๋์ค๋ค์ `check`๋ง ์ฌ์ฉํ๋ฉด ํ์ํ ๊ฒ์ฆ์ด ๋ค ๋๋ ๋ฐฉ์์ด๋ค์! ๊น๋ํ๊ณ ์ข๋ค์! ๐ |
@@ -0,0 +1,59 @@
+package christmas.domain.entity;
+
+import java.util.HashMap;
+import java.util.Map;
+
+import static christmas.domain.entity.MenuType.*;
+
+public enum Menu {
+
+ MUSHROOM_SOUP("์์ก์ด์ํ", 6_000, APPETIZER),
+ TAPAS("ํํ์ค", 5_500, APPETIZER),
+ CAESAR_SALAD("์์ ์๋ฌ๋", 8_000, APPETIZER),
+
+ T_B... | Java | ๋ค ๋ง์์! HashMap์ ์ฌ์ฉํ๋ฉด ๊ฒ์์๋๊ฐ O(1)์ ๊ฐ๊น์ด ์๋๋ก ๋งค์ฐ ํฅ์๋๋ค๊ณ ํฉ๋๋ค.!! |
@@ -0,0 +1,96 @@
+package christmas.domain.verifier;
+
+
+import christmas.domain.entity.Menu;
+import java.util.HashSet;
+import java.util.Set;
+import java.util.regex.Matcher;
+import java.util.regex.Pattern;
+
+import static christmas.system.ExceptionMessage.*;
+
+public class OrderMenuVerifier implements Verifier<S... | Java | ์ ๋ ๋ญ๊ฐ ๋ ์ข์ ๋ฐฉ๋ฒ์ธ์ง ๋ชฐ๋ผ์ ์ฐพ์๋ดค์๋๋ฐ,
์์ฑ์์์ ์ด๊ธฐํ๋ฅผ ํ๋ฉด, ์์ฑ์ ์์ ํจ์์ ๋ํ ์์ธ์ฒ๋ฆฌ๊ฐ ๊ฐ๋ฅํด์ง๊ณ , ์ธ๋ถ์์ ๋ค๋ฅธ pattern๊ฐ์ฒด๋ฅผ ์ฃผ์
ํ๊ธฐ๊ฐ ์ฌ์์ง๋ค๊ณ ํ๋๋ผ๊ตฌ์.
๋ฐ๋ฉด์ ํ๋์์ ์ด๊ธฐํํ๋ฉด ๊ฐ๋
์ฑ๊ณผ ๊ฐ๊ฒฐํจ์ด ์ฅ์ ์ด์ฃ .
์์ฑ์์์์ ์์ธ์ฒ๋ฆฌ ๋ก์ง์ด ์์ง๋ง ์ด๋ ๊ฒ๋ ํ๋ฒ ํด๋ดค์ด์! ์ํฉ์ ๋ฐ๋ผ์ ๋ค๋ฅด๊ฒ ํด๋ณด๋ฉด ์ข์๊ฑฐ ๊ฐ์์!! |
@@ -0,0 +1,14 @@
+package christmas.domain.verifier;
+
+public interface Verifier<T> {
+
+ abstract public void validate(T input);
+
+ static void throwIllegalArgumentError(String errorMessage) {
+ throw new IllegalArgumentException(errorMessage);
+ }
+
+ static void throwIllegalStateError(String err... | Java | ํผ๋๋ฐฑ ์ ๋ง ๊ฐ์ฌํด์! ์ธ์
๋๋ ํฌ๋ฆฌ์ค๋ง์ค ์ฝ๋ ๋ฆฌ๋ทฐ ํด๋๋ฆด๋ ค๊ณ ํ๋๋ฐ repository๊ฐ private์ธ๊ฐ๋ด์๐ |
@@ -0,0 +1,76 @@
+package christmas.domain.entity;
+
+import static christmas.domain.verifier.VisitDateVerifier.VISIT_DATE_VERIFIER;
+import static christmas.system.Constant.CHRISTMAS;
+import static christmas.system.Constant.FIRST_DAY_OF_MONTH;
+
+public class Day {
+
+ private static final int WEEK_LENGTH = 7;
+ ... | Java | ์ค... ๊ฐ์ฌํฉ๋๋ค.! ๋ฆฌํํ ๋ง ํด๋ณผ๊ฒ์ |
@@ -0,0 +1,12 @@
+package christmas.domain.util;
+
+
+import java.text.DecimalFormat;
+
+public final class Util {
+ public static String createFormattedAmount(int target) {
+ DecimalFormat formatter = new DecimalFormat("###,##0");
+ return formatter.format(target);
+ }
+
+} | Java | ์๋ฅผ๋ค์ด,
Input: ์ดํ์ธ-
์ด๋ ๊ฒ ์
๋ ฅ๋ ๊ฒฝ์ฐ, orderMenuVerifier์ checkMenuFormat ๋ฉ์๋์ ์ํด ์ฌ๋ฐ๋ฅธ ๋ฉ๋ด ํ์์ด ์๋ ์์ธ์ฒ๋ฆฌ๊ฐ ๋์ด์ ธ๋ฒ๋ ค
์์ Util๋ฉ์๋๋ฅผ ํธ์ถํ๋ ๊ฒฝ์ฐ๊ฐ ์๋๋ก ๊ตฌํํ์ต๋๋ค.
<img width="474" alt="image" src="https://github.com/Hoo-sung/java-christmas-6-Hoo-sung/assets/121723421/e2a0a147-e665-4a6a-94ce-3876632e0d0b">
์ด๋ ๊ฒ orderMenuVerifier๋ก ๊ฒ์ฆ์ ๋ง์น๊ณ Util cl... |
@@ -0,0 +1,54 @@
+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 | ```
const API_URL = `${import.meta.env.VITE_API_URL}`;
const USER_ID = `${import.meta.env.VITE_USER_ID}`;
const USER_PASSWORD = `${import.meta.env.VITE_USER_PASSWORD}`;
```
์ด ๋ถ๋ถ์ ์์ ํ์ผ์์ ๋ฐ๋ก ๊ด๋ฆฌํด๋ณด๋ ๊ฒ์ ์ด๋จ๊น์?
`API_URL `์ด ์์ด๋ endPoint, fetchWithAuth์์ ๋ ๋ฒ ์ ์ธ๋๋ค์ |
@@ -0,0 +1,123 @@
+import { RULE } from "@constants/rules";
+import {
+ CART_ITEMS_COUNTS_ENDPOINT,
+ CART_ITEMS_ENDPOINT,
+ PRODUCTS_ENDPOINT,
+} from "./endpoints";
+import { fetchWithAuth } from "./fetchWithAuth";
+
+/**
+ * @example
+ * const params: QueryParams = {
+ * category: 'fashion',
+ * page: 1,
+ * s... | TypeScript | ์์ฒญํด์ผํ๋ api ๊ฐ ๋ง์์ง๋ค๋ฉด, api/index.ts ์ฝ๋๊ฐ ๋ง์์ง๊ฒ ๋ค์.
๊ด๋ จ์๋ api ์์ฒญ ๋ผ๋ฆฌ ๋ฌถ์ด์ ํ์ผ๋ก ๊ด๋ฆฌํ๊ณ , index.ts์์ ํด๋น ํ์ผ๋ค์ api ์์ฒญ ๋ฉ์๋๋ฅผ export ํ๋ ๊ฒ์ ์ด๋จ๊น์?
```dash
api
ใด cart
ใด products
ใด index
``` |
@@ -0,0 +1,61 @@
+import { forwardRef, useContext } from "react";
+import * as PI from "./ProductItem.style";
+import CartControlButton from "../../Button/CartControlButton";
+import { deleteProductInCart, postProductInCart } from "@api/index";
+import { useError } from "@hooks/index";
+import { CartItemsContext } from... | Unknown | ์ฅ๋ฐ๊ตฌ๋์ ๋ด๋ ๋ก์ง๊ณผ ๋นผ๋ ๋ก์ง์ ํจ์๋ก ๋ถ๋ฆฌํ๊ณ ,
if else๋์ early return ์ ์ฌ์ฉํด๋ณด๋ ๊ฒ์ ์ด๋จ๊น์? |
@@ -0,0 +1,61 @@
+import { forwardRef, useContext } from "react";
+import * as PI from "./ProductItem.style";
+import CartControlButton from "../../Button/CartControlButton";
+import { deleteProductInCart, postProductInCart } from "@api/index";
+import { useError } from "@hooks/index";
+import { CartItemsContext } from... | Unknown | alt์ ๋ํด์ ์ ๋ฒ ๋ฏธ์
์์ ํ๋ฃจ์๊ฒ ๋ฐ์ ํผ๋๋ฐฑ์ ๊ณต์ ํ ๊ฒ์.
image์ alt๋ 'ํฐ ์ด๋ํ์ ๊ฒ์์ ์ค์ด ํ๋ ๋ค์ด๊ฐ ์๋๋ค์ค ์ด๋ํ'์ฒ๋ผ ํด๋น ์ด๋ฏธ์ง์ ๋ํ ๊ตฌ์ฒด์ ์ธ ์ค๋ช
์ด ๋ค์ด๊ฐ์ผํด์.
ํ์ง๋ง ํ์ฌ ์๋ฒ์์ ์ฃผ๋ ์์ธํ ์ํ ์ค๋ช
์ด ์๋ ์ํฉ์์๋`alt=''"`๋ฅผ ์ฌ์ฉํ๋ ๊ฒ์ด ์ข๋ค๊ณ ํ๋ค์.
alt๋ฅผ ์ฌ์ฉํ์ง ์๋ ๊ฒ๊ณผ alt์ ๋น๋ฌธ์์ด๋ก ๋๋ ๊ฒ์ ์ฐจ์ด๋ฅผ ๊ณต๋ถํด๋ณธ๋ค๋ฉด, ์ํ์๊ฒ ๋์์ด ๋ ๊ฑฐ์์. ๐ |
@@ -0,0 +1,44 @@
+import { FILTER_CATEGORIES, SORT_PRICE } from "@constants/rules";
+import * as PLH from "./ProductListHeader.style";
+
+interface ProductListHeaderProps {
+ handleCategory: (category: Category) => void;
+ handleSort: (sort: Sort) => void;
+}
+
+const ProductListHeader = ({
+ handleCategory,
+ hand... | Unknown | selectbox ๋ ๋ค name,id๋ฅผ ๋น๋ฌธ์์ด๋ก ๋ ์ด์ ๊ฐ ์์๊น์? |
@@ -0,0 +1,44 @@
+import { FILTER_CATEGORIES, SORT_PRICE } from "@constants/rules";
+import * as PLH from "./ProductListHeader.style";
+
+interface ProductListHeaderProps {
+ handleCategory: (category: Category) => void;
+ handleSort: (sort: Sort) => void;
+}
+
+const ProductListHeader = ({
+ handleCategory,
+ hand... | Unknown | selectbox๋ฅผ ํ๋์ ์ปดํฌ๋ํธ๋ก ๋ถ๋ฆฌํด๋ ์ข์ ๊ฒ ๊ฐ์์. |
@@ -0,0 +1,54 @@
+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 | ์ค, ๋ฐ๋ก ์ ๊ทน ๋ฐ์ ํ๊ฒ ์ต๋๋ค! |
@@ -0,0 +1,61 @@
+import { forwardRef, useContext } from "react";
+import * as PI from "./ProductItem.style";
+import CartControlButton from "../../Button/CartControlButton";
+import { deleteProductInCart, postProductInCart } from "@api/index";
+import { useError } from "@hooks/index";
+import { CartItemsContext } from... | Unknown | ์ง์ง ์ ์ฑ์ด๋ฆฐ ๋ต๋ณ ์ต๊ณ .. |
@@ -0,0 +1,44 @@
+import { FILTER_CATEGORIES, SORT_PRICE } from "@constants/rules";
+import * as PLH from "./ProductListHeader.style";
+
+interface ProductListHeaderProps {
+ handleCategory: (category: Category) => void;
+ handleSort: (sort: Sort) => void;
+}
+
+const ProductListHeader = ({
+ handleCategory,
+ hand... | Unknown | ์.. ๊ทธ๊ฒ์ ๋ฏธ์ฒ ์์ฑํ์ง ๋ชปํ ์ ์ ์ค์.. |
@@ -0,0 +1,44 @@
+import { FILTER_CATEGORIES, SORT_PRICE } from "@constants/rules";
+import * as PLH from "./ProductListHeader.style";
+
+interface ProductListHeaderProps {
+ handleCategory: (category: Category) => void;
+ handleSort: (sort: Sort) => void;
+}
+
+const ProductListHeader = ({
+ handleCategory,
+ hand... | Unknown | ๋ฐ๋ก ๋ถ๋ฆฌํ ๊น ๊ณ ๋ฏผํ์๋๋ฐ, ์๊ฒฌ์ด ๋ค์ด์์ผ๋ ๋ถ๋ฆฌํด๋ณด๊ฒ ์ต๋๋ค! |
@@ -0,0 +1,195 @@
+# https://www.acmicpc.net/problem/9663
+
+# import sys
+# from turtle import width
+# n = int(sys.stdin.readline())
+
+# all_page = [0] * n #์ด
+# a = [False] * n #ํ
+# b = [False] * ((n * 2) - 1) #์ ๋ฐฉํฅ ๋๊ฐ
+# c = [False] * ((n * 2) - 1) #์ญ๋ฐฉํฅ ๋๊ฐ
+
+
+# def queen(n) -> None:
+# first = 0... | Python | ์ ๋ ๋จ์ ๊ฑฐ ์ฐธ๊ณ ํ๊ฑฐ๋ผ ๋ถ๋๋ฝ๋ค์ ใ
์ด์ฐจ์ ๋ฐฐ์ด๋ก ํ๋ค๊ฐ 1์ฐจ์๋ฐฐ์ด๋ก ์ค์ผ ์ ์๋ค๋ ๋ฐ์์ด ์ด๋ ค์ ๋ ๊ฒ ๊ฐ์ต๋๋ค. |
@@ -0,0 +1,23 @@
+# https://www.acmicpc.net/problem/1181
+# https://blockdmask.tistory.com/543
+# set์ ์ด์ฉํ๋ฉด ์ค๋ณต์ด ์ ๊ฑฐ๋จ
+# https://always-challenger-lab.tistory.com/22
+# ๋๋ค ์ด์ฉํด์ ๋ค์ค์กฐ๊ฑด ์ ๋ ฌ
+import sys
+
+n = int(sys.stdin.readline())
+s = []
+m = []
+for i in range(n):
+ s.append(str(sys.stdin.readline().strip(... | Python | ๋๋ค ์ฌ์ฉ์ด ์ ๋ฐํค๋ค์ ใ
.ใ
์ฐธ๊ณ ๊ฐ ๋์ต๋๋ค. |
@@ -1,152 +1,44 @@
package com.example.project.compile.service;
+import com.example.project.compile.domain.CompileLanguage;
import com.example.project.error.dto.ErrorMessage;
-import org.springframework.beans.factory.annotation.Value;
+import lombok.RequiredArgsConstructor;
+import lombok.extern.slf4j.Slf4j;
impor... | Java | enum์ ์ฌ์ฉํฉ์๋ค |
@@ -1,152 +1,44 @@
package com.example.project.compile.service;
+import com.example.project.compile.domain.CompileLanguage;
import com.example.project.error.dto.ErrorMessage;
-import org.springframework.beans.factory.annotation.Value;
+import lombok.RequiredArgsConstructor;
+import lombok.extern.slf4j.Slf4j;
impor... | Java | ํด๋์ค๊ฐ ๋๋ฌด ํฝ๋๋ค. ์ญํ ์ ๋๋ ์ฃผ์ธ์ |
@@ -1,36 +1,40 @@
package com.example.project.compile.controller.rest;
+import com.example.project.auth.service.AuthTokenService;
import com.example.project.common.dto.ResponseDto;
import com.example.project.common.dto.ResponseMessage;
-import com.example.project.solution.dto.request.user.SolutionCompileRequest;
+... | Java | HttpServletRequest๋ง ๋ฐ์์ค๋ฉด ํ ํฐ ๊ฐ์ ๋ฐ๋ก ๋ฐ์์ค์ง ์์๋ ๋ฉ๋๋ค |
@@ -0,0 +1,37 @@
+package com.example.project.compile.service;
+
+import com.example.project.compile.domain.CompileLanguage;
+import com.example.project.error.dto.ErrorMessage;
+import org.springframework.stereotype.Service;
+
+import java.io.IOException;
+import java.nio.file.Files;
+import java.nio.file.InvalidPathEx... | Java | yml ์ ์ค์ ํ ๊ฐ์ ์ฌ์ฉํด์ฃผ์ธ์.
๊ทธ๋ฆฌ๊ณ static์ ์ฌ์ฉํ ํ์๋ ์์ด๋ณด์
๋๋ค. |
@@ -1,36 +1,40 @@
package com.example.project.compile.controller.rest;
+import com.example.project.auth.service.AuthTokenService;
import com.example.project.common.dto.ResponseDto;
import com.example.project.common.dto.ResponseMessage;
-import com.example.project.solution.dto.request.user.SolutionCompileRequest;
+... | Java | ์ปดํ์ผํ๋ ์๋ฒ์์๋ JWT ํ ํฐ์ ๊ฐ์ง๊ณ ์ ํจํ ์ ๊ทผ์ธ์ง ์๋์ง ํ๋จํด์ ์ปดํ์ผํ ์ ์๋๋ก ํด์ฃผ์ธ์ |
@@ -0,0 +1,37 @@
+package com.example.project.compile.service;
+
+import com.example.project.compile.domain.CompileLanguage;
+import com.example.project.error.dto.ErrorMessage;
+import org.springframework.stereotype.Service;
+
+import java.io.IOException;
+import java.nio.file.Files;
+import java.nio.file.InvalidPathEx... | Java | ๋ณ์๋ช
์ ์นด๋ฉ์ผ์ด์ค๋ฅผ ์ง์ผ์ ์์ฑํด์ฃผ์ธ์ |
@@ -0,0 +1,9 @@
+package com.codesquad.baseballgame.domain.game.controller;
+
+import org.springframework.web.bind.annotation.RestController;
+
+@RestController
+public class GameController {
+
+
+} | Java | ์. ์ด๋ฐ ์ปจํธ๋กค๋ฌ๋ ์ฐ์ง ์๋๋ค๋ฉด ๊ทธ๋๊ทธ๋ ์ง์์ฃผ๋ ๊ฒ์ด ์ข๊ฒ ์ต๋๋ค. |
@@ -0,0 +1,24 @@
+package com.codesquad.baseballgame.domain.game.controller;
+
+import com.codesquad.baseballgame.domain.game.service.MatchService;
+import lombok.RequiredArgsConstructor;
+import org.springframework.http.HttpStatus;
+import org.springframework.http.ResponseEntity;
+import org.springframework.web.bind.a... | Java | ์ค๊ณํ๊ธฐ ๋๋ฆ์ด๊ธด ํ์ง๋ง, `@PathVariable` ๋ง์ ํ๋ผ๋ฏธํฐ๋ก ๋ฐ๋ ์๋ํฌ์ธํธ์์ `POST` ๋ฅผ ์ฐ๋๊ฑด ๋ค์ ์ด์ํด๋ณด์ด๊ธด ํ๋ค์.
๋ญ๊ฐ๊ฐ ๋๋ฝ๋ ๊ฑด ์๋๊ฐ์. ๋ฆฌํด ๋ฐ๋์ `true` `false` ๋ง์ ์ฃ๋ ๊ฒ๋ ์ข ์ด์ํฉ๋๋ค. |
@@ -0,0 +1,7 @@
+package com.codesquad.baseballgame.domain.game.dao;
+
+import org.springframework.stereotype.Repository;
+
+@Repository
+public class GameDao {
+} | Java | ์ ์ฌ๊ธฐ๋ ๋น์ด์๊ตฐ์? |
@@ -0,0 +1,14 @@
+package com.codesquad.baseballgame.domain.game.dto;
+
+import lombok.Getter;
+import lombok.RequiredArgsConstructor;
+import lombok.ToString;
+
+@Getter @ToString
+@RequiredArgsConstructor
+public class BallCountDto {
+
+ private int strike;
+ private int ball;
+ private int out;
+} | Java | ์ ๋
ธํ
์ด์
์ ํ ์ค์ ํ๋๋ฅผ ์ฐ๋ ๊ฒ์ ์์น์ผ๋ก ํด ์ฃผ์ธ์.
```suggestion
@Getter
@ToString |
@@ -0,0 +1,14 @@
+package com.codesquad.baseballgame.domain.game.dto;
+
+import lombok.Getter;
+import lombok.RequiredArgsConstructor;
+import lombok.ToString;
+
+@Getter @ToString
+@RequiredArgsConstructor
+public class BallCountDto {
+
+ private int strike;
+ private int ball;
+ private int out;
+} | Java | ์์ฑ์๊ฐ ์ํ๋ ๋๋ก ์์ฑ๋์๋์?
์ ๊ฐ ์๊ธฐ๋ก ์ด ์ ๋
ธํ
์ด์
์ `final` ํ๋์ ๋ํด์๋ง ์์ฑ์๋ฅผ ๋ง๋๋๋ฐ์.
์๋ ์ด๋ค ํ๋๋ `final` ์์ฝ์ด๋ฅผ ๊ฐ์ง ์๋ค์. |
@@ -0,0 +1,10 @@
+package com.codesquad.baseballgame.domain.game.service;
+
+import org.springframework.stereotype.Service;
+
+@Service
+public class GameService {
+
+
+
+} | Java | ์ ์ด๋ ๊ฒ ๋น์ด์๋ ํด๋์ค๋ค์ด ๋ง์๊ฑฐ์ฃ ... |
@@ -0,0 +1,23 @@
+package com.codesquad.baseballgame.domain.game.service;
+
+import com.codesquad.baseballgame.domain.team.dao.TeamDao;
+import lombok.RequiredArgsConstructor;
+import org.springframework.stereotype.Service;
+import org.springframework.transaction.annotation.Isolation;
+import org.springframework.transa... | Java | `SERIALIZABLE` ์ ๋ง ๊ด์ฐฎ์๊น์? ์ ํํ ์ดํดํ๊ณ ์ฌ์ฉํ์ ๊ฑด๊ฐ์.
๋๋ถ๋ถ์ ๊ฒฝ์ฐ `SERIALIZABLE` ๊น์ง ๊ณ ๋ฆฝ์์ผ์ผ ํ ํธ๋์ญ์
์ ์์ต๋๋ค.
์ ํ๋ฆฌ์ผ์ด์
๋ ์ด์ด์์ ์ด๋ฐ ์์ค์ ๊ณ ๋ฆฝ์ด ํ์ํ ๊ฒฝ์ฐ, ์ ํ๋ฆฌ์ผ์ด์
๋ก์ง์ ๋ค์ ๊ฒํ ํด์ ์ ๋ง ์ด์ ๋์ ํธ๋์ญ์
์ด ํ์ํ์ง ์ดํด๋ณด๊ณ ,
์ ๋ง ๊ณ ๋ฆฝ ์์ค ์กฐ์ ์ด ํ์ํ ๊ฒฝ์ฐ์๋, ์ฌ์ค์ ๊ณ ๋ฆฝ ์์ค ์กฐ์ ์ด ์๋๋ผ propagation ์ ๋ต ์์ ์ผ๋ก ๋์ํ ์ ์์ง๋ ์์์ง ๋ค์ ํ ๋ฒ ์๊ฐํด๋ด์ผ ํฉ๋๋ค.
์๋ง ๊ฐฏ์๋ฅผ ์ธ๋ ์ฟผ๋ฆฌ๊ฐ ์๋ค๋ณด๋ ์ฟผ๋ฆฌ๊ฐ ๋๋ ๋์ ์๋ก์ด ์ปค๋ฐ์ด ์ผ์ด๋์ ๊ฒฐ๊ณผ๊ฐ ๋ค๋ฐ๋๋ ์ผ... |
@@ -0,0 +1,23 @@
+package com.codesquad.baseballgame.domain.game.service;
+
+import com.codesquad.baseballgame.domain.team.dao.TeamDao;
+import lombok.RequiredArgsConstructor;
+import org.springframework.stereotype.Service;
+import org.springframework.transaction.annotation.Isolation;
+import org.springframework.transa... | Java | `@Transactional` ์ด ์ ์ธ๋ ๋ฉ์๋์์ ์ด๋ ๊ฒ ๋ฉ์๋๋ฅผ ํธ์ถํ๋ฉด, ํธ๋์ญ์
์ด ์ ์ฉ๋์ง ์์ต๋๋ค.
https://mommoo.tistory.com/92 |
@@ -0,0 +1,20 @@
+package com.codesquad.baseballgame.domain.hitter.mapper;
+
+import com.codesquad.baseballgame.domain.hitter.dto.HitterListDto;
+import org.springframework.jdbc.core.RowMapper;
+
+import java.sql.ResultSet;
+import java.sql.SQLException;
+
+public class HitterListMapper implements RowMapper<HitterListD... | Java | `RowMapper` ์์ ๋ฐ๋ก DTO๋ก ๋งคํํ๋ค์.
๋ชจ๋ธ ํด๋์ค๊ฐ ํ๋ ์๋๊ฒ ์ข๊ธด ํ๋ฐ... ๋ชจ๋ธ ํด๋์ค์ ํ์์ฑ์ด ์์๋๋ณด๋ค์. |
@@ -0,0 +1,15 @@
+package com.codesquad.baseballgame.domain.scoreboard.controller;
+
+import org.springframework.web.bind.annotation.GetMapping;
+import org.springframework.web.bind.annotation.PathVariable;
+import org.springframework.web.bind.annotation.RestController;
+
+@RestController
+public class ScoreBoardContro... | Java | ์...... |
@@ -0,0 +1,23 @@
+package com.codesquad.baseballgame.domain.scoreboard.dao;
+
+import com.codesquad.baseballgame.domain.scoreboard.dto.ScoreBoardInningDto;
+import com.codesquad.baseballgame.domain.team.mapper.TeamDtoMapper;
+import org.springframework.jdbc.core.namedparam.NamedParameterJdbcTemplate;
+import org.spring... | Java | ์ฃผ์์ ์ง์์ฃผ์ธ์. |
@@ -0,0 +1,9 @@
+package com.codesquad.baseballgame.domain.game.controller;
+
+import org.springframework.web.bind.annotation.RestController;
+
+@RestController
+public class GameController {
+
+
+} | Java | ๋ค ๊ผญ ์ง์ฐ๋๋ก ํ๊ฒ ์ต๋๋ค ์ ๋ ํด์ ์๋๋ ์ง์ ํด๋ฒ๋ ธ๊ตฐ์. ๊ผญ ๋ช
์ฌํ๊ฒ ์ต๋๋ค |
@@ -0,0 +1,24 @@
+package com.codesquad.baseballgame.domain.game.controller;
+
+import com.codesquad.baseballgame.domain.game.service.MatchService;
+import lombok.RequiredArgsConstructor;
+import org.springframework.http.HttpStatus;
+import org.springframework.http.ResponseEntity;
+import org.springframework.web.bind.a... | Java | ์ฐ๋ฉด์ ์๋ฟ์ธ.. ํ๊ณ ๋๋์ ์์๋๋ฐ.. ๋ง์ง๋ง์ ๋ง๋๋๋ผ ๊ธฐ๋ณธ ๋ฒ์น์ ์๊ณ ๋ง ๋ง๋ ๊ฒ ์์ธ์ด์์ต๋๋ค. ๊ธํ๋๋ผ๋ ์งํฌ๊ฑด ์งํค๋ฉด์ ๋ง๋ค์ด์ผํ๋๋ฐ ์ ๊ฐ ๋๋ฌด ์๋๋ ๋ค์. ์ต์ํ์ Json์ ๋ง๋ค์์ด์ผํ๋๋ฐ ๋ค์์๋ ์งํค๋๋ก ํ๊ฒ ์ต๋๋ค. |
@@ -0,0 +1,7 @@
+package com.codesquad.baseballgame.domain.game.dao;
+
+import org.springframework.stereotype.Repository;
+
+@Repository
+public class GameDao {
+} | Java | ๋ค... ๋ง์์ ์ง์ ์ด์ผํ์ด์. |
@@ -0,0 +1,14 @@
+package com.codesquad.baseballgame.domain.game.dto;
+
+import lombok.Getter;
+import lombok.RequiredArgsConstructor;
+import lombok.ToString;
+
+@Getter @ToString
+@RequiredArgsConstructor
+public class BallCountDto {
+
+ private int strike;
+ private int ball;
+ private int out;
+} | Java | ์ฌ๋ฌ์๊ฐ ํ๋ฉด์ ์ฝ๋ฉํ๋ค๊ฐ ์๋ฌด๊ฑฐ๋ ๋ค ๋ฃ๋๋ฐ๋์ ์๊ธด ๋ฌธ์ ์
๋๋ค. ๊ธฐ๋ฅ ํ๋๋ง๋ค ๋ ๊ทธ๋ ์ง์คํ์ด์ผ ํ๋๋ฐ ์ด๊ฒ ์ ๊ฒํ๋ค๊ฐ ์ด๋์ ๋ ์๋๊ฒ ๋์์ต๋๋ค. ์ ๊ฐ ์ด๊ฑธ ๋ฃ์๋ค๋๊ฒ๋ ์ง๊ธ ์์๋ค์. Dto ์์ ๋ฃ์ ์๊ฐ ์์๋๋ฐ.... ์ด๋ฒ ๊ธฐํ๋ก ์ ์ ๋๋ฐ๋ก ์ฐจ๋ ค์ผ๊ฒ ์ต๋๋ค |
@@ -0,0 +1,23 @@
+package com.codesquad.baseballgame.domain.game.service;
+
+import com.codesquad.baseballgame.domain.team.dao.TeamDao;
+import lombok.RequiredArgsConstructor;
+import org.springframework.stereotype.Service;
+import org.springframework.transaction.annotation.Isolation;
+import org.springframework.transa... | Java | ํธ๋์ ์
์ ๋ํ ๋ด์ฉ์ ๋ธ๋ก๊ทธ์์ ๊ฐ๋ณ๊ฒ ๋ณด๊ณ ์ด ๋ ์ฐ๋๊ฑด๊ฐ ํ๊ณ ์ผ๋๋ฐ ์ข ๋ ๊ณต๋ถ๊ฐ ํ์ํ๋๊ตฐ์. Read Committed ์ ๋ํด์ ์กฐ์ฌํ๊ฒ ์ต๋๋ค. |
@@ -0,0 +1,20 @@
+package com.codesquad.baseballgame.domain.hitter.mapper;
+
+import com.codesquad.baseballgame.domain.hitter.dto.HitterListDto;
+import org.springframework.jdbc.core.RowMapper;
+
+import java.sql.ResultSet;
+import java.sql.SQLException;
+
+public class HitterListMapper implements RowMapper<HitterListD... | Java | ๋ชจ๋ธ ํด๋์ค์ ํ์์ฑ์ด ์์๋ค๊ธฐ๋ณด๋จ ์ค๊ณ๊ฐ ์๋ชป๋์์ต๋๋ค. ๋ง์ฝ ๋ชจ๋ธํด๋์ค์ ๋ง๊ฒ ํ๋ค๋ฉด ์ง๊ธ๋ณด๋ค ๋์ฑ ๋น ๋ฅด๊ฒ ์ฝ๋ฉ์ด ๋์์ํ
๋ฐ ์์ฝ์ต๋๋ค. ์ค๊ณ๋ฅผ ๊ผญ ์ ๋๋ก ๋ง์ถฐ์ผ๊ฒ ๋ค์ |
@@ -0,0 +1,23 @@
+package com.codesquad.baseballgame.domain.scoreboard.dao;
+
+import com.codesquad.baseballgame.domain.scoreboard.dto.ScoreBoardInningDto;
+import com.codesquad.baseballgame.domain.team.mapper.TeamDtoMapper;
+import org.springframework.jdbc.core.namedparam.NamedParameterJdbcTemplate;
+import org.spring... | Java | ๋ต |
@@ -0,0 +1,15 @@
+package com.codesquad.baseballgame.domain.scoreboard.controller;
+
+import org.springframework.web.bind.annotation.GetMapping;
+import org.springframework.web.bind.annotation.PathVariable;
+import org.springframework.web.bind.annotation.RestController;
+
+@RestController
+public class ScoreBoardContro... | Java | ์ฉ์ํด์ฃผ์ญ์์ค... |
@@ -0,0 +1,23 @@
+package com.codesquad.baseballgame.domain.game.service;
+
+import com.codesquad.baseballgame.domain.team.dao.TeamDao;
+import lombok.RequiredArgsConstructor;
+import org.springframework.stereotype.Service;
+import org.springframework.transaction.annotation.Isolation;
+import org.springframework.transa... | Java | ํธ๋์ ์
์ ๋ํด์ ํ์คํ๊ฒ ๊ณต๋ถํด์ผ๊ฒ ๋ค์. ์ด์คํ ์ฌ์ฉ์ ์ง์ํด๋ณด๋๋ก ํ๊ฒ ์ต๋๋ค. |
@@ -0,0 +1,23 @@
+package com.codesquad.baseballgame.domain.game.service;
+
+import com.codesquad.baseballgame.domain.team.dao.TeamDao;
+import lombok.RequiredArgsConstructor;
+import org.springframework.stereotype.Service;
+import org.springframework.transaction.annotation.Isolation;
+import org.springframework.transa... | Java | ์ ์ค๋ ์ ํํ๊ฒ ์์
์ ํ๋๊ตฐ์ ๋ฆฌ๋ทฐ๋ณด์๋ง์ ์์
์ ํ๋ ๊ธฐ์ฉ๋๋ค. Repeatable Read๋ก๋ง ์ปค๋ฒ๊ฐ ๊ฐ๋ฅํ๋ค์ |
@@ -0,0 +1,28 @@
+package christmas.util;
+
+public class DateValidator {
+ private static final String INVALID_DATE_MESSAGE = "์ ํจํ์ง ์์ ๋ ์ง์
๋๋ค. ๋ค์ ์
๋ ฅํด ์ฃผ์ธ์.";
+
+ public static void validateInput(String input) {
+ validateNumeric(input);
+ int date = Integer.parseInt(input);
+ validateDate(date... | Java | 31์ผ๋ก ๋๋์ง ์๋ ๋ฌ๋ ์๊ธฐ๋๋ฌธ์ 12์์ ๋ํ ์์กด์ฑ์ ์ฃผ์
๋ฐ์์ ํด๋นํ๋ ์(ๆ)์ ๋ง์ถฐ ์ต๋ ์ผ์๋ฅผ ๋ณ๊ฒฝ ํ๋์ง ํด๋น ์ด๋ฒคํธ์ ๋ํ ์์๋ฅผ ์ฌ์ฉํ๊ฑฐ๋ ๊ทธ ์ธ ๋ค์ํ ๋ฐฉ์์ผ๋ก ์กฐ๊ฑด์ ์กฐ์ ํ๋ ๊ฒ๋ ์ข์๊ฑฐ๋ผ ์๊ฐํฉ๋๋ค! |
@@ -0,0 +1,103 @@
+package christmas.util;
+
+import christmas.domain.type.Menu;
+
+import java.util.*;
+import java.util.regex.Pattern;
+import java.util.stream.Collectors;
+
+public class OrderValidator {
+ private static final String LINE_SEPARATOR = System.lineSeparator();
+
+ private static final int MIN_AMO... | Java | ์ ๊ท์์ ์ฌ์ฉํ ๋ ๋ฏธ๋ฆฌ ์บ์ฑํ๋ ๋ฐฉ๋ฒ์ด ์๋ค๊ณ ํฉ๋๋ค!
https://mntdev.tistory.com/69#%F0%9F%91%8D%20%EC%A0%95%EC%A0%81%20%ED%8C%A9%ED%84%B0%EB%A6%AC%EB%A5%BC%20%EC%A0%9C%EA%B3%B5%ED%95%98%EB%8A%94%20%EB%B6%88%EB%B3%80%20%ED%81%B4%EB%9E%98%EC%8A%A4-1
์ด ๊ธ์ ํ๋ฒ ์ฐธ๊ณ ํด๋ณด์๋ฉด ์ข์ ๊ฒ๊ฐ์์! ๐ |
@@ -0,0 +1,103 @@
+package christmas.util;
+
+import christmas.domain.type.Menu;
+
+import java.util.*;
+import java.util.regex.Pattern;
+import java.util.stream.Collectors;
+
+public class OrderValidator {
+ private static final String LINE_SEPARATOR = System.lineSeparator();
+
+ private static final int MIN_AMO... | Java | "," ๋ "-"๋ ์์๋ก ๊ด๋ฆฌํ๋ฉด ์ข์ ๊ฒ ๊ฐ์์! ์ด๋ฒคํธ์ ๋ฐ๋ผ ์
๋ ฅ๋ฐ๋ ๋ฐฉ์์ด ๋ฐ๋ ์๋ ์์์์ ๐ |
@@ -0,0 +1,76 @@
+package christmas.domain.logic;
+
+import christmas.domain.type.Badge;
+import christmas.domain.type.Menu;
+import org.junit.jupiter.api.Test;
+
+import java.util.Map;
+
+import static org.junit.jupiter.api.Assertions.*;
+
+public class EventCalculatorTest {
+
+ @Test
+ void isEligibleForEvent()... | Java | ํด๋ฆฐ์ฝ๋์ ๋์ค๋ ๋ด์ฉ์ธ๋ฐ ํ ํ
์คํธ ๋ฉ์๋ ์์ ์ฌ๋ฌ assert๋ฌธ์ ์ฌ์ฉํ๋ ๊ฒ์ ์ข์ง ์๋ค๊ณ ํด์! ํด๋น ๋ฉ์๋์์@ParameterizedTest ์ @MethodSource๋ฅผ ์ฌ์ฉํด๋ณด๋ฉด ์ด๋จ๊น์? |
@@ -0,0 +1,20 @@
+package christmas.domain.logic;
+
+import christmas.domain.model.DecemberEvent;
+
+public class ChristmasEventCalculator {
+ public static int calculateChristmasDiscount(int date) {
+ int startDay = DecemberEvent.getEventStartDate();
+ int discountPricePerDay = DecemberEvent.getDayDis... | Java | ์ ํธ๋ฆฌํฐ ํด๋์ค๋ก ๋ณด์ด๋๋ฐ ์์ฑ์๋ฅผ private๋ก ๋ง๋๋๊ฒ ์ข์๋ณด์ฌ์! ๐ |
@@ -0,0 +1,71 @@
+package christmas.domain.model;
+
+import christmas.domain.type.Menu;
+
+import java.util.*;
+
+public class DecemberEvent {
+ public static final int CHRISTMAS_DAY = 25;
+ private static final int EVENT_START_DATE = 1;
+ private static final int DAY_DISCOUNT_PRICE = 100;
+ private static ... | Java | ์์๋ฅผ ๊ด๋ฆฌํ๋ ํด๋์ค๋ฅผ ๋ค๋ฅธ ํจํค์ง๋ก ๊ตฌ๋ถํ๋ ๊ฑด ์ด๋จ๊น์? |
@@ -0,0 +1,103 @@
+package christmas.util;
+
+import christmas.domain.type.Menu;
+
+import java.util.*;
+import java.util.regex.Pattern;
+import java.util.stream.Collectors;
+
+public class OrderValidator {
+ private static final String LINE_SEPARATOR = System.lineSeparator();
+
+ private static final int MIN_AMO... | Java | getter๋ฅผ ์ฌ์ฉํ๋ ๋์ menu๊ฐ์ฒด๊ฐ ์ง์ ์นดํ
๊ณ ๋ฆฌ๋ฅผ ๋น๊ตํ๊ฒ ํด๋ณด๋๊ฑด ์ด๋จ๊น์? |
@@ -0,0 +1,61 @@
+package christmas.view;
+
+import camp.nextstep.edu.missionutils.Console;
+import christmas.domain.type.Menu;
+import christmas.util.DateValidator;
+import christmas.util.OrderValidator;
+import christmas.util.ValidationException;
+
+import java.util.HashMap;
+import java.util.Map;
+
+public class Inp... | Java | ๋ฐ๋ณต๋์ง๋ง ๋ฏธ์ธํ๊ฒ ๋ค๋ฅธ ์ฝ๋๋ค์! ์ด๋ป๊ฒ ๋ฐ๋ณต์ ์ค์ผ์ง ๊ณ ๋ฏผํด๋ณด์๋ฉด ์ข์ ๊ฒ ๊ฐ์์! ๐ |
@@ -0,0 +1,103 @@
+package christmas.util;
+
+import christmas.domain.type.Menu;
+
+import java.util.*;
+import java.util.regex.Pattern;
+import java.util.stream.Collectors;
+
+public class OrderValidator {
+ private static final String LINE_SEPARATOR = System.lineSeparator();
+
+ private static final int MIN_AMO... | Java | throw new ValidationException(INVALID_ORDER_MESSAGE + LINE_SEPARATOR + ******);
์ด๋ถ๋ถ์ด ๋ฐ๋ณต๋๋ค์! ์ ๋ ๋ฉ์๋๋ ์์๋ก ๋ฐ๋ณต์ ์ค์ผ ์ ์๋ค๊ณ ์๊ฐํ๋๋ฐ ์ด๋ค๊ฐ์? ๐ |
@@ -0,0 +1,28 @@
+package christmas.util;
+
+public class DateValidator {
+ private static final String INVALID_DATE_MESSAGE = "์ ํจํ์ง ์์ ๋ ์ง์
๋๋ค. ๋ค์ ์
๋ ฅํด ์ฃผ์ธ์.";
+
+ public static void validateInput(String input) {
+ validateNumeric(input);
+ int date = Integer.parseInt(input);
+ validateDate(date... | Java | ์ ๋ง๋ค์ ์ ๊ฐ ์ถ๊ตฌํ๋ ๋ฐฉํฅ์ด `12์ ์ด๋ฒคํธ` ํด๋์ค๋ง ๋งค๋ฌ ํด๋นํ๋ ๋ฌ์ ๊ฐ์ ๋ผ์ฐ๋ ๊ฑฐ์๊ฑฐ๋ ์ `๋ช์.LAST_DATE` ์ด๋ฐ์์ผ๋ก ๋ฐ๊ฟ์ผ ๊ฒ ์ต๋๋ค. |
@@ -0,0 +1,76 @@
+package christmas.domain.logic;
+
+import christmas.domain.type.Badge;
+import christmas.domain.type.Menu;
+import org.junit.jupiter.api.Test;
+
+import java.util.Map;
+
+import static org.junit.jupiter.api.Assertions.*;
+
+public class EventCalculatorTest {
+
+ @Test
+ void isEligibleForEvent()... | Java | ์ค... ์์ง ํ
์คํธ์ฝ๋๊ฐ ์ต์์น์์๋๋ฐ ํ์ฉํด ๋ณด๊ฒ ์ต๋๋ค. |
@@ -0,0 +1,20 @@
+package christmas.domain.logic;
+
+import christmas.domain.model.DecemberEvent;
+
+public class ChristmasEventCalculator {
+ public static int calculateChristmasDiscount(int date) {
+ int startDay = DecemberEvent.getEventStartDate();
+ int discountPricePerDay = DecemberEvent.getDayDis... | Java | ์ํ ๊ตณ์ด ๊ฐ์ฒด๊ฐ ์์ฑ๋ ํ์๊ฐ ์๊ตฐ์ |
@@ -0,0 +1,71 @@
+package christmas.domain.model;
+
+import christmas.domain.type.Menu;
+
+import java.util.*;
+
+public class DecemberEvent {
+ public static final int CHRISTMAS_DAY = 25;
+ private static final int EVENT_START_DATE = 1;
+ private static final int DAY_DISCOUNT_PRICE = 100;
+ private static ... | Java | 12์ ์ด๋ฒคํธ์๋ ํ ์ธ ๊ธ์ก์ด๋ ๊ธฐ๊ฐ๋ฑ์ด ์์ด์ ๋น์ฆ๋์ค ๋ก์ง๊ณผ ๋ฐ์ ํ๋ค๊ณ ์๊ฐํด์ ์ ๊ธฐ์ ์์นํ๊ธด ํ์ต๋๋ค. |
@@ -0,0 +1,103 @@
+package christmas.util;
+
+import christmas.domain.type.Menu;
+
+import java.util.*;
+import java.util.regex.Pattern;
+import java.util.stream.Collectors;
+
+public class OrderValidator {
+ private static final String LINE_SEPARATOR = System.lineSeparator();
+
+ private static final int MIN_AMO... | Java | ํด๋น ๊ท์น์ ๋ํ ์ฑ
์์ ๋ฉ๋ด๋ณด๋ค๋ ์ฃผ๋ฌธ๊ฒ์ฆ์ ์๋ค๊ณ ์๊ฐํด์ ์ ๋ ๊ฒ ๊ตฌํํ๊ธด ํ๋๋ฐ ๋ฉ๋ด๊ฐ ์ค์ค๋ก ํ๋จ ํ ์ ์๋๊ฒ์ ์ข๋ ๊ตฌ๋ถํด๋์ผ๋ฉด ๋ ์ข์์ง๊ฒ ๋ค์! |
@@ -0,0 +1,41 @@
+package christmas.domain.model;
+
+import christmas.domain.type.Menu;
+
+import java.util.Map;
+
+public class OrderInfo {
+ private final int date;
+ private final Map<Menu, Integer> order;
+ private final int totalOrderPrice;
+
+ public OrderInfo(int date, Map<Menu, Integer> order) {
+ ... | Java | calculateTotalOrderPrice๋ก ํญ์ ๊ฐ์ ๊ตฌํ ์ ์์ผ๋ totalOrderPrice๋ฅผ ๋ฉค๋ฒ๋ณ์๋ก ๊ฐ๋ ๊ฒ ๋ณด๋ค ์ธ๋ถ์์ ๋ฉ์๋๋ฅผ ํธ์ถํ๋ ๋ฐฉ์์ ์ด๋ ์ ๊ฐ์? |
@@ -0,0 +1,58 @@
+package christmas.domain.type;
+
+public enum Menu {
+ //์ํผํ์ด์
+ MUSHROOM_SOUP("์์ก์ด์ํ", 6_000, Category.APPETIZER),
+ TAPAS("ํํ์ค", 5_500, Category.APPETIZER),
+ CAESAR_SALAD("์์ ์๋ฌ๋", 8_000, Category.APPETIZER),
+
+ //๋ฉ์ธ
+ T_BONE_STEAK("ํฐ๋ณธ์คํ
์ดํฌ", 55_000, Category.MAIN),
+ BBQ_RIBS("... | Java | ์๋ฐ ์คํธ๋ฆผ api ๋ฅผ ์ฌ์ฉํ์๋ฉด ์ธ๋ดํธ๋ฅผ ์ค์ด๊ณ ๋ช
ํ์ฑ์ ๋์ด์ค ์ ์์ ๊ฒ ๊ฐ์ต๋๋ค! |
@@ -0,0 +1,58 @@
+package christmas.domain.type;
+
+public enum Menu {
+ //์ํผํ์ด์
+ MUSHROOM_SOUP("์์ก์ด์ํ", 6_000, Category.APPETIZER),
+ TAPAS("ํํ์ค", 5_500, Category.APPETIZER),
+ CAESAR_SALAD("์์ ์๋ฌ๋", 8_000, Category.APPETIZER),
+
+ //๋ฉ์ธ
+ T_BONE_STEAK("ํฐ๋ณธ์คํ
์ดํฌ", 55_000, Category.MAIN),
+ BBQ_RIBS("... | Java | InputView์์๋ ๋น์ทํ ์ฝ๋๋ก ๋ฉ๋ด ์ด๋ฆ์ ๊ฒ์ฆํ์๋๋ฐ null ์ ๋ฐํํ๋ ๋์ ์ฌ๊ธฐ์ ๋ฐ๋ก ์์ธ๋ฅผ ๋์ง์๋ ๊ฑด ์ด๋ ์ ๊ฐ์? |
@@ -0,0 +1,70 @@
+package christmas.domain.logic;
+
+import christmas.domain.model.DecemberEvent;
+import christmas.domain.type.Badge;
+import christmas.domain.type.Menu;
+
+import java.util.Collections;
+import java.util.Map;
+
+public class EventCalculator {
+ public static boolean isEligibleForEvent(int totalPric... | Java | ์ด ๋ฉ์๋์์ date๋ ์ฌ์ฉํ์ง ์๋๋ฐ ํ๋ผ๋ฏธํฐ๋ก ๋ฐ์ผ์๋ ์ด์ ๊ฐ ์์ผ์ค๊น์? |
@@ -0,0 +1,70 @@
+package christmas.domain.logic;
+
+import christmas.domain.model.DecemberEvent;
+import christmas.domain.type.Badge;
+import christmas.domain.type.Menu;
+
+import java.util.Collections;
+import java.util.Map;
+
+public class EventCalculator {
+ public static boolean isEligibleForEvent(int totalPric... | Java | Map<Menu, Integer> order ๋ก ์นดํ
์ฝ๋ฆฌ๋ณ ๋ฉ๋ด ๊ฐ์๋ฅผ ์
์ ์์ผ๋ ์ด๋ฅผ OrderInfo ๋ชจ๋ธ์ ์ญํ ๋ก ๋๊ธฐ์๋ ๊ฑด ์ด๋ ์ค๊น์? |
@@ -0,0 +1,61 @@
+package christmas.domain.model;
+
+import christmas.domain.type.Badge;
+import christmas.domain.type.Benefit;
+
+import java.util.Map;
+
+public class EventResult {
+ private final OrderInfo orderInfo;
+ private final Map<Benefit, Integer> benefitHistory;
+ private final int totalBenefitsPric... | Java | EventResult๋ dto๋ก ์ฌ์ฉํ์ ๊ฑธ๊น์? |
@@ -0,0 +1,103 @@
+package christmas.util;
+
+import christmas.domain.type.Menu;
+
+import java.util.*;
+import java.util.regex.Pattern;
+import java.util.stream.Collectors;
+
+public class OrderValidator {
+ private static final String LINE_SEPARATOR = System.lineSeparator();
+
+ private static final int MIN_AMO... | Java | More ๋ณด๋ค ๋ฉ์๋ ์๋๋ฅผ ๋ํ๋ด๋ ๋ฉ์๋๋ช
์ ์ฌ์ฉํ์๋ฉด ๋ ์ข์ ๊ฒ ๊ฐ์ต๋๋ค! |
@@ -0,0 +1,41 @@
+package christmas.domain.model;
+
+import christmas.domain.type.Menu;
+
+import java.util.Map;
+
+public class OrderInfo {
+ private final int date;
+ private final Map<Menu, Integer> order;
+ private final int totalOrderPrice;
+
+ public OrderInfo(int date, Map<Menu, Integer> order) {
+ ... | Java | ์์ ์ด ๊ฐ์ง ๊ฐ์ผ๋ก ํ๋ฒ ์ ํด์ง๊ณ ๋ณํ์ง ์๋ ๊ฐ์ด์ด์ ์ด๋ ๊ฒ ๊ตฌํํ์ต๋๋ค!
orderInfo์ ๊ฐ์ ๋ค๋ฅธ ๊ณณ์์ ํ์ฉ๋ฉ๋๋ค |
@@ -0,0 +1,58 @@
+package christmas.domain.type;
+
+public enum Menu {
+ //์ํผํ์ด์
+ MUSHROOM_SOUP("์์ก์ด์ํ", 6_000, Category.APPETIZER),
+ TAPAS("ํํ์ค", 5_500, Category.APPETIZER),
+ CAESAR_SALAD("์์ ์๋ฌ๋", 8_000, Category.APPETIZER),
+
+ //๋ฉ์ธ
+ T_BONE_STEAK("ํฐ๋ณธ์คํ
์ดํฌ", 55_000, Category.MAIN),
+ BBQ_RIBS("... | Java | ๋ค์ฌ๋ ์ฝ๋์์ ํ์ ๋ฐฐ์ ์ต๋๋ค! |
@@ -0,0 +1,58 @@
+package christmas.domain.type;
+
+public enum Menu {
+ //์ํผํ์ด์
+ MUSHROOM_SOUP("์์ก์ด์ํ", 6_000, Category.APPETIZER),
+ TAPAS("ํํ์ค", 5_500, Category.APPETIZER),
+ CAESAR_SALAD("์์ ์๋ฌ๋", 8_000, Category.APPETIZER),
+
+ //๋ฉ์ธ
+ T_BONE_STEAK("ํฐ๋ณธ์คํ
์ดํฌ", 55_000, Category.MAIN),
+ BBQ_RIBS("... | Java | ์ฑ
์์ ๋ถ๋ฆฌํ๋ ค๊ณ ๊ทธ๋ ๊ฒ ์์ฑํ์ต๋๋ค.
๋ฐ๋ก ๋ฉ๋ด์์ ์์ธ๋ฅผ ๋์ง๋ฉด ์ถ์ ํ๊ธฐ ์ฌ์ธ์ ์๊ฒ ๋ค์ |
@@ -0,0 +1,41 @@
+package christmas.domain.model;
+
+import christmas.domain.type.Menu;
+
+import java.util.Map;
+
+public class OrderInfo {
+ private final int date;
+ private final Map<Menu, Integer> order;
+ private final int totalOrderPrice;
+
+ public OrderInfo(int date, Map<Menu, Integer> order) {
+ ... | Java | date์ ๋ํ validation์ InputView์์ ์งํํ์
จ๊ตฐ์!
์ ๋ ์ด ๋ถ๋ถ์ ๋ํด์ ์ด๋ค ๊ฒ์ด ๋ ํจ์จ์ ์ผ๊น ๊ณ ๋ฏผ์ ๋ง์ด ํด๋ดค๋๋ฐ @T3rryAhn ๋์ ์๊ฐ์ ์ด๋ค ์ง ์ฌ์ญ๊ณ ์ถ์ต๋๋ค.
์ ๋ ์ฒ์์๋ ์
๋ ฅ๊ฐ์ ๋ํ validation์ InputView์์ ์ฒ๋ฆฌํ๋ ๊ฒ์ด ์ข์์ง domain์์ ์ฒ๋ฆฌํ๋ ๊ฒ์ด ์ข์ ์ง ๊ณ ๋ฏผ์ ๋ง์ด ํ์๋๋ฐ์. ํ๋ก๊ทธ๋จ์ด ๋ณต์กํด์ง ์๋ก InputView๊ฐ ๊ฒ์ฆํด์ผํ validation์ ์ข
๋ฅ๊ฐ ๋ง์์ง์ผ๋ก ์ ๋ validation์ domain์ผ๋ก ์ฑ
์์ ๋๊ธฐ๋ ๊ฒ์ด ๋ ์ข๋ค๊ณ ํ๋จํ์ต๋๋ค.
์๋ฅผ ๋ค์ด ์ ๋ In... |
@@ -0,0 +1,41 @@
+package christmas.domain.model;
+
+import christmas.domain.type.Menu;
+
+import java.util.Map;
+
+public class OrderInfo {
+ private final int date;
+ private final Map<Menu, Integer> order;
+ private final int totalOrderPrice;
+
+ public OrderInfo(int date, Map<Menu, Integer> order) {
+ ... | Java | Map<Menu, Integer>์ ๊ฒฝ์ฐ ์ปฌ๋ ์
์ ํด๋นํฉ๋๋ค.
์ด ๊ฒฝ์ฐ ์ผ๊ธ ์ปฌ๋ ์
์ ์ฌ์ฉํด์ ๊ด๋ฆฌํ๋ ๊ฑด ์ด๋จ๊น์?
์ฐธ๊ณ : https://tecoble.techcourse.co.kr/post/2020-05-08-First-Class-Collection/ |
@@ -0,0 +1,41 @@
+package christmas.domain.model;
+
+import christmas.domain.type.Menu;
+
+import java.util.Map;
+
+public class OrderInfo {
+ private final int date;
+ private final Map<Menu, Integer> order;
+ private final int totalOrderPrice;
+
+ public OrderInfo(int date, Map<Menu, Integer> order) {
+ ... | Java | 3์ฃผ์ฐจ ๊ณตํต ํผ๋๋ฐฑ์์ '**๊ฐ์ฒด๋ ๊ฐ์ฒด๋ต๊ฒ **'๋ผ๋ ๊ฒ์ด ์์์ต๋๋ค.
์ด ๊ฒฝ์ฐ `private final Map<Menu, Integer> order;`์ผ๋ก ์ ์ธํ order์ ๋ฐํํ๋๋ฐ์.
Map<Menu, Integer>์ ์ปฌ๋ ์
์ค์ ํ๋์
๋๋ค.
๋ฐ๋ผ์ final ํค์๋๋ฅผ ์ฌ์ฉํ๋ค๊ณ ํด๋ ๊ฐ์ ๋ณ๊ฒฝ์ด ๋ฐ์ํ ์ ์์ต๋๋ค ใ
ใ
กใ
.
๋ฐ๋ผ์ ์ปฌ๋ ์
๋ณ์๋ ์ต๋ํ getter ์ฌ์ฉ์ ์ง์ํ๊ณ ๊ฐ์ฒด์ ๋ฉ์์ง๋ฅผ ๋์ง๋ ๋ฐฉ์์ผ๋ก ์ฒ๋ฆฌํ๋ฉด ์ข์๋ฐ์.
์์ comment์ ์ฐ๊ดํ์ฌ '์ผ๊ธ์ปฌ๋ ์
' ๊ฐ๋
์ด ๋ง์ด ๋์ ๋์ค ๊ฒ ๊ฐ์ต๋๋ค!
์ฐธ๊ณ : https:... |
@@ -0,0 +1,112 @@
+package christmas.view;
+
+import christmas.domain.model.DecemberEvent;
+import christmas.domain.model.EventResult;
+import christmas.domain.type.Badge;
+import christmas.domain.type.Benefit;
+import christmas.domain.type.Menu;
+import christmas.util.MapToStringConverter;
+
+import java.util.Map;
+
+... | Java | OutputView์์ ์ฌ์ฉ๋๋ ์์๊ฐ ๊ฒฝ์ฐ, enum์ผ๋ก ๋ฌถ์ด์ ๊ด๋ฆฌํ๋ฉด ์ฝ๋๊ฐ ํจ์ฌ ๊น๋ํ ๊ฒ ๊ฐ์ต๋๋ค! |
@@ -0,0 +1,173 @@
+์์ฑ์: ์ํ๋ฆฌ
+
+# ๐
ํฌ๋ฆฌ์ค๋ง์ค ํ๋ก๋ชจ์
+
+**์ด๋ฒคํธ ๋ชฉํ**
+````
+1. ์ค๋ณต๋ ํ ์ธ๊ณผ ์ฆ์ ์ ํ์ฉํด์, ๊ณ ๊ฐ๋ค์ด ํํ์ ๋ง์ด ๋ฐ๋๋ค๋ ๊ฒ์ ์ฒด๊ฐํ ์ ์๊ฒ ํ๋ ๊ฒ
+2. ์ฌํด 12์์ ์ง๋ 5๋
์ค ์ต๊ณ ์ ํ๋งค ๊ธ์ก์ ๋ฌ์ฑ
+3. 12์ ์ด๋ฒคํธ ์ฐธ์ฌ ๊ณ ๊ฐ์ 5%๊ฐ ๋ด๋
1์ ์ํด ์ด๋ฒคํธ์ ์ฌ์ฐธ์ฌํ๋ ๊ฒ
+````
+
+---------------
+## โ ๊ธฐ๋ฅ ๋ชฉ๋ก
+
+### ์ฌ์ฉ์ ์ธํฐํ์ด์ค
+ - ์ฌ์ฉ์์๊ฒ ์
๋ ฅ์ ์์ฒญํ๋ ์๋ด ๋ฉ์์ง ์ถ๋ ฅ
+ - ์ฌ์ฉ์ ์
๋ ฅ ์๋ฌ ๋ฐ์ ์, '[ERROR]'๋ก ์... | Unknown | README ๊น๋ํด์ ์ ๋ฆฌ๊ฐ ์ ๋ ๊ฒ ๊ฐ์ต๋๋ค :) |
@@ -0,0 +1,116 @@
+package christmas.domain.logic;
+
+import christmas.domain.model.DecemberEvent;
+import christmas.domain.model.OrderInfo;
+import christmas.domain.model.EventResult;
+import christmas.domain.type.Badge;
+import christmas.domain.type.Benefit;
+import christmas.domain.type.Menu;
+
+import java.util.Has... | Java | EventService๋ผ๋ ๊ฐ์ฒด์ ์กด์ฌ ์ด์ ๊ฐ ์ ์๋ฟ์ง ์๋ ๊ฒ ๊ฐ์ต๋๋ค. ์๋น์ค ๊ฐ์ฒด์ธ์ง, ์ ํธ์ฉ ๊ฐ์ฒด์ธ์ง, ํน์ ๋๋ฉ์ธ ๊ฐ์ฒด์ธ์ง ์ ๋ชจ๋ฅด๊ฒ ์ต๋๋ค. ์๋น์ค ๊ฐ์ฒด๋ผ๋ฉด logic์ด๋ผ๋ ํจํค์ง๋ช
์ด ๋ชจํธํ๋ค๊ณ ์๊ฐํ๊ณ , service ํจํค์ง๋ฅผ ๋ง๋ค์ด ๊ทธ ํ์ ์์ด์ผ ํ ๊ฒ ๊ฐ์ต๋๋ค. |
@@ -0,0 +1,82 @@
+package christmas.controller;
+
+import static christmas.domain.event.EventConstants.*;
+
+import christmas.domain.restaurant.Orders;
+import christmas.domain.restaurant.VisitDate;
+import christmas.service.RestaurantCalculator;
+import christmas.view.inputview.InputValueType;
+import christmas.view.i... | Java | ๊ฐ์ธ์ ์ธ ์๊ฐ์ผ๋ก, ์ปจํธ๋กค๋ฌ๊ฐ ๋ค๋ฅธ ์ปจํธ๋กค๋ฌ๋ฅผ ์ธ์คํด์ค ๋ณ์๋ก ๊ฐ์ง๊ณ ํธ์ถํ๋ ๊ฒ์ด ๋ง๋์ง ์ ๋ชจ๋ฅด๊ฒ ์ต๋๋ค.
๋ง์ฝ ๊ณตํต๋ ๋ถ๋ถ์ด ์์ด์๋ผ๋ฉด, ์๋น์ค๋ฅผ ๋ฐ๋ก ๋๊ฑฐ๋ ์ปจํธ๋กค๋ฌ๋ฅผ ํ๋๋ก ํฉ์น๋๊ฑธ ์ถ์ฒ๋๋ฆฝ๋๋ค! |
@@ -0,0 +1,78 @@
+package christmas.domain.restaurant;
+
+import christmas.domain.food.Dessert;
+import christmas.domain.food.Food;
+import christmas.domain.food.MainFood;
+import christmas.util.parser.Parser;
+import christmas.util.validator.OrderValidator;
+import java.util.Collections;
+import java.util.HashMap;
+im... | Java | Map ์๋ฃ๊ตฌ์กฐ๋ ์ฐ๋ค๋ณด๋ฉด ์๊ทผ ์์ด ๋ง์ด ๊ฐ๊ฒ๋๋ ์๋ฃ๊ตฌ์กฐ๋ผ๋ ์๊ฐ์ด ๋ค๋๋ผ๊ตฌ์.
๋ฌผ๋ก ์๋ฃ๊ตฌ์กฐ๋ง๋ค ์ฅ์ ๊ณผ ๋จ์ ์ด ์์ง๋ง
๊ฐ์ธ์ ์ผ๋ก ์ฌ๊ธฐ์๋ Map๋ณด๋ค๋ ๋ฉ๋ด์ ๊ฐ์๋ฅผ ๊ฐ์ง ๋ณ๋์ Order ๊ฐ์ฒด๋ฅผ ๋๋ ๊ฒ์ด ์ข์๋ณด์
๋๋ค! |
@@ -0,0 +1,82 @@
+package christmas.controller;
+
+import static christmas.domain.event.EventConstants.*;
+
+import christmas.domain.restaurant.Orders;
+import christmas.domain.restaurant.VisitDate;
+import christmas.service.RestaurantCalculator;
+import christmas.view.inputview.InputValueType;
+import christmas.view.i... | Java | ํด๋น ๋ถ๋ถ์ ์ด๋ฒคํธ ๋๋ฉ์ธ ๊ด๋ จ ํด๋์ค์ ์์นํ๋ ๊ฒ์ด ์ข์๋ณด์
๋๋ค.
์ด๋ฒคํธ๋ฅผ ์ ์ฉํ ์ ์๋์ง ์๋์ง์ ๋ํด์๋ ๋น์ฆ๋์ค ๋ก์ง์ ํด๋น๋๋ค๊ณ ์๊ฐํด์! |
@@ -0,0 +1,82 @@
+package christmas.controller;
+
+import static christmas.domain.event.EventConstants.*;
+
+import christmas.domain.restaurant.Orders;
+import christmas.domain.restaurant.VisitDate;
+import christmas.service.RestaurantCalculator;
+import christmas.view.inputview.InputValueType;
+import christmas.view.i... | Java | ๋ง์ฐฌ๊ฐ์ง์ ์ด์ ๋ก, view์์๋ ๋๋ฉ์ธ ๋ชจ๋ธ ์์ฒด๊ฐ ์๋ ๋๋ฉ์ธ ๋ชจ๋ธ์ ๋ฐ์ดํฐ๋ง ์ ๋ฌํ๋ ๊ฒ์ด ์ข๋ค๊ณ ์๊ฐํฉ๋๋ค |
@@ -0,0 +1,82 @@
+package christmas.controller;
+
+import static christmas.domain.event.EventConstants.*;
+
+import christmas.domain.restaurant.Orders;
+import christmas.domain.restaurant.VisitDate;
+import christmas.service.RestaurantCalculator;
+import christmas.view.inputview.InputValueType;
+import christmas.view.i... | Java | ์ด ๋ถ๋ถ์ ๊ตฌ์กฐ ๊ฐ์ ์ด ํ์ํ๊ฒ ๋ค์. ๋ง์ํด์ฃผ์ ๋๋ก ์ปจํธ๋กค๋ฌ ๋ด๋ถ์ ์ปจํธ๋กค๋ฌ๋ฅผ ๋ ํ์๋ ์์๋ค๊ณ ์๊ฐํฉ๋๋ค. EventPlanerController๋ Service์ ๋๋ ๊ฒ ๋ง์๊ฒ ๋ค์.
๋๋ถ์ ์ด๋ ดํํ๊ฒ ์์๋ ์๋น์ค์ ์ปจํธ๋กค๋ฌ์ ์ญํ ์ ๋ํด ๋ค์ ํ ๋ฒ ์๊ฐํด๋ณผ ์ ์๋ ๊ธฐํ๊ฐ ๋ ๊ฒ ๊ฐ์ต๋๋ค. ์ข์ ํผ๋๋ฐฑ ๊ฐ์ฌํฉ๋๋ค! |
@@ -0,0 +1,82 @@
+package christmas.controller;
+
+import static christmas.domain.event.EventConstants.*;
+
+import christmas.domain.restaurant.Orders;
+import christmas.domain.restaurant.VisitDate;
+import christmas.service.RestaurantCalculator;
+import christmas.view.inputview.InputValueType;
+import christmas.view.i... | Java | ์ ๊ฐ ํด๋น ๋ถ๋ถ์ ๊ธฐ๋ฅ ๊ตฌํ์ ๊น๋จน๊ณ ์๋ค๊ฐ ๋ง์ง๋ง์ ํ๊ฒ ๋์๋๋ฐ, ์ด๋ฌํ ๋ฌธ์ ๊ฐ ๋ฐ์ํ๋ค์.
๊ธฐ๋ณธ MVC ํจํด์ ์ปจํธ๋กค๋ฌ ์ญํ ์ ์๊ฐํด๋ณด๋ฉด ์ด๋ฒคํธ ๋๋ฉ์ธ์ด๋ ์๋น์ค์์ ํด๋น ๋ก์ง์ ์ฒ๋ฆฌํ๋ ๊ฒ์ด ์ข์๋ณด์
๋๋ค. ๊ฐ์ฌํฉ๋๋ค! |
@@ -8,71 +8,72 @@
import bridge.view.OutputView;
public class BridgeGameController {
- private final OutputView outputView = new OutputView();
- private final InputView inputView = new InputView();
+ private final OutputView outputView;
+ private final InputView inputView;
private BridgeGame bridge... | Java | ๋ฉ์๋์ ์ญํ ์ด ์กฐ๊ธ ๋ง์ ๊ฒ ๊ฐ์ต๋๋ค!
์์ง์ ์
๋ ฅ์ ๋ฐ๋ ๋ฉ์๋์์ `bridgeGame.move()` ๊ฐ ์กด์ฌํ๋ ๊ฒ์ ์กฐ๊ธ ์ด์ํฉ๋๋ค! |
@@ -8,71 +8,72 @@
import bridge.view.OutputView;
public class BridgeGameController {
- private final OutputView outputView = new OutputView();
- private final InputView inputView = new InputView();
+ private final OutputView outputView;
+ private final InputView inputView;
private BridgeGame bridge... | Java | ๊ฐ์ธ์ ์ผ๋ก ์ด ๋ถ๋ถ์ ํ๋ฆ ์ฒ๋ฆฌ๊ฐ ์กฐ๊ธ ์์ฝ๋ค๊ณ ์๊ฐํฉ๋๋ค.
์ฐ์ ์๋์ `inputMoving()` ๋ฉ์๋์ ์ญํ ์ด ์กฐ๊ธ ๋ง๊ณ ,
`playOneRount()`๋ฅผ ๋ฐ๋ณตํ๋ ๋ก์ง๋ while ๋ฌธ์ ์ฌ์ฉํ๋ฉด ์ข ๋ ์ง๊ด์ ์ผ๋ก ๋ณด์ด์ง ์์๊น ์๊ฐ๋ฉ๋๋ค!
ํ๋ฒ์ฏค ๊ณ ๋ฏผํด๋ณด์๋ฉด ์ข์ ๊ฒ ๊ฐ์์! |
@@ -8,71 +8,72 @@
import bridge.view.OutputView;
public class BridgeGameController {
- private final OutputView outputView = new OutputView();
- private final InputView inputView = new InputView();
+ private final OutputView outputView;
+ private final InputView inputView;
private BridgeGame bridge... | Java | > ๊ฐ์ธ์ ์ผ๋ก ์ด ๋ถ๋ถ์ ํ๋ฆ ์ฒ๋ฆฌ๊ฐ ์กฐ๊ธ ์์ฝ๋ค๊ณ ์๊ฐํฉ๋๋ค. ์ฐ์ ์๋์ `inputMoving()` ๋ฉ์๋์ ์ญํ ์ด ์กฐ๊ธ ๋ง๊ณ , `playOneRount()`๋ฅผ ๋ฐ๋ณตํ๋ ๋ก์ง๋ while ๋ฌธ์ ์ฌ์ฉํ๋ฉด ์ข ๋ ์ง๊ด์ ์ผ๋ก ๋ณด์ด์ง ์์๊น ์๊ฐ๋ฉ๋๋ค! ํ๋ฒ์ฏค ๊ณ ๋ฏผํด๋ณด์๋ฉด ์ข์ ๊ฒ ๊ฐ์์!
๊ธฐ์กด์ ์ฌ๊ท๋ก ๊ตฌ์ฑํ๋ ์ฝ๋๋ฅผ while๋ก ๋ฐ๊ฟ ์๊ฐ์ ๋ชปํ๋ค์.. ๊ตณ์ด ์กฐ๊ฑด๊ฑธ์ด์ ์ฌ๊ท๋ฅผ ํ๊ธฐ๋ณด๋ค ์๊ฒฌ์ฃผ์ while์ ์ฌ์ฉํ๋๊ฒ ํ์คํ ๋ ์ข์๋ณด์ด๊ธด ํฉ๋๋ค ! ๊ฐ์ฌํฉ๋๋ค |
@@ -8,71 +8,72 @@
import bridge.view.OutputView;
public class BridgeGameController {
- private final OutputView outputView = new OutputView();
- private final InputView inputView = new InputView();
+ private final OutputView outputView;
+ private final InputView inputView;
private BridgeGame bridge... | Java | > ๋ฉ์๋์ ์ญํ ์ด ์กฐ๊ธ ๋ง์ ๊ฒ ๊ฐ์ต๋๋ค! ์์ง์ ์
๋ ฅ์ ๋ฐ๋ ๋ฉ์๋์์ `bridgeGame.move()` ๊ฐ ์กด์ฌํ๋ ๊ฒ์ ์กฐ๊ธ ์ด์ํฉ๋๋ค!
์.. ๊ทธ๋ด๊น์ ? ๋ฉ์๋ ๋ช
์ด ์ด์ํ๊ฑธ๊น์ ๋ฉ์๋ ์ญํ ์ด ๋ฌธ์ ์ผ๊น์ ?
์ ๋ ์ปจํธ๋กค๋ฌ๋ผ๊ณ ์๊ฐํด์ '์
๋ ฅ์ ํตํด์ ์คํํ๋ค' ๊ฐ ํ๋์ ์ญํ ์ ํ๋ค๊ณ ์๊ฐํ๋๋ฐ ๊ทธ๊ฒ ์๋์์๊น์.. ์ ๋ง ์ด๋ ต๊ธดํ๋ค์ |
@@ -8,71 +8,72 @@
import bridge.view.OutputView;
public class BridgeGameController {
- private final OutputView outputView = new OutputView();
- private final InputView inputView = new InputView();
+ private final OutputView outputView;
+ private final InputView inputView;
private BridgeGame bridge... | Java | ๊ทธ๋ ๊ฒ ํ๋๋ก ๋ณผ ์๋ ์๋ค๊ณ ์๊ฐํฉ๋๋ค!
๋ค๋ง ์ ๊ฐ ์๊ฐํ์ ๋๋ ์
๋ ฅ ๋ฐ๊ธฐ -> ์์ง์ธ๋ค ๊น์ง๊ฐ ํ๋์ round ๋ก ๋ฌถ์ด๊ณ ,
isSuccess(๋์ ๋๋ฌํจ) ๋ ๋จ์ด์ง ์ํ๊ฐ ๋์์ ๋ ๋ค์ ํ๋ฆ์ ์ ์ดํ๋ ๋ก์ง์ด ํ๋์ ๋ ํฐ ๋ฉ์๋๋ก
round๋ฅผ ๋ฐ๋ณต์ํค๋ ๊ฒ์ด ์ข๋ค๊ณ ์๊ฐํ์ต๋๋ค!
์ ๋ต์ ์์ผ๋ ํ๋ฒ ๊ณ ๋ฏผํด๋ณด์๊ณ ๋ ์ ์ ํ๋ค๊ณ ๋๋ผ๋ ๊ตฌ์กฐ๋ฅผ ์ก์๊ฐ๋ ๊ฒ์ด ์ค์ํ๋ค๊ณ ์๊ฐํฉ๋๋ค! |
@@ -0,0 +1,47 @@
+package bridge.view;
+
+import java.util.List;
+import java.util.StringJoiner;
+
+public class StringUtil {
+
+ public static String createBridge(List<String> userBridge, List<String> gameBridge) {
+ StringJoiner bridge = new StringJoiner("\n");
+
+ StringJoiner upBridge = new StringJ... | Java | ๋ฌธ์์ด๋ค์ StringUtil ์ ๊ตฌํํด์ OutputView์ ์ฑ
์์ ๋์ด์ค ๊ฑด ์ข๋ค๊ณ ์๊ฐํฉ๋๋ค!
๋ค๋ง ํ๋ผ๋ฏธํฐ๊ฐ ๋ค์ ๋ง๊ณ , ๋ชจ๋ ๊ฒฐ๊ณผ์ ๋ํ ๊ฒฐ๊ณผ ๋น๊ต๋ฅผ StringUtil์์ ๋ค ํ๊ณ ์๋ ๋ถ๋ถ์ ์กฐ๊ธ ์์ฌ์ด ๊ฒ ๊ฐ์ต๋๋ค
์๋น์ค ๊ณ์ธต์์ ์ด๋์ ๋ ๊ณ์ฐํ ๊ฒฐ๊ณผ๋ฅผ ๊ฐ๊ณตํด์ ๋ฐํํ ์ ์๋๋ก ๊ตฌํํ๋ฉด ์ด๋จ๊น ์ถ์ต๋๋ค |
@@ -0,0 +1,47 @@
+package bridge.view;
+
+import java.util.List;
+import java.util.StringJoiner;
+
+public class StringUtil {
+
+ public static String createBridge(List<String> userBridge, List<String> gameBridge) {
+ StringJoiner bridge = new StringJoiner("\n");
+
+ StringJoiner upBridge = new StringJ... | Java | ๋ง๋๋ง์ธ๊ฑฐ๊ฐ์ต๋๋ค.. ์ธ์๊ฐ 4๊ฐ๋ ๋๋ค๋ณด๋ ์ ๋ง ๋ง์ ์๋๋ ๋ฉ์๋์๋๋ฐ์ ์ฌ๊ธธ ๋ฆฌํฉํ ๋ง ํ๋ ค๊ณ ํ๋ map์ ์ฌ์ฉํ๊ฑฐ๋ ํด์ผํ๋๋ฐ ๊ณ์ ๋ฆฌํฉํ ๋ง ๋์ ํด๋ดค๋๋ฐ ๊ธฐ์กด ๊ตฌ์กฐ๋ฅผ ๊นจ๊ณ ๋ง๋ค์ด์ผ๋๋ ๋ถ๋ถ์ด ์กด์ฌํด์ ๊ธฐ์กด๊ตฌ์กฐ ์ ์งํ๊ณ ๊ฐ๋๋ผ ์์ฌ์ด ๋ถ๋ถ์ด ๋์จ๊ฒ ๊ฐ์ต๋๋คใ
ใ
|
@@ -0,0 +1,74 @@
+package christmas.controller;
+
+import christmas.domain.*;
+import christmas.message.ErrorMessage;
+import christmas.view.InputView;
+import christmas.view.OutputView;
+
+public class ChristmasPromotionController {
+ private EventCalendar eventCalendar;
+ private VisitDate visitDate;
+ priva... | Java | `InputView` ์์ `CommonValidator` ๋ฅผ ํตํด์ ๊ฒ์ฆ์ ํ๋๊ฒ์ผ๋ก ๋ณด์
๋๋ค. ๊ทธ๋ ๋ค๋ฉด `InputValidator` ์์ ์ถ๊ฐ์ ์ธ ๊ฒ์ฆ๋ ํจ๊ป ์งํํด์ ์์ธ๋ฅผ ์ฒ๋ฆฌํ๋ ์์ผ๋ก ๊ตฌํํ๋ ๋ฐฉ๋ฒ์ ์ด๋ป๊ฒ ์๊ฐํ์๋์?
์ ๋ ์
๋ ฅ์ ๋ด๋นํ๋ ํด๋์ค์์ ์
๋ ฅ์ ๋ฐ๊ณ ๊ฒ์ฆ ํด๋์ค๋ฅผ ํตํด ๊ฒ์ฆํ ์์ธ๊น์ง ๋์ง๋๋ก ๊ตฌํํ๋๋ ๊น๋ํ๊ฒ ๊ตฌํํ๋๊ฑฐ ๊ฐ์์ ์ฌ์ญค๋ด
๋๋ค! |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.