code stringlengths 41 34.3k | lang stringclasses 8
values | review stringlengths 1 4.74k |
|---|---|---|
@@ -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 | ๋๋ค ์ฌ์ฉ์ด ์ ๋ฐํค๋ค์ ใ
.ใ
์ฐธ๊ณ ๊ฐ ๋์ต๋๋ค. |
@@ -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๋ก๋ง ์ปค๋ฒ๊ฐ ๊ฐ๋ฅํ๋ค์ |
@@ -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,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 ํจํด์ ์ปจํธ๋กค๋ฌ ์ญํ ์ ์๊ฐํด๋ณด๋ฉด ์ด๋ฒคํธ ๋๋ฉ์ธ์ด๋ ์๋น์ค์์ ํด๋น ๋ก์ง์ ์ฒ๋ฆฌํ๋ ๊ฒ์ด ์ข์๋ณด์
๋๋ค. ๊ฐ์ฌํฉ๋๋ค! |
@@ -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` ์์ ์ถ๊ฐ์ ์ธ ๊ฒ์ฆ๋ ํจ๊ป ์งํํด์ ์์ธ๋ฅผ ์ฒ๋ฆฌํ๋ ์์ผ๋ก ๊ตฌํํ๋ ๋ฐฉ๋ฒ์ ์ด๋ป๊ฒ ์๊ฐํ์๋์?
์ ๋ ์
๋ ฅ์ ๋ด๋นํ๋ ํด๋์ค์์ ์
๋ ฅ์ ๋ฐ๊ณ ๊ฒ์ฆ ํด๋์ค๋ฅผ ํตํด ๊ฒ์ฆํ ์์ธ๊น์ง ๋์ง๋๋ก ๊ตฌํํ๋๋ ๊น๋ํ๊ฒ ๊ตฌํํ๋๊ฑฐ ๊ฐ์์ ์ฌ์ญค๋ด
๋๋ค! |
@@ -0,0 +1,152 @@
+package christmas.domain;
+
+import christmas.domain.constants.Badge;
+import christmas.domain.constants.Gift;
+import christmas.domain.constants.event.EventDiscount;
+import christmas.domain.constants.event.EventValue;
+import christmas.domain.constants.menu.MenuGroup;
+
+import java.util.Arrays;
+i... | Java | `Enum` ์ `Map` ์ผ๋ก ์ฌ์ฉํ ๋๋ `EnumMap` ์ด ๋ฉ๋ชจ๋ฆฌ ํจ์จ์ฑ๊ณผ ์ฑ๋ฅ๋ฉด์์ ๋ ์ฐ์ํด์ `EnumMap` ์ผ๋ก ์ฌ์ฉํ๋๊ฒ๋ ๊ณ ๋ คํด๋ณด์๋ฉด ์ข์ ๊ฒ ๊ฐ์ต๋๋ค! |
@@ -0,0 +1,152 @@
+package christmas.domain;
+
+import christmas.domain.constants.Badge;
+import christmas.domain.constants.Gift;
+import christmas.domain.constants.event.EventDiscount;
+import christmas.domain.constants.event.EventValue;
+import christmas.domain.constants.menu.MenuGroup;
+
+import java.util.Arrays;
+i... | Java | ๊ฐ์ธ์ ์ผ๋ก `Event` ํด๋์ค๊ฐ ๋๋ฌด ๋ง์ ์ฑ
์์ ๊ฐ์ง๊ณ ์๋ค๊ณ ์๊ฐํฉ๋๋ค.
ํ์ฌ `Event` ํด๋์ค๋
1. ๋ฐฉ๋ฌธํ๋ ๋ ์ง์ ๋งค๋ด๋ฅผ ๊ฐ์ง๊ณ ์กด์ฌํ๋ 4๊ฐ์ ์ด๋ฒคํธ๋ค์ ํด๋นํ๋์ง ์ฌ๋ถ ํ๋ณ
2. ๊ฐ์ข
ํ ์ธ๊ธ์ก ๊ณ์ฐ
3. ์ฌ์ฉ์์ ๋ฐฉ๋ฌธ์ ๋ฐ๋ฅธ ์ด๋ฒคํธ ๊ฒฐ๊ณผ๊ฐ์ฒด ์์ฑ
4. ์ฆ์ ํ ์ ๋ณด ์ถ๊ฐ
5. ํ ์ธ ๊ธ์ก์ ๋ฐ๋ฅธ ๋ฐฐ์ง ์ ๋ณด ์ถ๊ฐ
์ ๊ธฐ๋ฅ๋ค์ ํ๊ณ ์๋๊ฒ์ผ๋ก ๋ณด์
๋๋ค. ๋ฌผ๋ก ํ๋์ ํด๋์ค์ ๋ง์ ๊ธฐ๋ฅ์ ๋ฃ์ผ๋ฉด ๋ด์ผํ ํด๋์ค๋ค์ด ์๋์ ์ผ๋ก ์ ์ด์ง๊ธฐ ๋๋ฌธ์ ํธํ ์๋ ์์ง๋ง ์ถํ Event ์ ์๊ตฌ์ฌํญ์ด ๋ฐ๋๊ฑฐ๋ ํ ๊ฒฝ์ฐ ์๋ด์ผํ ๋ถ๋ถ์ด ๋ง์์ง๊ฒ ... |
@@ -0,0 +1,43 @@
+package christmas.domain;
+
+import christmas.domain.constants.event.EventValue;
+
+import java.time.DayOfWeek;
+import java.time.LocalDate;
+
+public class EventCalendar {
+ private final LocalDate currentDate;
+
+ public EventCalendar(int year, int month) {
+ this.currentDate = LocalDat... | Java | ์ด๋ฒคํธ์ ๋ง๋ ๋ ์ง๋ฅผ ์ธํ
ํ๋ ๋ฐฉ๋ฒ์ ์ ๋ง ์ข์ ๋ฐฉ๋ฒ ๊ฐ์ต๋๋ค ๐ ์ด ๋ฐฉ๋ฒ์ด ํจ์ฌ ๊น๋ํ๊ณ ์ฌ์ฉํ๊ธฐ๋ ํธํ๋ฐฉ๋ฒ ๊ฐ์์. |
@@ -0,0 +1,115 @@
+package christmas.domain;
+
+import christmas.domain.constants.event.EventValue;
+import christmas.domain.constants.menu.MenuGroup;
+import christmas.domain.constants.menu.MenuInterface;
+import christmas.message.ErrorMessage;
+import christmas.util.NumericConverter;
+import christmas.view.constants.... | Java | `menus` ๋ผ๋ ๊ฐ์ฒด๋ ํ์ฌ ์ฃผ๋ฌธํ ๋งค๋ด๋ค์ ๋ด์ ๊ฐ์ฒด๋ก ๋ณด์
๋๋ค. ๋งค๋ด๋ผ๋ ์ด๋ฆ์ ๊ฐ์ฒด ์์ ํ์ฌ ์ฃผ๋ฌธํ ๋งค๋ด๋ค์ด ์๋ ๊ตฌ์กฐ๊ฐ ์กฐ๊ธ ์ด์ํ๋ค๋ ์๊ฐ์ด ๋ญ๋๋ค.
๋งค๋ด๋ค์ ์ถ์ํํ `MenuInterface` ๊ฐ ์์ด์ ์ง๊ธ ๋ฐฉ์์ผ๋ก ๊ตฌํํ์ ๊ฒ ์๋๊น ํ๋ ์๊ฐ์ด ๋๋๋ฐ ์ด ์ธํฐํ์ด์ค์ ๊ตฌํ์ฒด์ธ `~Menu` ๋ ์กด์ฌํ๋ ๋งํผ ํด๋์ค๋ฅผ ์ข๋ ์ง๊ด์ ์ธ ๋ค๋ฅธ ์ด๋ฆ์ผ๋ก ๋ฐ๊พธ๋๊ฑด ์ด๋จ๊น์? ์๋ฅผ๋ค๋ฉด `Order` ๊ฐ์ ์ด๋ฆ๋ ์ข์๊ฒ ๊ฐ์ต๋๋ค! |
@@ -0,0 +1,115 @@
+package christmas.domain;
+
+import christmas.domain.constants.event.EventValue;
+import christmas.domain.constants.menu.MenuGroup;
+import christmas.domain.constants.menu.MenuInterface;
+import christmas.message.ErrorMessage;
+import christmas.util.NumericConverter;
+import christmas.view.constants.... | Java | `Menu` ์
๋ ฅ์ ๋ํ ๊ฒ์ฆ๋ถ๋ถ์ด ์ฌ๊ธฐ์ ์กด์ฌํ๊ตฐ์! ์ ๋ 4์ฃผ์ฐจ์ ๊ณผ์ ๋ด๋ด ์
๋ ฅ๊ฐ์ ๋ํ ๊ฒ์ฆ ๋ก์ง์ ํญ์ ๋ถ๋ฆฌํด์ ๊ตฌํํ๋๊ฒ ์ณ๋ค๊ณ ์๊ฐํด์ ๊ทธ๋ ๊ฒ ๊ตฌํํ๋๋ฐ ์ด ๋ถ๋ถ์ ๋ํด์ ์์๋์ ์๊ฐ์ ์ด๋ค์ง ๊ถ๊ธํฉ๋๋ค! |
@@ -0,0 +1,115 @@
+package christmas.domain;
+
+import christmas.domain.constants.event.EventValue;
+import christmas.domain.constants.menu.MenuGroup;
+import christmas.domain.constants.menu.MenuInterface;
+import christmas.message.ErrorMessage;
+import christmas.util.NumericConverter;
+import christmas.view.constants.... | Java | ์ด๋ฉ์ผ๋ก ์๋ ํผ๋๋ฐฑ์ค์ ๋ณ์๋ช
์ ์๋ฃํ์ ๋ฃ์ง ๋ง๋ผ๋ ํผ๋๋ฐฑ์ด ์์์ต๋๋ค! ๋ค์ `Arr` ์ ๋นผ๋ ์ข์๊ฒ ๊ฐ์ต๋๋ค ๐ |
@@ -0,0 +1,152 @@
+package christmas.domain;
+
+import christmas.domain.constants.Badge;
+import christmas.domain.constants.Gift;
+import christmas.domain.constants.event.EventDiscount;
+import christmas.domain.constants.event.EventValue;
+import christmas.domain.constants.menu.MenuGroup;
+
+import java.util.Arrays;
+i... | Java | `StarDate` ํด๋์ค์์ ํน๋ณ ์ด๋ฒคํธ๋ค์ ํด๋นํ๋ ๋ ์ง์ธ ์ผ์์ผ ๋ฟ๋ง ์๋๋ผ `starDateSettingWithSpecialDay` ๋ฅผ ํตํด์ ํฌ๋ฆฌ์ค๋ง์ค ์ ๋ณด๋ ๋ฃ๋๊ฒ์ผ๋ก ๋ณด์
๋๋ค. `EventCalendar` ๋์ ์ `StarDate` ๋ฅผ ํ์ฉํ๋ ๊ฒ์ ์ด๋จ๊น์? |
@@ -0,0 +1,45 @@
+package christmas.domain;
+
+import christmas.domain.constants.event.EventDate;
+
+import java.time.DayOfWeek;
+import java.time.LocalDate;
+import java.time.temporal.TemporalAdjusters;
+import java.util.Arrays;
+import java.util.HashSet;
+import java.util.Set;
+
+public class StarDate {
+ private ... | Java | ์ ๋ ๊ฐ์ธ์ ์ผ๋ก ์ด๋ฒ ๊ณผ์ ๋ ์ฌ๋ฌ๊ฐ์ง ์ด๋ฒคํธ๋ค์ ์ถ์ํํ๋ ๊ฒ์ด ํต์ฌ์ด๋ผ๊ณ ์๊ฐํด์ ์ด๋ฒคํธ ๊ฐ์ฒด๋ค์๋ง ์ ๊ฒฝ์ ์จ์ ์๋์ ์ผ๋ก ๋ ์ง ์ ๋ณด๋ค์ ์กฐ๊ธ ๋์ถฉ(?) ๋ค๋ค๋๊ฒ ๊ฐ์ต๋๋ค. ์์๋ ์ฒ๋ผ ๋ ์ง ์ ๋ณด๋ค์ ๊ผผ๊ผผํ๊ฒ ๋ค๋ค์ผํ๋ ํ๋ ์๊ฐ์ด ๋๋ค์ ๐ฅฒ |
@@ -0,0 +1,31 @@
+package christmas.domain.constants;
+
+import java.util.function.Predicate;
+
+public enum Badge {
+ NONE("์์", (amount) -> amount >= 0 && amount < 5_000),
+ START("๋ณ", (amount) -> amount >= 5_000 && amount < 10_000),
+ TREE("ํธ๋ฆฌ", (amount) -> amount >= 10_000 && amount < 20_000),
+ SANTA("... | Java | ์ ๋ง ์ข์ ๋ฐฉ๋ฒ์ด๋ผ๊ณ ์๊ฐํฉ๋๋ค! `Predicate` ๋ฅผ ํ์ฉํ๋ฉด์๋ ๋ฏธ์ฒ ์๊ฐํ์ง ๋ชปํ ๋ฐฉ๋ฒ์ด๋ค์ ๐ |
@@ -0,0 +1,41 @@
+package christmas.domain.constants;
+
+import java.util.function.Function;
+
+public enum Gift {
+ CHAMPAGNE("์ดํ์ธ", 25_000, 1, true, (amount) -> amount >= 120_000);
+
+ private final String name;
+ private final int price;
+ private final int count;
+ private final boolean gift;
+ pr... | Java | `Gift` enum ํด๋์ค์์ ์กด์ฌํ๋ ์์๋ค์ ์ด๋ฏธ ์ฆ์ ํ์ด๋ผ๊ณ ์๊ฐํฉ๋๋ค. ์ด๋ค ์ด์ ๋ก ๊ตฌํํ์
จ๋์ง ๊ถ๊ธํฉ๋๋ค! |
@@ -0,0 +1,35 @@
+package christmas.domain.constants.event;
+
+import java.util.Set;
+
+public enum EventDate {
+ NONE(0, Set.of()),
+ JANUARY(1, Set.of(1)),
+ FEBRUARY(2, Set.of(14)),
+ MARCH(3, Set.of(1, 14)),
+ APRIL(4, Set.of()),
+ MAY(5, Set.of(5, 8, 15)),
+ JUNE(6, Set.of(6)),
+ JULY(7, Se... | Java | ๊ฐ ์์ ํน๋ณํ ๋ ์ง๋ค์ ์ ์ํด๋์ enum ์ผ๋ก ๋ณด์
๋๋ค. ๋ค๋ง ๊ทธ ๊ธฐ์ค์ด ์กฐ๊ธ ๋ชจํธํ ๊ฒ ๊ฐ์ต๋๋ค.
`2์` ์ด๋ `3์` ๊ฐ์ ๊ฒฝ์ฐ๋ ๊ณตํด์ผ์ด ์๋ ๋ฐ๋ ํ์ธ ๋ฐ์ด ๊ฐ์ ๋ ๋ค์ ํฌํจํ๋ ๋ฐ๋ฉด ๊ณตํด์ผ๋ง์ ํฌํจํ๋ ๋ฌ๋ ์์ต๋๋ค. ํ์ง๋ง `5์ 27์ผ` (๋ถ์ฒ๋ ์ค์ ๋ ), `9์ 28 ~ 30์ผ` (์ถ์) ์ ์ ์ธ๋์ด ์๊ณ ํ ๋ก์ ๋ฐ์ด์ฒ๋ผ ๋น ์ง ๋ ๋ค๋ ์์ต๋๋ค.
๊ธฐ์ค์ ์ธ์์ ๊ณตํด์ผ๋ง ๋ฃ๋๋ค๋ ์ง ๊ณตํด์ผ ํฌํจ ๋ชจ๋ ์๋ฏธ์๋ ๋ ๋ค? ์ ๋ฃ๋๋ค๋ ์ง ํด์ ๊ธฐ์ค์ ์ธ์ฐ๋ฉด ์ข๋ ๋ช
ํํ๊ฒ ์ดํดํ ์ ์์๊ฒ ๊ฐ๋ค๋ ์๊ฐ์ด ๋ค์์ต๋๋ค. ์์๋์ ์๊ฐ์ ์ด๋ ์ ์ง ๊ถ๊ธํฉ๋๋ค... |
@@ -0,0 +1,12 @@
+package christmas.util.validation;
+
+import christmas.message.ErrorMessage;
+
+public class CommonValidator {
+
+ public static void isBlank(String text) {
+ if (text == null || text.isBlank()) {
+ throw new IllegalArgumentException(ErrorMessage.BLANK.getReasonFormattedMessage())... | Java | ์ ๋ ์ด๋ฐ์์ผ๋ก ์
๋ ฅ๊ฐ์ด ๊ณต๋ฐฑ์ธ์ง ์ฒดํฌํ๋ ๋ฉ์๋๋ฅผ ๋ง๋ค์์๋๋ฐ `Console.readLine().trim();` ์ผ๋ก ๊ณต๋ฐฑ ์ ๊ฑฐํ๋ ๋ฐฉ๋ฒ๋ ์๋๋ผ๊ตฌ์ ๐ |
@@ -0,0 +1,16 @@
+package christmas.view.constants;
+
+public enum InputMessage {
+ VISIT_DATE("12์ ์ค ์๋น ์์ ๋ฐฉ๋ฌธ ๋ ์ง๋ ์ธ์ ์ธ๊ฐ์? (์ซ์๋ง ์
๋ ฅํด ์ฃผ์ธ์!)"),
+ ORDER_MENU("์ฃผ๋ฌธํ์ค ๋ฉ๋ด๋ฅผ ๋ฉ๋ด์ ๊ฐ์๋ฅผ ์๋ ค ์ฃผ์ธ์. (e.g. ํด์ฐ๋ฌผํ์คํ-2,๋ ๋์์ธ-1,์ด์ฝ์ผ์ดํฌ-1)");
+
+ private final String message;
+
+ InputMessage(String message) {
+ this.message = me... | Java | ๋ฌ๋ ฅ ๋ฐ ๋ ์ง๊ด๋ จ ํด๋์ค์ 12์ ๋ฟ๋ง ์๋๋ผ ๋ค๋ฅธ ๋ ๋ค๋ ์ ์ํด๋์
จ์ผ๋ ์ด๋ถ๋ถ๋ ํ๋ผ๋ฏธํฐ๋ฅผ ๋ฐ๋๋ก ์ฒ๋ฆฌํ๋ฉด ์ข์๊ฒ ๊ฐ์ต๋๋ค! |
@@ -0,0 +1,53 @@
+package christmas.domain.event;
+
+import christmas.domain.calendar.Date;
+import christmas.domain.calendar.Order;
+import christmas.domain.menu.MenuGroup;
+import christmas.domain.menu.MenuType;
+
+public final class WeekdayDiscountEvent implements Event {
+
+ private static final int CHRISTMAS_EV... | Java | ์์๋ก ๋ ์ง๋ฅผ ์ ์ํ๋ค๊ธฐ ๋ณด๋ค๋ java.util.Calendar ํด๋์ค๋ฅผ ์ด์ฉํ๋ฉด ๋ ์ฝ๊ฒ ํ๊ธฐ๊ฐ๋ฅ ํ ๊ฒ ๊ฐ์ต๋๋ค. |
@@ -0,0 +1,53 @@
+package christmas.domain.event;
+
+import christmas.domain.calendar.Date;
+import christmas.domain.calendar.Order;
+import christmas.domain.menu.MenuGroup;
+import christmas.domain.menu.MenuType;
+
+public final class WeekendDiscountEvent implements Event {
+ private static final int CHRISTMAS_EVEN... | Java | ์ด ๋ถ๋ถ๋ Calendar ํด๋์ค์ after before ํจ์๋ฅผ ์ฌ์ฉํ๋ฉด ๋ ์ฝ๊ฒ ๋น๊ต ๊ฐ๋ฅํฉ๋๋ค! |
@@ -0,0 +1,55 @@
+package christmas.domain.event;
+
+import christmas.domain.calendar.Date;
+import christmas.domain.calendar.Order;
+import christmas.domain.menu.Menu;
+import christmas.domain.menu.MenuType;
+
+public final class FreeGiftEvent implements Event {
+
+ private static final int CHRISTMAS_EVENT_MONTH = ... | Java | ์์ฑ์๋ก DI ์ฃผ์
๋ฐ์ผ์๋ฉด ๋ ์ข์ ๊ฒ ๊ฐ์ต๋๋ค! |
@@ -0,0 +1,51 @@
+package christmas.controller;
+
+import christmas.domain.calendar.Date;
+import christmas.domain.calendar.Order;
+import christmas.domain.calendar.Planner;
+import christmas.domain.menu.Menus;
+import christmas.view.InputView;
+import christmas.view.OutputView;
+
+public class UtecoRestaurantControlle... | Java | ์ ๋ ๋น์ทํ๊ฒ ๊ตฌํํ์
จ๋ค์ ! ๋ค๋ง View๋ฅผ ์คํํฑ์ผ๋ก ๊ด๋ฆฌํ์ ์ด์ ๊ฐ์์๊น์? |
@@ -0,0 +1,65 @@
+package christmas.domain.calendar;
+
+import java.time.DayOfWeek;
+import java.time.LocalDate;
+import java.time.format.TextStyle;
+import java.util.Locale;
+
+public class Date {
+ private static final int VISIT_YEAR = 2023;
+ private static final int VISIT_MONTH = 12;
+ private Year year;
+... | Java | ๊ฐํํ๊ณ ๊ฐ๋๋ค.. ! ๋ ์ง๋ฅผ ์ด๋ฐ์์ผ๋ก ๊ด๋ฆฌํ ์๋์๋ค์! |
@@ -0,0 +1,48 @@
+package christmas.domain.event;
+
+import christmas.domain.calendar.Date;
+import christmas.domain.calendar.Order;
+import java.time.LocalDate;
+import java.time.Period;
+
+public final class ChristmasDailyDiscountEvent implements Event {
+
+ private static final int CHRISTMAS_EVENT_YEAR = 2023;
+ ... | Java | ์กฐ๊ธ ์ต์ง์ค๋ฌ์ด ์ง์ ์ด๊ธด ํ์ง๋ง, &&๋ฅผ ์์ผ๋ก ๋บด๋ ค๋ฉด ๋ชจ๋ ๋ค ๋นผ๋ฉด ์ข์๊ฒ ๊ฐ์์!
date.getMonth() == CHRISTMAS_EVENT_MONTH
&& date.getDay() >= CHRISTMAS_EVENT_MIN_DAY
&& date.getDay() <= CHRISTMAS_EVENT_MAX_DAY; |
@@ -0,0 +1,18 @@
+package christmas.domain.event;
+
+import christmas.domain.calendar.Date;
+import christmas.domain.calendar.Order;
+
+public sealed interface Event permits ChristmasDailyDiscountEvent, WeekdayDiscountEvent, WeekendDiscountEvent,
+ SpecialDiscountEvent,
+ FreeGiftEvent {
+
+ boolean is... | Java | sealed ํค์๋๋ฅผ ์ฒ์๋ด์ ์ ๊ธฐํ๋ค์..! ์ ๋ ๊ณต๋ถํด๋ด์ผ๊ฒ ์ต๋๋ค |
@@ -0,0 +1,55 @@
+package christmas.domain.event;
+
+import christmas.domain.calendar.Date;
+import christmas.domain.calendar.Order;
+import christmas.domain.menu.Menu;
+import christmas.domain.menu.MenuType;
+
+public final class FreeGiftEvent implements Event {
+
+ private static final int CHRISTMAS_EVENT_MONTH = ... | Java | ์ด ๋ถ๋ถ์ ์ธํฐํ์ด์ค ๊ตฌํ์ฒด๊ฐ ๋ชจ๋ ๋์ผํ ๋ก์ง์ ๊ฐ๊ธฐ ๋๋ฌธ์ Event๋ฅผ ์ถ์ํด๋์ค๋ก ๊ด๋ฆฌํ๋ฉด ์ฝ๋ ์ค๋ณต์ ์ ๊ฑฐํ ์ ์์ด ๋ ์ข์ ๊ฒ ๊ฐ์ต๋๋ค! |
@@ -0,0 +1,65 @@
+package christmas.domain.calendar;
+
+import java.time.DayOfWeek;
+import java.time.LocalDate;
+import java.time.format.TextStyle;
+import java.util.Locale;
+
+public class Date {
+ private static final int VISIT_YEAR = 2023;
+ private static final int VISIT_MONTH = 12;
+ private Year year;
+... | Java | ์ ๋ ํ์ ๋ฐฐ์ฐ๊ณ ๊ฐ๋๋ค ์ ๋ ๊ทธ๋ฅ ์ด๋ฒคํธ๊ฐ 12์ ํ์ ์ด๋ผ์ ๊ทธ๋ฅ ๋๋จธ์ง์ฐ์ฐ์ผ๋ก ํ๋๋ฐ.. ๋ฐ์ฑํฉ๋๋ค! |
@@ -0,0 +1,55 @@
+package christmas.domain.event;
+
+import christmas.domain.calendar.Date;
+import christmas.domain.calendar.Order;
+import christmas.domain.menu.Menu;
+import christmas.domain.menu.MenuType;
+
+public final class FreeGiftEvent implements Event {
+
+ private static final int CHRISTMAS_EVENT_MONTH = ... | Java | ์ ๋ ์ฒ์์ ์ด๋ ๊ฒ ํ๋๋ฐ ์๊ตฌ์ฌํญ์ ์ฝ์ด๋ณด๋ ์ฆ์ ์ด๋ฒคํธ์๋ ํ ์ธ์ด๋ผ๋ ๊ฐ๋
์ด ์์ด์ ์ ๋ ํํ๊ธ์ก๊ณ์ฐ์ผ๋ก ๋ฐ๊ฟจ์ด์..! |
@@ -0,0 +1,51 @@
+package christmas.domain.menu;
+
+import java.util.Arrays;
+import java.util.Collections;
+import java.util.List;
+import java.util.stream.Collectors;
+
+public enum MenuGroup {
+ APPETIZER("์ํผํ์ด์ ", Arrays.asList(MenuType.BUTTON_MUSHROOM_SOUP, MenuType.TAPAS, MenuType.CAESAR_SALAD)),
+ MAIN("๋ฉ์ธ"... | Java | ์ค ์ด๋ฐ์์ผ๋ก ๋ฉ๋ด๋ฅผ ์์์ฒ๋ฆฌํ์
จ๊ตฐ์ ๋ฆฌ์คํธ๋ก ๋ด๋ ๋ฐฉ๋ฒ๋ ์๋ค์! |
@@ -0,0 +1,53 @@
+package christmas.domain.event;
+
+import christmas.domain.calendar.Date;
+import christmas.domain.calendar.Order;
+import christmas.domain.menu.MenuGroup;
+import christmas.domain.menu.MenuType;
+
+public final class WeekdayDiscountEvent implements Event {
+
+ private static final int CHRISTMAS_EV... | Java | ํฌ๋ฆฌ์ค๋ง์ค ํ์ผ ์ด๋ฒคํธ๊ฐ ์๊ตฌ ์ฌํญ์ ๋ฐ๋ผ ๋ณ๊ฒฝ์ด ๋๋ ๊ธฐ๊ฐ์ด๋ผ
12์์ ๋ํ ์์์ฒ๋ฆฌ๋ก ๊ธฐ๊ฐ์ ํํํ์ต๋๋ค ! |
@@ -0,0 +1,55 @@
+package christmas.domain.event;
+
+import christmas.domain.calendar.Date;
+import christmas.domain.calendar.Order;
+import christmas.domain.menu.Menu;
+import christmas.domain.menu.MenuType;
+
+public final class FreeGiftEvent implements Event {
+
+ private static final int CHRISTMAS_EVENT_MONTH = ... | Java | ๊ธฐ๋ฅ์ ๊ฑฐ์ ๋ง๋ฌด๋ฆฌํ๊ณ ์ถ๋ ฅ๋ฌธ์ ๊ตฌํํ ๋,
์ฆ์ ์ํ์ด ์์ ๊ฒฝ์ฐ๋ ์ฆ์ ํ ๊ธ์ก ์๊ตฌ์ฌํญ์ if ์กฐ๊ฑด์ ๋์ง ์๊ณ
Menu์ Empty, ์์ ์ฒ๋ฆฌ๋ฅผ ๋ฏธ๋ฆฌ ์ฒ๋ฆฌํ๋ ค๊ณ ๋ง๋ค๋ค๊ฐ ํ๋์ฝ๋ฉ์ด ๋ ๋ถ๋ถ์ธ ๊ฒ ๊ฐ๋ค์ !
์์ฑ์๋ก ๋ฐ์์ผ๋ฉด ๋ ์ข์์ ๊ฒ ๊ฐ์ต๋๋ค :) |
@@ -0,0 +1,53 @@
+package christmas.domain.event;
+
+import christmas.domain.calendar.Date;
+import christmas.domain.calendar.Order;
+import christmas.domain.menu.MenuGroup;
+import christmas.domain.menu.MenuType;
+
+public final class WeekendDiscountEvent implements Event {
+ private static final int CHRISTMAS_EVEN... | Java | 12์ ์ด๋ฒคํธ ๋ฟ๋ง์๋๋ผ 12์์์ 1์๊น์ง ์ฐ์ฅ์ด ๋๋ค๊ณ ๊ฐ์ ํ๋ฉด,
Calendar์ LocalDate ํด๋์ค๋ฅผ ์ฌ์ฉํ๋ ๊ฒ์ด ๋ ์ข์์ ๊ฒ ๊ฐ์ต๋๋ค :) ๋ฆฌ๋ทฐ ๊ฐ์ฌํฉ๋๋ค |
@@ -0,0 +1,51 @@
+package christmas.controller;
+
+import christmas.domain.calendar.Date;
+import christmas.domain.calendar.Order;
+import christmas.domain.calendar.Planner;
+import christmas.domain.menu.Menus;
+import christmas.view.InputView;
+import christmas.view.OutputView;
+
+public class UtecoRestaurantControlle... | Java | Controller๊ฐ ์ง์ InputView์ OutputView๋ฅผ ์ฌ์ฉํ๋ค๋ฉด
์ปจํธ๋กค๋ฌ ๋ถ๋ถ์ด ๋ ๊น๋ํด์ง์ง ์์๊น.. ๋ผ๋ ๊ฐ์ธ์ ์ธ ์๊ฒฌ์ด ๋ค์ด๊ฐ ์์ต๋๋ค
DI๋ฅผ ๋ฐ๋ ๋ฐฉ์์ ์ฌ์ฉํ๋ ๊ฒ์ด ๊ฐ์ฒด์งํฅ ์ค๊ณ์ ๋ ๋ง๋ ๋ฐฉ์์ด์๋ ๊ฒ ๊ฐ๋ค์ ๐ฅฒ |
@@ -0,0 +1,48 @@
+package christmas.domain.event;
+
+import christmas.domain.calendar.Date;
+import christmas.domain.calendar.Order;
+import java.time.LocalDate;
+import java.time.Period;
+
+public final class ChristmasDailyDiscountEvent implements Event {
+
+ private static final int CHRISTMAS_EVENT_YEAR = 2023;
+ ... | Java | ์๋๋๋ค ! ์ฐพ์์ฃผ์
์ ๊ฐ์ฌํฉ๋๋ค ๐๐๐
์ฝ๋๋ฅผ ์งํํ๋ค๊ฐ ์ค ๋ฐ๊ฟ์ ๋ณด์ง ๋ชปํ๊ณ ์ฝ๋ ์ผ๊ด์ฑ์ด ์ด๊ธ๋์๋ค์ ! ๋ฆฌ๋ทฐ ๊ฐ์ฌํฉ๋๋ค :) |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.