code stringlengths 41 34.3k | lang stringclasses 8
values | review stringlengths 1 4.74k |
|---|---|---|
@@ -0,0 +1,11 @@
+const deepFreeze = (object) => {
+ Object.keys(object).forEach((prop) => {
+ if (typeof object[prop] === 'object' && !Object.isFrozen(object[prop])) {
+ deepFreeze(object[prop]);
+ }
+ });
+
+ return Object.freeze(object);
+};
+
+export default deepFreeze; | JavaScript | deepFreeze ๊ผผ๊ผผํ์ญ๋๋ค~ ๐๐๐ |
@@ -0,0 +1,36 @@
+import EventCalendar from '../../src/domain/EventCalendar';
+import { CHRISTMAS_D_DAY, GIFT, SPECIAL } from '../../src/domain/Events';
+
+import {
+ EVENT_MONTH,
+ EVENT_NAMES,
+ EVENT_YEAR,
+} from '../../src/constants/event';
+import { MAIN_COURSES } from '../../src/constants/menus';
+
+describe(... | JavaScript | ์ค์ ๋ก ๋ชจ๋ํ๋ ์์์ ๊ตฌ์กฐ๋ ๊ฐ์ด ๋ฐ๋๋ฉด ํ
์คํธ์ ๊ฒฐ๊ณผ๊ฐ ๋ฐ๋๋ ๊ฑธ ๊ฒฝํํ๊ณ ์๋ฌธ์ ํ๊ธด ํ๋๋ฐ, ๋
๋ฆฝ์ฑ์ ์งํค์ง ์์ ํ๋์ด์๊ตฐ์! ๋๋ถ์ ๊นจ๋ฌ์์ต๋๋ค. ์ข์ ํผ๋๋ฐฑ ๊ฐ์ฌํด์.๐ |
@@ -0,0 +1,117 @@
+import { EVENT_NAMES } from '../constants/event.js';
+import { DESSERTS, MAIN_COURSES } from '../constants/menus.js';
+
+export const CHRISTMAS_D_DAY = {
+ getBenefit({ date }) {
+ const baseAmount = 1000;
+ const weightAmount = 100;
+
+ return {
+ amount: 1,
+ price: baseAmount +... | JavaScript | ์ข์ ๋ฐฉ๋ฒ์ด๋ค์! ๊ฐ์ฌํฉ๋๋ค. :) |
@@ -0,0 +1,83 @@
+import deepFreeze from '../utils/deepFreeze.js';
+import { EVENT_MONTH } from './event.js';
+
+const MESSAGES = deepFreeze({
+ // InputView
+ inputs: {
+ getVisitDate: `${EVENT_MONTH}์ ์ค ์๋น ์์ ๋ฐฉ๋ฌธ ๋ ์ง๋ ์ธ์ ์ธ๊ฐ์? (์ซ์๋ง ์
๋ ฅํด ์ฃผ์ธ์!)\n`,
+ getOrders:
+ '์ฃผ๋ฌธํ์ค ๋ฉ๋ด๋ฅผ ๋ฉ๋ด์ ๊ฐ์๋ฅผ ์๋ ค ์ฃผ์ธ์. (e.g. ํด์ฐ๋ฌผํ์คํ-2,๋ ๋์์ธ-1,... | JavaScript | ์ ๋ ๊ณ ๋ฏผํ๋ ๋ถ๋ถ์ธ๋ฐ, ๋ค๋ฅธ ๋ฌ์ ์ด๋ฒคํธ๋ฅผ ๊ฐ์ตํ๋ค๋ฉด ์์๋ก ๋นผ๋ ๊ฒ ์ข์ ๊ฒ ๊ฐ์ ์ด๋ ๊ฒ ํ์ต๋๋ค! |
@@ -0,0 +1,83 @@
+import deepFreeze from '../utils/deepFreeze.js';
+import { EVENT_MONTH } from './event.js';
+
+const MESSAGES = deepFreeze({
+ // InputView
+ inputs: {
+ getVisitDate: `${EVENT_MONTH}์ ์ค ์๋น ์์ ๋ฐฉ๋ฌธ ๋ ์ง๋ ์ธ์ ์ธ๊ฐ์? (์ซ์๋ง ์
๋ ฅํด ์ฃผ์ธ์!)\n`,
+ getOrders:
+ '์ฃผ๋ฌธํ์ค ๋ฉ๋ด๋ฅผ ๋ฉ๋ด์ ๊ฐ์๋ฅผ ์๋ ค ์ฃผ์ธ์. (e.g. ํด์ฐ๋ฌผํ์คํ-2,๋ ๋์์ธ-1,... | JavaScript | ์, ๋์น ๋ถ๋ถ์ด๋ค์! ์ง์ด์ฃผ์
์ ๊ฐ์ฌํฉ๋๋ค.๐ |
@@ -0,0 +1,63 @@
+import { FRIDAY, SATURDAY, SPECIAL_DATES } from '../constants/calendar.js';
+import { EVENT_PERIOD } from '../constants/event.js';
+import { ALL_EVENTS } from './Events.js';
+
+class EventCalendar {
+ #year;
+
+ #month;
+
+ #date;
+
+ #availableEvents;
+
+ constructor(year, month, date) {
+ th... | JavaScript | ๋ง์์! ์ค์๋ฅผ ์ค์ด๊ธฐ ์ํด์ ์์ ๊ฐ์ ๋ฐฉ์์ผ๋ก ํ์ต๋๋ค. :) |
@@ -0,0 +1,56 @@
+package christmas.domain;
+
+
+import static christmas.domain.Badge.NONE;
+import static christmas.domain.Badge.SANTA;
+import static christmas.domain.Badge.STAR;
+import static christmas.domain.Badge.TREE;
+
+import java.util.Map;
+
+public class Benefits {
+ private final Map<Event, Integer> bene... | Java | is{BadgeType}Badge ํจ์๋ฅผ ์ฌ์ฉํด์ ํ๋์ฉ ๋น๊ตํ๋ ํจ์๋ฅผ ๋ง๋ค๊ฒ ๋๋ฉด ๋ฐฐ์ง๊ฐ ์๊ธฐ๊ฑฐ๋ ์ญ์ ํ ๋๋ง๋ค ๋ฉ์๋ ๊ด๋ฆฌ๋ฅผ ๊ณ์ ํด์ค์ผํ๋ค๋ ๋ฒ๊ฑฐ๋ก์์ด ์๊ธธ ์ ์์ ๊ฑฐ ๊ฐ์์!! |
@@ -0,0 +1,48 @@
+package christmas.domain;
+
+public enum Menu {
+ MUSHROOM_SOUP("์์ก์ด์ํ", 6_000, "์ ํผํ์ด์ "),
+ TAPAS("ํํ์ค", 5_500, "์ ํผํ์ด์ "),
+ CAESAR_SALAD("์์ ์๋ฌ๋", 8_000, "์ ํผํ์ด์ "),
+ T_BONE_STEAK("ํฐ๋ณธ์คํ
์ดํฌ", 55_000, "๋ฉ์ธ"),
+ BBQ_RIBS("๋ฐ๋นํ๋ฆฝ", 54_000, "๋ฉ์ธ"),
+ SEAFOOD_PASTA("ํด์ฐ๋ฌผํ์คํ", 35_000, "๋ฉ์ธ"),
+ C... | Java | ์์ Type์ ๊ฒฝ์ฐ ๊ณตํต๋๋ ํญ๋ชฉ (์ํผํ์ด์ /๋ฉ์ธ/๋์ ํธ/์๋ฃ)์ ๋ํด์ ๋ณ๋๋ก ๊ด๋ฆฌํด๋ ์ข์๊ฑฐ ๊ฐ์์ |
@@ -0,0 +1,76 @@
+package christmas.controller;
+
+import christmas.domain.Badge;
+import christmas.domain.Benefits;
+import christmas.domain.Convertor;
+import christmas.domain.Date;
+import christmas.domain.EventManager;
+import christmas.domain.Orders;
+import christmas.view.InputView;
+import christmas.view.OutputV... | Java | ์
๋ ฅ ๊ฒ์ฆ์ ํ ์ฌ์
๋ ฅ ๋ฐ๋๊ฒ์ inputview์์ ์งํํ๋๊ฒ์ ๋ํด ์ด๋ป๊ฒ ์๊ฐํ์๋์???
๊ตฌํ ํ๋ฉด์ ๊ณ ๋ฏผํ์๋๋ฐ ์ด๋ ๋ฐฉํฅ์ผ๋ก ๊ตฌํํด์ผ ๋ ๋์์ง ์ ๋ชจ๋ฅด๊ฒ ๋๋ผ๊ตฌ์ |
@@ -0,0 +1,76 @@
+package christmas.controller;
+
+import christmas.domain.Badge;
+import christmas.domain.Benefits;
+import christmas.domain.Convertor;
+import christmas.domain.Date;
+import christmas.domain.EventManager;
+import christmas.domain.Orders;
+import christmas.view.InputView;
+import christmas.view.OutputV... | Java | ๋ค๋ค ์์ธ๋ฅผ e ๋ผ๊ณ ํ๊ธฐํ์ง๋ง ๊ทธ๋๋ error ๋ผ๊ณ ์กฐ๊ธ ๋ ์์ธํ๊ฒ ํํํ๋ ๊ฒ๋ ์ข์ ๊ฒ ๊ฐ์ต๋๋ค.
์ฌ์ค ์ ๋ ์ค๋ผ๊ณ ํ์๋๋ฐ ์ด๋ค ๋ถ์ด ๋ฆฌ๋ทฐ๋ ์ด๋ฌํ ๋ถ๋ถ์ ์ธ๊ธํ ๊ฒ์ ๋ณธ ์ ์ด ์์ด์์ |
@@ -0,0 +1,48 @@
+package christmas.domain;
+
+public enum Menu {
+ MUSHROOM_SOUP("์์ก์ด์ํ", 6_000, "์ ํผํ์ด์ "),
+ TAPAS("ํํ์ค", 5_500, "์ ํผํ์ด์ "),
+ CAESAR_SALAD("์์ ์๋ฌ๋", 8_000, "์ ํผํ์ด์ "),
+ T_BONE_STEAK("ํฐ๋ณธ์คํ
์ดํฌ", 55_000, "๋ฉ์ธ"),
+ BBQ_RIBS("๋ฐ๋นํ๋ฆฝ", 54_000, "๋ฉ์ธ"),
+ SEAFOOD_PASTA("ํด์ฐ๋ฌผํ์คํ", 35_000, "๋ฉ์ธ"),
+ C... | Java | Stream์ ์ด์ฉํด ๋ฉ๋ด๊ฐ ํฌํจ๋ ๋ฆฌ์คํธ๋ฅผ ๋ง๋ค์ด contains๋ก ํ์ธํ๋ ๊ฒ ์กฐ๊ธ ๋ ๊ฐ๊ฒฐํด ๋ณด์ผ์๋ ์์ ๊ฒ ๊ฐ์๋ฐ ์ด๋ป๊ฒ ์๊ฐํ์๋์?? |
@@ -0,0 +1,17 @@
+package christmas.domain;
+
+public enum Error {
+ INVALID_DATE("[ERROR] ์ ํจํ์ง ์์ ๋ ์ง์
๋๋ค. ๋ค์ ์
๋ ฅํด ์ฃผ์ธ์."),
+ INVALID_ORDER("[ERROR] ์ ํจํ์ง ์์ ์ฃผ๋ฌธ์
๋๋ค. ๋ค์ ์
๋ ฅํด ์ฃผ์ธ์."),
+ INVALID_COUNT("[ERROR] ๋ฉ๋ด๋ ํ ๋ฒ์ ์ต๋ 20๊ฐ๊น์ง๋ง ์ฃผ๋ฌธํ ์ ์์ต๋๋ค. ๋ค์ ์
๋ ฅํด ์ฃผ์ธ์"),
+ INVALID_TYPE("[ERROR] ์๋ฃ๋ง ์ฃผ๋ฌธ ์, ์ฃผ๋ฌธํ ์ ์์ต๋๋ค. ๋ค์ ์
๋ ฅํด ์ฃผ์ธ์");
+ ... | Java | [Error] ์ ๊ณตํต๋ถ๋ถ์ด๋ค๋ณด๋ ๋ฐ๋ก ๋นผ๋์ด์ ๋ถ๋ฌ์ฌ๋ this message = " [ error ]"+ message ๋ก ํด๋ ๊ด์ฐฎ์ ๊ฒ ๊ฐ์๋ฐ ์ด๋ป๊ฒ ์๊ฐํ์๋์? |
@@ -0,0 +1,76 @@
+package christmas.controller;
+
+import christmas.domain.Badge;
+import christmas.domain.Benefits;
+import christmas.domain.Convertor;
+import christmas.domain.Date;
+import christmas.domain.EventManager;
+import christmas.domain.Orders;
+import christmas.view.InputView;
+import christmas.view.OutputV... | Java | ์ ์ฒด์ ์ผ๋ก create๋ผ๋ ๋ฉ์๋๋ช
์ ์ฌ์ฉํ๋๋ฐ create๊ฐ ๊ฐ์ฒด ์์ฑ์ ๋๋์ ์ฃผ๋๊ฑฐ๊ฐ์์ ๋ค๋ฅธ ์ด๋ฆ์ผ๋ก ๋ฉ์๋๋ช
์ ์์ฑํด๋ณด๋๊ฑด ์ด๋จ๊น์ ? |
@@ -0,0 +1,43 @@
+package christmas.domain;
+
+import static christmas.domain.Error.INVALID_ORDER;
+
+import java.util.Arrays;
+import java.util.List;
+import java.util.regex.Pattern;
+import java.util.stream.Collectors;
+
+public class Convertor {
+ private static final String ORDERS_DELIMITER = ",";
+ private s... | Java | ์ ์ ๋ฉ์๋๋ก ์ฌ์ฉํ๋ ๊ธฐ์ค์ด ๊ถ๊ธํฉ๋๋ค. ํ๋ฆฌ์ฝ์ค ๊ธฐ๊ฐ๋์ ๋ฏธ์
ํ๋ฉด์ ์จ๋ณด๊ธฐ๋ ํ๋๋ฐ ์ด๋จ๋ ์จ์ผํ ์ง ์ ๋ชจ๋ฅด๊ฒ ์ด์์ |
@@ -0,0 +1,24 @@
+package christmas.domain;
+
+public enum Badge {
+ STAR("๋ณ", 5_000),
+ TREE("ํธ๋ฆฌ", 10_000),
+ SANTA("์ฐํ", 20_000),
+ NONE("์์", 0);
+
+ private final String type;
+ private final int amount;
+
+ Badge(String type, int amount) {
+ this.type = type;
+ this.amount = amou... | Java | private์ ์ง์ ํด ์ฃผ์ง ์์ ์ด์ ๊ฐ ๋ฐ๋ก ์๋์? |
@@ -0,0 +1,56 @@
+package christmas.domain;
+
+
+import static christmas.domain.Badge.NONE;
+import static christmas.domain.Badge.SANTA;
+import static christmas.domain.Badge.STAR;
+import static christmas.domain.Badge.TREE;
+
+import java.util.Map;
+
+public class Benefits {
+ private final Map<Event, Integer> bene... | Java | ๋์ค ๊ฐํ์ด ๋ค์ด๊ฐ๊ฑฐ ๊ฐ์์ !!
๋ค์๋ฒ์ ์์ํ ์ปจ๋ฒค์
๋ ์ฑ๊ธฐ๋ฉด ์ข์๊ฑฐ๊ฐ์์ |
@@ -0,0 +1,51 @@
+package christmas.domain;
+
+import static christmas.domain.Error.INVALID_DATE;
+import static java.time.DayOfWeek.FRIDAY;
+import static java.time.DayOfWeek.SATURDAY;
+import static java.time.DayOfWeek.SUNDAY;
+
+import java.time.DayOfWeek;
+import java.time.LocalDate;
+
+public class Date {
+ pri... | Java | Date๋ผ๋ ํด๋์ค๊ฐ validateRange๋ ๊ทธ๋ ๊ณ 12์์๋ง ํ์ ๋๊ฑฐ ๊ฐ์๋ฐ Date๋ผ๊ณ class๋ช
์ ์ง๋๊ฑด ๋๋ฌด ํฌ๊ด์ ์ด๊ฒ ๋๊ปด์ ธ์ ์กฐ๊ธ ๋ ๊ตฌ์ฒด์ ์ธ ๋ค๋ฅธ์ด๋ฆ์ ์ฌ์ฉํ๋ค๋ฉด ์ด๋จ๊น ์ถ์ต๋๋ค |
@@ -0,0 +1,48 @@
+package christmas.domain;
+
+public enum Menu {
+ MUSHROOM_SOUP("์์ก์ด์ํ", 6_000, "์ ํผํ์ด์ "),
+ TAPAS("ํํ์ค", 5_500, "์ ํผํ์ด์ "),
+ CAESAR_SALAD("์์ ์๋ฌ๋", 8_000, "์ ํผํ์ด์ "),
+ T_BONE_STEAK("ํฐ๋ณธ์คํ
์ดํฌ", 55_000, "๋ฉ์ธ"),
+ BBQ_RIBS("๋ฐ๋นํ๋ฆฝ", 54_000, "๋ฉ์ธ"),
+ SEAFOOD_PASTA("ํด์ฐ๋ฌผํ์คํ", 35_000, "๋ฉ์ธ"),
+ C... | Java | ์ฌ๊ธฐ๋ ์ ๊ทผ ์ง์ ์๊ฐ ๋ฐ๋ก ์ค์ ๋์ง ์์ ์ด์ ๊ฐ ์์๊น์ ? |
@@ -0,0 +1,92 @@
+package christmas.domain;
+
+import static christmas.domain.Error.INVALID_ORDER;
+import static christmas.domain.Menu.NONE;
+
+import java.util.Objects;
+
+public class Order {
+ private static final int MIN_ORDER_COUNT = 1;
+ private final String menuName;
+ private final int count;
+
+ p... | Java | ์๊น Type์ ๋ณ๋๋ก Enum ๊ฐ์ ๊ฐ์ฒด๋ก ๊ด๋ฆฌ ํ๋๋ผ๋ฉด "์๋ฃ"-> ์ ๊ฐ์ stringํ์ผ๋ก ๋น๊ตํ์ง ์์๋ ๋์ ๊ฑฐ ๊ฐ์์ !! ๋ง์ฝ Type์ ์ด๋ฆ์ด ๋ฐ๋๊ฒ ๋์๋ ํ๋ํ๋ ๋ค์ ์ฝ๋๋ฅผ ๋ฐ๊พธ๋ ์๊ณ ๋ฅผ ๋ ์ ์์์๊ฑฐ ๊ฐ์ต๋๋ค:D |
@@ -0,0 +1,92 @@
+package christmas.domain;
+
+import static christmas.domain.Error.INVALID_ORDER;
+import static christmas.domain.Menu.NONE;
+
+import java.util.Objects;
+
+public class Order {
+ private static final int MIN_ORDER_COUNT = 1;
+ private final String menuName;
+ private final int count;
+
+ p... | Java | hashCode๋ฅผ ์ฌ์ฉํ์
จ๋ค์ !!!!
ํน์ hashCode๋ฅผ ์ฌ์ฉํ ์ด์ ๋ฅผ ์ฌ์ญค๋ด๋ ๋ ๊น์?๐ |
@@ -0,0 +1,106 @@
+package christmas.domain;
+
+import static christmas.domain.Error.INVALID_COUNT;
+import static christmas.domain.Error.INVALID_ORDER;
+import static christmas.domain.Error.INVALID_TYPE;
+
+import java.util.List;
+
+public class Orders {
+ private static final int MAX_TOTAL_ORDER_COUNT = 20;
+ p... | Java | Benefit๊ณผ gif์ limit ๊ธ์ก๋ฅผ Order์์ ์ ํด์ฃผ๋๊ฒ๋ณด๋ค Benefit์ ์ฑ
์์ ๋ฌผ๋ ค์ ๊ฒ์ฆํ๋๊ฑด ์ด๋ ์๊น์? |
@@ -0,0 +1,25 @@
+package christmas.view;
+
+enum Notice {
+ WELCOME("์๋
ํ์ธ์! ์ฐํ
์ฝ ์๋น 12์ ์ด๋ฒคํธ ํ๋๋์
๋๋ค."),
+ ASK_DATE_OF_VISIT("12์ ์ค ์๋น ์์ ๋ฐฉ๋ฌธ ๋ ์ง๋ ์ธ์ ์ธ๊ฐ์? (์ซ์๋ง ์
๋ ฅํด ์ฃผ์ธ์!)"),
+ ASK_MENU_AND_COUNT("์ฃผ๋ฌธํ์ค ๋ฉ๋ด๋ฅผ ๋ฉ๋ด์ ๊ฐ์๋ฅผ ์๋ ค ์ฃผ์ธ์. (e.g. ํด์ฐ๋ฌผํ์คํ-2,๋ ๋์์ธ-1,์ด์ฝ์ผ์ดํฌ-1)"),
+ PREVIEW("12์ %s์ผ์ ์ฐํ
์ฝ ์๋น์์ ๋ฐ์ ์ด๋ฒคํธ ํํ ๋ฏธ๋ฆฌ ๋ณด๊ธฐ!%n"),
+ ORD... | Java | %s์ผ ์ฌ์ฉํ์ ๊ฒ์ฒ๋ผ 12์๋ ๋์ ์ผ๋ก ์ฒ๋ฆฌํด๋ณผ ์ ์์๊ฑฐ ๊ฐ์์ :) ๐ |
@@ -0,0 +1,38 @@
+package christmas.domain;
+
+import static christmas.domain.Badge.NONE;
+import static org.assertj.core.api.AssertionsForClassTypes.assertThat;
+
+import org.junit.jupiter.api.BeforeEach;
+import org.junit.jupiter.api.DisplayName;
+import org.junit.jupiter.api.Test;
+import org.junit.jupiter.params.Pa... | Java | CsvSouce๊ฐ ์์๊ตฐ์ ?!!! ์ ๋ ์ด๊ฑธ ๋ชฐ๋ผ์ ํ๊ฐ์ง ๋ณ์๋ก๋ง ํ
์คํธ ์ฝ๋๋ฅผ ์์ฑํ๋๋ผ ์ ๋จน์ ๋ถ๋ถ์ด ์์๋๋ฐ ,, ๋ฐฐ์๊ฐ๋๋ค :O ์ ์ฉํ๊ฒ ์ธ ์ ์์๊ฑฐ๊ฐ์์ |
@@ -0,0 +1,38 @@
+package christmas.domain;
+
+import static christmas.domain.Badge.NONE;
+import static org.assertj.core.api.AssertionsForClassTypes.assertThat;
+
+import org.junit.jupiter.api.BeforeEach;
+import org.junit.jupiter.api.DisplayName;
+import org.junit.jupiter.api.Test;
+import org.junit.jupiter.params.Pa... | Java | setUp ํจ์์ ๊ฒฝ์ฐ ๊ฐ๋
์ฑ(?)์ ์ํด ์๋จ์ ์์น์ํค๋ฉด ๋ ์ข์๊ฑฐ๊ฐ์์ |
@@ -0,0 +1,70 @@
+# ๊ธฐ๋ฅ ๊ตฌํ ๋ชฉ๋ก
+
+## view
+
+- [x] **InputView**
+ - ๋ฐฉ๋ฌธ ๋ ์ง๋ฅผ ์
๋ ฅ ๋ฐ์ ์ ์๋ก ๋ฐํํ๋ค.
+ - ์ซ์ ์ด์ธ์ ๊ฐ์ ์
๋ ฅ์ ์์ธ๋ฅผ ๋ฐ์ ์ํจ๋ค.
+ - ์ฃผ๋ฌธ ๋ด์ฉ์ ์
๋ ฅ ๋ฐ์ ๋ฌธ์์ด๋ก ๋ฐํํ๋ค.
+- [x] **Notice**
+ - InputView์ OutputView์์ ์ฌ์ฉํ๋ ๋ฉ์์ง๋ฅผ ์ ์ฅํ๋ค.
+- [x] **OutputView**
+ - ์๋ฌ ๋ฐ์์ ์๋ฌ ๋ฉ์์ง๋ฅผ ์ถ๋ ฅํ๋ค.
+ - ์ธ์ฌ๋ง์ ์ถ๋ ฅํ๋ค.
+ - ํํ ๋ฏธ๋ฆฌ๋ณด๊ธฐ ๋ด์ฉ์ ์ถ๋ ฅํ๋ค.
+... | Unknown | ์ฝ๋๋ฆฌ๋ทฐ์ ์์, ๊ฐ์ฒด ๊ธฐ๋ฅ๋ณ๋ก ๋ถ๋ฆฌ๋์ด ์์ด ์ ์ฒด ๋น์ฆ๋์ค ๋ก์ง ๋ฐ ๊ฐ ๊ฐ์ฒด์ ์ญํ ์ ํ์
ํ๊ธฐ ํธ๋ฆฌํ์ด์ ๐ |
@@ -0,0 +1,76 @@
+package christmas.controller;
+
+import christmas.domain.Badge;
+import christmas.domain.Benefits;
+import christmas.domain.Convertor;
+import christmas.domain.Date;
+import christmas.domain.EventManager;
+import christmas.domain.Orders;
+import christmas.view.InputView;
+import christmas.view.OutputV... | Java | ๊ฐํ๋ ํ๋์ ์ปจ๋ฒค์
์ด๋ค!
์กฐ๊ธ ๋ ๊ธฐ๋ฅ๋ณ๋ก ๋ถ๋ฆฌํด์ ๊ฐํ์ผ๋ก ๊ตฌ๋ถํ๋ค๋ฉด ๋ ์ฝ๊ธฐ ํธํ ๊ฒ ๊ฐ์์. |
@@ -0,0 +1,76 @@
+package christmas.controller;
+
+import christmas.domain.Badge;
+import christmas.domain.Benefits;
+import christmas.domain.Convertor;
+import christmas.domain.Date;
+import christmas.domain.EventManager;
+import christmas.domain.Orders;
+import christmas.view.InputView;
+import christmas.view.OutputV... | Java | 
์์ถ๋๊ป์ ๋ฆฌ๋ทฐ ์ฃผ์
จ๋ ๋ด์ฉ์ ๋ํด์, ํ๋ฒ ์ฌ์ญ๊ณ ์ถ์ ๋ถ๋ถ์ด ์๊ฒจ ์ฌ๊ธฐ์๋ ๊ธ์ ๋จ๊ฒจ๋ด
๋๋ค.
1. ์ปจํธ๋กค๋ฌ๊ฐ ์ ์ฒด ๋น์ฆ๋์ค ๋ก์ง์ ๊ดํ ํ๊ณ ์์ด์.
`์ปจํธ๋กค๋ฌ Layer ๋จ์ํ
์คํธ = ํตํฉํ
์คํธ`์ ์ญํ ์ ์ํํ ๊ฒ ๊ฐ์๋ฐ, ์ปจํธ๋กค๋ฌ์ ๋ถ๋ฆฌ๊ฐ ํ์ํ์ง ์์๊น์?
1-1. ์ปจ... |
@@ -0,0 +1,56 @@
+package christmas.domain;
+
+
+import static christmas.domain.Badge.NONE;
+import static christmas.domain.Badge.SANTA;
+import static christmas.domain.Badge.STAR;
+import static christmas.domain.Badge.TREE;
+
+import java.util.Map;
+
+public class Benefits {
+ private final Map<Event, Integer> bene... | Java | ๋ง์ฝ ๋ฑ์ง๊ฐ 100๊ฐ๋ผ๋ฉด?, 1000๊ฐ๋ผ๋ฉด?
๋ฑ์ง์ ๊ฐฏ์๊ฐ ๋ง์์ง๋ ์ํฉ์์ ๋ชจ๋ ๋ก์ง์ ํ๋์ฝ๋ฉ ํด์ผํ๋ ์ํฉ์ด ์๊ธธ ๊ฒ ๊ฐ์์.
์ด ๋ถ๋ถ๋, ํ๋์ฝ๋ฉ์ด ์๋๋ผ, ๋ฑ์ง์ ์์ฑ์ ๋ฐ๋ผ ๊ตฌ๋ถํ ์ ์๋๋ก ๋ฐฉ๋ฒ์ ๋ชจ์ํด๋ณด์๋ฉด, ์ข์ ๊ฒ ๊ฐ์์! |
@@ -0,0 +1,51 @@
+package christmas.domain;
+
+import static christmas.domain.Error.INVALID_DATE;
+import static java.time.DayOfWeek.FRIDAY;
+import static java.time.DayOfWeek.SATURDAY;
+import static java.time.DayOfWeek.SUNDAY;
+
+import java.time.DayOfWeek;
+import java.time.LocalDate;
+
+public class Date {
+ pri... | Java | ํด๋น ์ด๋ฒคํธ๋ 1์์๋ ์ ๋ฌผ์ ์ฆ์ ํ๋ฉด์, `์ฌ์ฌ์ฉ ์์ `์์ ์์ฐ์ค์ ์์ํ์ด์.
int ํ์
ํ๋์ฝ๋ฉ์ด ์๋๋ผ, LocalDate๋ฅผ ํ์ฉํด 2023๋
12์๊ณผ 2024๋
1์์ ๋ผ์๋ฃ์ด์ ๋ฐ๋ก ์ฌ์ฉํ ์ ์๋๋ก ์ค๊ณํ๋ฉด, ๋ ์ ์ฐํ ์ค๊ณ๊ฐ ๋์์ ๊ฒ์ด๋ผ ์๊ฐ๋์ด์! |
@@ -0,0 +1,33 @@
+package christmas.domain;
+
+import static christmas.domain.Menu.CHAMPAGNE;
+
+public enum Event {
+ CHRISTMAS_D_DAY("ํฌ๋ฆฌ์ค๋ง์ค ๋๋ฐ์ด ํ ์ธ", 1_000, 100),
+ WEEKDAY("ํ์ผ ํ ์ธ", 0, 2_023),
+ WEEKEND("์ฃผ๋ง ํ ์ธ", 0, 2_023),
+ SPECIAL("ํน๋ณ ํ ์ธ", 1_000, 0),
+ GIFT("์ฆ์ ์ด๋ฒคํธ", CHAMPAGNE.getPrice(), 0);
+
+ p... | Java | `initPrice` ์ง๊ด์ ์ผ๋ก ๋ณ์๋ช
๋ง ๋ดค์ ๋, ์ด๋ค int๊ฐ์ ๋ด๋์ง ๋ชจํธํ ๊ฐ์ด ์์ด์ |
@@ -0,0 +1,60 @@
+package christmas.domain;
+
+import static christmas.domain.Event.CHRISTMAS_D_DAY;
+import static christmas.domain.Event.GIFT;
+import static christmas.domain.Event.SPECIAL;
+import static christmas.domain.Event.WEEKDAY;
+import static christmas.domain.Event.WEEKEND;
+
+import java.util.EnumMap;
+impo... | Java | ์ค๋ ์ผ์ * 100 + 900 ์ผ๋ก ๊ฐ๋จํ๊ฒ ํํํ ์ ์๋ต๋๋ค >_< |
@@ -0,0 +1,25 @@
+package christmas.view;
+
+enum Notice {
+ WELCOME("์๋
ํ์ธ์! ์ฐํ
์ฝ ์๋น 12์ ์ด๋ฒคํธ ํ๋๋์
๋๋ค."),
+ ASK_DATE_OF_VISIT("12์ ์ค ์๋น ์์ ๋ฐฉ๋ฌธ ๋ ์ง๋ ์ธ์ ์ธ๊ฐ์? (์ซ์๋ง ์
๋ ฅํด ์ฃผ์ธ์!)"),
+ ASK_MENU_AND_COUNT("์ฃผ๋ฌธํ์ค ๋ฉ๋ด๋ฅผ ๋ฉ๋ด์ ๊ฐ์๋ฅผ ์๋ ค ์ฃผ์ธ์. (e.g. ํด์ฐ๋ฌผํ์คํ-2,๋ ๋์์ธ-1,์ด์ฝ์ผ์ดํฌ-1)"),
+ PREVIEW("12์ %s์ผ์ ์ฐํ
์ฝ ์๋น์์ ๋ฐ์ ์ด๋ฒคํธ ํํ ๋ฏธ๋ฆฌ ๋ณด๊ธฐ!%n"),
+ ORD... | Java | ์ ๋ @ddrongy๋์ ์๊ฒฌ์ ๋์ํฉ๋๋ค!,๊ทธ๋ ๋ค๋ฉด 1์๋ก ๋ฐ๋์์๋, (2024๋
1์)
System Constraint๋ ์๋์ผ๋ก ๋ฐ๋๋๋ก(LocalDate..?) ์ค์ ํ๋ ๋ฐฉํฅ์ผ๋ก ์์ ๋ ํ์ํ ๊ฒ ๊ฐ์์! |
@@ -0,0 +1,76 @@
+package christmas.controller;
+
+import christmas.domain.Badge;
+import christmas.domain.Benefits;
+import christmas.domain.Convertor;
+import christmas.domain.Date;
+import christmas.domain.EventManager;
+import christmas.domain.Orders;
+import christmas.view.InputView;
+import christmas.view.OutputV... | Java | ๋ชจ๋ ๊ฒ์ฆ์ InputView์์ ๋ฐ๋๋ค๋ฉด ์น์ฐ๋ ๋ง์๋๋ก ํ๋๊ฒ ๋ง๋ค๊ณ ์๊ฐํฉ๋๋ค! ํ์ง๋ง ๋ ์ง๊ฐ 1 - 31์ผ ์ค ํ๋์ฌ์ผ ํ๋ค๋ ๊ฒ์ ๋ํ ๊ฒ์ฆ์ VIew๊ฐ ์๋๋ผ Domain ์์ ์ด๋ค์ง๊ธฐ ๋๋ฌธ์ ๊ฒฐ๊ณผ์ ์ผ๋ก View์ Domain ์์ชฝ์์ ๊ฒ์ฆ์ด ์ด๋ค์ ธ์ผ ํฉ๋๋ค. ๋ฐ๋ผ์ ์์ชฝ์ ํต๋ก ์ญํ ์ ํ๋ controller์์ ์งํํ๋ ๊ฒ์ด ๋ง๋ค๊ณ ํ๋จํ์ต๋๋ค~ |
@@ -0,0 +1,76 @@
+package christmas.controller;
+
+import christmas.domain.Badge;
+import christmas.domain.Benefits;
+import christmas.domain.Convertor;
+import christmas.domain.Date;
+import christmas.domain.EventManager;
+import christmas.domain.Orders;
+import christmas.view.InputView;
+import christmas.view.OutputV... | Java | e๋ผ๊ณ ์ฌ์ฉํ๋ ๊ฒ์ ์๋ฐ๋ฅผ ์ฌ์ฉํ๋ ์ฌ๋๋ค๋ผ๋ฆฌ์ ์ฝ์์ธ๊ฑฐ ๊ฐ์๋ฐ ์ด๋ถ๋ถ์ ํ๋ฒ ๋ํ๋ฅผ ๋๋ ๋ณด๋ฉด ์ข์๊ฑฐ ๊ฐ์ต๋๋ค! |
@@ -0,0 +1,76 @@
+package christmas.controller;
+
+import christmas.domain.Badge;
+import christmas.domain.Benefits;
+import christmas.domain.Convertor;
+import christmas.domain.Date;
+import christmas.domain.EventManager;
+import christmas.domain.Orders;
+import christmas.view.InputView;
+import christmas.view.OutputV... | Java | > ์ ์ฒด์ ์ผ๋ก create๋ผ๋ ๋ฉ์๋๋ช
์ ์ฌ์ฉํ๋๋ฐ create๊ฐ ๊ฐ์ฒด ์์ฑ์ ๋๋์ ์ฃผ๋๊ฑฐ๊ฐ์์ ๋ค๋ฅธ ์ด๋ฆ์ผ๋ก ๋ฉ์๋๋ช
์ ์์ฑํด๋ณด๋๊ฑด ์ด๋จ๊น์ ?
์ค์ ๋ก ํด๋น ๋ฉ์๋๊ฐ ๊ฐ์ฒด๋ฅผ ์์ฑํด์ ๋ฆฌํดํ๋ ๊ธฐ๋ฅ์ ํ๊ณ ์์ด์ create ๋ผ๊ณ ๋ช
๋ช
ํ๋๋ฐ ํน์ ๋ค๋ฅธ ์ข์ ์ด๋ฆ์ด ์์๊น์~? |
@@ -0,0 +1,24 @@
+package christmas.domain;
+
+public enum Badge {
+ STAR("๋ณ", 5_000),
+ TREE("ํธ๋ฆฌ", 10_000),
+ SANTA("์ฐํ", 20_000),
+ NONE("์์", 0);
+
+ private final String type;
+ private final int amount;
+
+ Badge(String type, int amount) {
+ this.type = type;
+ this.amount = amou... | Java | ์ธํ
๋ฆฌ์ ์ด ์๋ ์์ฑ๊ธฐ๋ฅ์ผ๋ก ๋ง๋ ๊ฑด๋ฐ ์ด ๋ถ๋ถ์ ๋ํด์๋ ์๊ฐํด๋ณด์ง ๋ชปํ๋ค์ ใ
ใ
private๋ก ์ง์ ํ๋๊ฒ ๋ง๋๊ฑฐ ๊ฐ์ต๋๋ค! |
@@ -0,0 +1,37 @@
+import CONSTANTS from '../constants/constants.js';
+import ERROR from '../constants/error.js';
+
+class NumbersValidator {
+ static validateNumbers(numbers) {
+ const validators = [
+ this.#validateEmpty,
+ this.#validateNegative,
+ this.#validateNaN,
+ this.#validateLength,
+ ... | JavaScript | ๊ฐ ๋งค์๋๋ค์ ๋ฐ๋ก ํธ์ถ์ํค์ง ์๊ณ ๋ฐฐ์ด์ ๋ง๋ค์ด์ forEach ๋ฉ์๋๋ก ํ๋์ฉ ํธ์ถ์ํจ ์ด์ ๊ฐ ๊ถ๊ธํด์! |
@@ -0,0 +1,20 @@
+import { Console } from '@woowacourse/mission-utils';
+import MESSAGE from '../constants/message.js';
+import NumbersValidator from '../validators/NumbersValidator.js';
+import RestartValidator from '../validators/RestartValidator.js';
+
+const InputView = {
+ async readNumbers() {
+ const numbers... | JavaScript | ๋ฐ์ดํฐ๋ฅผ ๋ฐ์ ์ถ๋ ฅํ๋ view์ ์ญํ ์ ์๊ฐํ์ ๋ ์ ํจ์ฑ ๊ฒ์ฌ๋จ๊ณ๊ฐ view์ ์๋๊ฒ ๋ง๋์ง ๊ถ๊ธ์ฆ์ด ๋๋๋ฐ ์ด๋ ๊ฒ ์์ฑํ์ ์ด์ ๊ฐ ๊ถ๊ธํฉ๋๋น :) |
@@ -0,0 +1,42 @@
+import CONSTANTS from '../constants/constants.js';
+import MESSAGE from '../constants/message.js';
+
+class Hint {
+ #numbers;
+
+ #computerNumbers;
+
+ constructor(numbers, computerNumbers) {
+ this.#numbers = numbers;
+ this.#computerNumbers = computerNumbers;
+ }
+
+ calculateStrikeCount... | JavaScript | ์ฒ์์ Hint ํด๋์ค๋ช
์ ์๋ฌธ์ด ๋ค์๋๋ฐ ๊ฒ์์ด๋๊น ์ผ๋ง๋ ๋ง์ท๋์ง ์๋ ค์ฃผ๋ ์ญํ ์ด๋ผ ์ ์ ํ ์ ์๊ฒ ๋ค์! ๐๐ป |
@@ -0,0 +1,20 @@
+import { Console } from '@woowacourse/mission-utils';
+import MESSAGE from '../constants/message.js';
+import NumbersValidator from '../validators/NumbersValidator.js';
+import RestartValidator from '../validators/RestartValidator.js';
+
+const InputView = {
+ async readNumbers() {
+ const numbers... | JavaScript | ์ด ๋ถ๋ถ์ ๋ํด์ ์ ๋ ๊ณ ๋ฏผ์ ๋ง์ด ํด๋ดค๋๋ฐ ํ๋ก ํธ(InputVIew)์ ๋ฐฑ์๋(model)์ ์ญํ ์ด ์๋ค๊ณ ๊ฐ์ ํ์ ๋, view์ model ๋ ๋ค ์ ํจ์ฑ ๊ฒ์ฌ๋ฅผ ์งํํ๋ ๊ฒ์ด ๋ง๋ค๊ณ ํ๋จํ์ฌ ์์ฑํ๊ฒ ๋์์ต๋๋ค. |
@@ -0,0 +1,37 @@
+import CONSTANTS from '../constants/constants.js';
+import ERROR from '../constants/error.js';
+
+class NumbersValidator {
+ static validateNumbers(numbers) {
+ const validators = [
+ this.#validateEmpty,
+ this.#validateNegative,
+ this.#validateNaN,
+ this.#validateLength,
+ ... | JavaScript | ์ ํจ์ฑ ๊ฒ์ฌ๋ฅผ ๋ชจ๋ ์ํํ๊ธฐ ์ํด์ ํ๋์ ๋ฉ์๋๋ฅผ ํธ์ถํจ์ผ๋ก์ ๊ฐ ์ ํจ์ฑ ๊ฒ์ฌ๊ฐ ์ํ๋๋๋ก ์์ฑํด๋ณด์์ต๋๋ค! |
@@ -0,0 +1,38 @@
+# ๊ธฐ๋ฅ ๊ตฌํ ์ฒดํฌ๋ฆฌ์คํธ
+
+## ๊ธฐ๋ฅ ๋ชฉ๋ก
+
+### ์ฌ์ฉ์์ ์
๋ ฅ
+
+- [x] ์ธ ์๋ฆฌ ์ซ์๋ฅผ ์
๋ ฅํ๋ค.
+ - [x] ์ซ์๊ฐ ์๋ ๊ฒฝ์ฐ ์์ธ ์ฒ๋ฆฌ (1 ~ 9) - ์ ๊ท ํํ์
+ - [x] ์ซ์๊ฐ 3๊ฐ๊ฐ ์๋ ๊ฒฝ์ฐ ์์ธ ์ฒ๋ฆฌ
+ - [x] ์ค๋ณต๋๋ ์ซ์๊ฐ ์กด์ฌํ๋ ๊ฒฝ์ฐ ์์ธ ์ฒ๋ฆฌ
+
+### ์ปดํจํฐ์ ์ ์์ฑ
+
+- [x] 3๊ฐ์ ์ซ์ ์์ฑ (์ง์ ๋ ๋ผ์ด๋ธ๋ฌ๋ฆฌ ์ด์ฉ)
+ - [x] ์ค๋ณต๋ ์ซ์๊ฐ ๋ฐ์ํ ๊ฒฝ์ฐ ์ฌ์์ฑ
+
+### ์ฌ์ฉ์๊ฐ ์
๋ ฅํ ์์ ์ปดํจํฐ๊ฐ ์์ฑํ ์ ๋น๊ต
+
+- [x] ๊ฐ ์๋ฆฌ ... | Unknown | ๋ฆฌ๋ทฐ ์์์ ์์ ๋ฆฌ๋๋ฏธ์ ๊ฐ ํด๋์ค๋ณ ์ญํ ์ ๋ํด ๊ธฐ์ฌํด์ฃผ์๋ฉด ์ฝ๋ ํ์
์ ๋ ๋์์ด ๋ ๊ฑฐ ๊ฐ์ต๋๋ค! |
@@ -0,0 +1,58 @@
+package baseball.controller;
+
+import baseball.domain.Computer;
+import baseball.domain.Referee;
+import baseball.domain.Result;
+import baseball.util.GameProgress;
+import baseball.view.InputView;
+import baseball.view.OutputView;
+import java.util.List;
+
+public class GameController {
+
+ priva... | Java | ํ๋ ์ด ๋ฉ์๋๊ฐ ๋จ์ํ playOrEnd๋ฅผ ํธ์ถํ๊ณ ์๋๋ฐ play๋ playOrEnd์ค ํ๋๋ฅผ ์์ ๊ณ ํฉ์ณ๋ ๋ ๊ฒ ๊ฐ์ต๋๋ค. |
@@ -0,0 +1,58 @@
+package baseball.controller;
+
+import baseball.domain.Computer;
+import baseball.domain.Referee;
+import baseball.domain.Result;
+import baseball.util.GameProgress;
+import baseball.view.InputView;
+import baseball.view.OutputView;
+import java.util.List;
+
+public class GameController {
+
+ priva... | Java | while์ ์กฐ๊ฑด๋ฌธ์ ๊ธ์ ๋ฌธ์ผ๋ก ํ๋ ๊ฒ์ด ๊ฐ๋
์ฑ์ ๋ ๋์์ด ๋๋ค๊ณ ํ๋๋ผ๊ตฌ์.
```suggestion
while (GameProgress.isRetry(gameProgress)) {
```
์ด๋ ๊ฒ ๋ฐ๊ฟ๋ณด์๋ ๊ฒ๋ ํ๋ฒ ์ ์๋๋ ค๋ด
๋๋ค! |
@@ -0,0 +1,23 @@
+package baseball.domain;
+
+import camp.nextstep.edu.missionutils.Randoms;
+import java.util.ArrayList;
+import java.util.List;
+
+public class Computer {
+
+ private static final int NUMBERS_LENGTH = 3;
+ private static final int START_RANGE_NUMBER = 1;
+ private static final int END_RANGE_N... | Java | ์ ์ ๋ฉ์๋๋ฅผ ์ ์ธํ์ ๊ธฐ์ค์ ์ดํด๋ณด๋ฉด Computer๋ ์ ํธ ๊ธฐ๋ฅ + ์ํ๊ฐ์ ๊ฐ์ง์ง ์๊ธฐ ๋๋ฌธ์ ์ ์ ๋ฉ์๋๋ก ์ ์ธํด๋ ๋๋ค๊ณ ์๊ฐํ๋๋ฐ ์ด๋ ์ ๊ฐ์? |
@@ -0,0 +1,17 @@
+package baseball.domain;
+
+import java.util.List;
+
+public class Referee {
+
+ public Result judge(List<Integer> userNumbers, List<Integer> computerNumbers) {
+ Result result = new Result();
+ for (int i = 0; i < userNumbers.size(); i++) {
+ if (result.isStrike(userNumber... | Java | ์ปดํจํฐ์ ๋ง์ฐฌ๊ฐ์ง๋ก ๋ ํผ๋ฆฌ๋ ์ ์ ๋ฉ์๋๋ก ์ ์ธํด๋ ๊ด์ฐฎ์ง ์์๊น ํ๋ ์๊ฐ์
๋๋ค! |
@@ -0,0 +1,19 @@
+package baseball.util;
+
+public enum GameProgress {
+
+ START, RETRY, QUIT;
+
+ private static final int RETRY_NUMBER = 1;
+
+ public static boolean isQuit(GameProgress gameProgress) {
+ return gameProgress == QUIT;
+ }
+
+ public static GameProgress judgeEnd(int number) {
+ ... | Java | ํ๋ก๊ทธ๋จ์ ํ์ฅ์ฑ์ ๊ณ ๋ คํ์
์ enum์ผ๋ก ๋ง๋์ ๊ฑฐ ๋ง์ผ์ค๊น์? ์ ๋ ์ฒ์์ ์ข
๋ฃ ๋ฉ๋ด๋ฅผ enum์ผ๋ก ๋ง๋๋ ค๊ณ ํ๋ค๊ฐ ๊ฒฝ์ฐ์ ์๊ฐ 2๊ฐ์ง์ฌ์ class๋ก ๋ง๋ค์์ต๋๋ค. ๋ง์ฝ ๊ฒฝ์ฐ์ ์๊ฐ ๋ ๋ง์๋ค๋ฉด ์ ๋ enum์ผ๋ก ๋ง๋ค์์ ๊ฒ ๊ฐ๋ค์! |
@@ -0,0 +1,19 @@
+package baseball.util;
+
+public enum GameProgress {
+
+ START, RETRY, QUIT;
+
+ private static final int RETRY_NUMBER = 1;
+
+ public static boolean isQuit(GameProgress gameProgress) {
+ return gameProgress == QUIT;
+ }
+
+ public static GameProgress judgeEnd(int number) {
+ ... | Java | ๋ฐ๋ก ์์๋ฅผ ์ ์ธํ์๊ธฐ ๋ณด๋ค RETRY(1), QUIT(2); ์ด๋ฐ ์์ผ๋ก ๊ฐ์ ์ง์ ํด์ฃผ์๋๊ฑด ์ด๋ ์ ์ง ์ ์๋๋ ค๋ด
๋๋ค! |
@@ -0,0 +1,34 @@
+package baseball.view;
+
+import baseball.util.Validator;
+import camp.nextstep.edu.missionutils.Console;
+import java.util.List;
+import java.util.stream.Collectors;
+import java.util.stream.Stream;
+
+public class InputView {
+
+ public static final String DELIMITER = "";
+
+ public static Lis... | Java | view๊ฐ inputd์ domain์์ ์ฌ์ฉ๋ ํํ๋ก ๊ฐ๊ณตํด์ ๋๊ฒจ์ฃผ๋ ๊ฒ์ด ๋ง๋ ๊ฑธ๊น์??? ์ ๋ ํ๋ฆฌ์ฝ์ค๋ฅผ ํ๋ฉด์ ํญ์ ์๊ตฌ์ฌ ๊ฐ์ ธ์๋ ๋ถ๋ถ์ด๋ผ์ ๋ ์ด์ฑ์นด ๋ค์ ๋ง๋ค๊ธฐ์์๋ ์๋ํ์ ๋ํ String ๊ฐ์ผ๋ก๋ง ๋๊ฒจ์คฌ์๋๋ฐ์. ์ด ๋ถ๋ถ ๋ชฉ์์ผ์ ๊ผญ ์๊ธฐ ๋๋ ๋ดค์ผ๋ฉด ์ข๊ฒ ์ต๋๋ค! |
@@ -0,0 +1,65 @@
+package baseball.domain;
+
+import java.util.List;
+
+public class Result {
+
+ private static final int DEFAULT_NUMBER = 0;
+ private static final int END_NUMBER = 3;
+
+ private int ball;
+ private int strike;
+
+ public Result() {
+ this.ball = DEFAULT_NUMBER;
+ this.st... | Java | ํด๋น ์ถ๋ ฅ์ ๋ํ ์ฑ
์์ OutputView์ ๋๊ฒจ์ฃผ์๋๊ฑด ์ด๋ ์ ๊ฐ์? |
@@ -0,0 +1,32 @@
+package baseball.util;
+
+import java.util.List;
+import java.util.regex.Pattern;
+
+public class Validator {
+
+ private static final String DUPLICATION_MESSAGE = "์ค๋ณต๋ ์ซ์๊ฐ ์กด์ฌํฉ๋๋ค. ๋ค์ ์
๋ ฅํด์ฃผ์ธ์.";
+ private static final String NUMBERS_PATTERN_MESSAGE = "1๋ถํฐ 9๊น์ง์ ์ซ์ ์ค 3๊ฐ์ง ์ซ์๋ฅผ ์
๋ ฅํด์ฃผ์ธ์.";
+ private s... | Java | ์ ๊ท์ ํํ์ด ๋งค์ฐ ๊น๋ํ๋ค์! ๋ฐฐ์ฐ๊ณ ๊ฐ๋๋ค. |
@@ -0,0 +1,58 @@
+package baseball.controller;
+
+import baseball.domain.Computer;
+import baseball.domain.Referee;
+import baseball.domain.Result;
+import baseball.util.GameProgress;
+import baseball.view.InputView;
+import baseball.view.OutputView;
+import java.util.List;
+
+public class GameController {
+
+ priva... | Java | ํจ์๋ช
์ ThreeStrike์ฒ๋ผ ์ฐ์น ์กฐ๊ฑด์ ๋ํด ์ง์ ์ ์ผ๋ก ๋ํ๋ด๋ ๊ฒ๋ณด๋ค playUntilWin ๊ฐ์ ๋ฐฉ์์ผ๋ก ์์ฑํ๋๊ฑด ์ด๋จ๊น์?? |
@@ -0,0 +1,65 @@
+package baseball.domain;
+
+import java.util.List;
+
+public class Result {
+
+ private static final int DEFAULT_NUMBER = 0;
+ private static final int END_NUMBER = 3;
+
+ private int ball;
+ private int strike;
+
+ public Result() {
+ this.ball = DEFAULT_NUMBER;
+ this.st... | Java | isStrike์ ํต์ผํ์ฌ isBall๋ก ์ํ ์ด์ ๊ฐ ๋ฐ๋ก ์๋์ !? |
@@ -0,0 +1,65 @@
+package baseball.domain;
+
+import java.util.List;
+
+public class Result {
+
+ private static final int DEFAULT_NUMBER = 0;
+ private static final int END_NUMBER = 3;
+
+ private int ball;
+ private int strike;
+
+ public Result() {
+ this.ball = DEFAULT_NUMBER;
+ this.st... | Java | ์ค .. ์ด๋ฐฉ์์ผ๋ก ํ๋๊ฑฐ ์ข์๊ฑฐ ๊ฐ๋ค์
๊ทผ๋ฐ ์๋ ์กฐ๊ฑด์๋ else if ๋ก ๋ํ๋ด๋ ์ข์๊ฑฐ๊ฐ์์ ! |
@@ -29,7 +29,7 @@ public void initialize() {
beanFactory.initialize();
}
- public Collection<Object> controllers() {
+ public Collection<Object> getControllers() {
return beanFactory.beansAnnotatedWith(Controller.class);
}
} | Java | ํผ๋๋ฐฑ ๋ฐ์ ์ ํด์ฃผ์
จ๋ค์ ๐ |
@@ -1,6 +1,5 @@
package next.controller;
-import core.annotation.Inject;
import core.annotation.web.Controller;
import core.annotation.web.RequestMapping;
import core.annotation.web.RequestMethod;
@@ -22,14 +21,8 @@
public class ApiQnaController extends AbstractNewController {
private static final Logger lo... | Java | BeanFactory, getInstantiateSingletons NPE ๋ฐ์ ๋ฌธ์ ๋ก getInstance() ํธ์ถ๋ก ์์ ํ์ ๊ฑฐ ๋ง์๊น์?
์์ธ์ด ๋ฌด์์ด์๋์?
์ด์ ์ฝ๋(์์ฑ์ inject) ๋ฐฉ์์ผ๋ก ๋ฌธ์ ๋ฅผ ํด๊ฒฐํด๋ณด๋ฉด ์ข์ ๊ฒ ๊ฐ์์.
MyConfiguration ํด๋์ค์์ ๋ฑ๋กํ DataSource๋ ๋น์ผ๋ก ๋ฑ๋กํ์ผ๋ JdbcTemplate์์ ์ฌ์ฉํด๋ณด๋ฉด ์ข์ ๊ฒ ๊ฐ๊ตฌ์! |
@@ -0,0 +1,37 @@
+import { Suspense, useState } from "react";
+import { useSearchParams } from "react-router-dom";
+
+import { InputSection } from "./components/InputSection";
+import { ListSection } from "./components/ListSection/ListSection";
+
+export const SearchPage = () => {
+ const [, setSearchParams] = useSear... | Unknown | url์ ์ฟผ๋ฆฌ ํ๋ผ๋ฏธํฐ๋ฅผ ์ด์ฉํด ๊ฒ์์ด ํค์๋๋ฅผ ๊ด๋ฆฌํ๋๋ก ์ค์ ํ ๊ฒ์, url์ ์ ๋ฌํ๋ฉฐ ๊ฒ์ ๊ฒฐ๊ณผ๋ ํจ๊ป ์ ๋ฌํ ์ ์๋๋ก ํ๊ธฐ ์ํจ์ด์์. ๊ทธ๋ฐ๋ฐ ํ์ฌ๋ ์ฟผ๋ฆฌ ํ๋ผ๋ฏธํฐ๋ฅผ ๊ฒ์์ด์ ๊ธฐ๋ณธ๊ฐ์ผ๋ก ๋ด๋ ค๋ฐ์ง ๋ชปํ๋ ๋ฌธ์ ๊ฐ ๋ฐ์ํ์ด์.
TODO: ์์นํ๋ผ๋ฏธํฐ ๊ฐ์ ํค์๋ ์ด๊ธฐ๊ฐ์ผ๋ก ์ค์
```suggestion
const [searchParams, setSearchParams] = useSearchParams();
const [keyword, setKeyword] = useState<string>(searchParams.get("keyword")... |
@@ -0,0 +1,30 @@
+import { useLazyLoadQuery } from "react-relay";
+import { useSearchParams } from "react-router-dom";
+
+import { graphql } from "relay-runtime";
+
+import { ListSectionRepositorySearchQuery } from "./__generated__/ListSectionRepositorySearchQuery.graphql";
+
+import { RepositoryPagination } from "./Re... | Unknown | TODO: List Section ๋ด์์ ํค์๋๋ฅผ ์ง์ ๊ฐ์ ธ์ค์ง ๋ง๊ณ , Search Page์์ props๋ก ํค์๋๋ฅผ ์ฃผ์
๋ฐ๋๋ก ๋ณ๊ฒฝ |
@@ -0,0 +1,87 @@
+import { graphql, useFragment, useMutation } from "react-relay";
+
+import { RepositoryItem_repository$key } from "./__generated__/RepositoryItem_repository.graphql";
+import { RepositoryItemAddStarMutation } from "./__generated__/RepositoryItemAddStarMutation.graphql";
+import { RepositoryItemRemoveS... | Unknown | TODO: add, remove์ ๋ํ ๋ณ์๊ฐ์ StarButton ๋ด์์ ๋๊ฒจ๋ฐ๋๋ก ๋ณ๊ฒฝ |
@@ -0,0 +1,19 @@
+import { ShoppingCartIcon } from "../../assets";
+import { BaseButton } from "./BaseButton";
+import { StyledCartButtonImg, StyledCartCount, StyledContainer } from "./CartButton.styled";
+
+interface CartButtonProps {
+ quantity: number;
+ onClick: () => void;
+}
+
+export const CartButton = ({ quan... | Unknown | ์ ํ๋ฆฌ์ผ์ด์
์ด ์ฒ์ ์คํ๋์ ๋ fetchํ ์ดํ์๋, ๋ด๊ธฐ/๋นผ๊ธฐ ๋ฒํผ์ ๋๋ฌ๋ productCount๊ฐ ๋ณ๊ฒฝ๋์ง ์๊ธฐ ๋๋ฌธ์ ์ค์๊ฐ์ผ๋ก ๊ฐ์๋ฅผ ์
๋ฐ์ดํธํ์ง ๋ชปํ๋ ๊ฒ์ผ๋ก ์ดํดํ์ด์. prop์ผ๋ก `productCount`๊ฐ๊ณผ `updateProductCount` ํจ์๋ฅผ ๋ง๋ค์ด CartActionButton๋ก ๋๊ฒจ์ฃผ๊ณ , CartActionButton์์๋ action์ด ์ผ์ด๋๋ฉด `updateProductCount`์ ๋ฐ๋ ๊ฐ์๋ฅผ CartButton์ผ๋ก ์ ๋ฌํ๋ฉด ์
๋ฐ์ดํธํ ์ ์์ ๊ฒ ๊ฐ์์!๐ |
@@ -0,0 +1,86 @@
+package nextstep.subway.application;
+
+import java.util.List;
+import java.util.NoSuchElementException;
+import java.util.Optional;
+import java.util.stream.Collectors;
+import nextstep.subway.domain.Line;
+import nextstep.subway.domain.LineRepository;
+import nextstep.subway.domain.Station;
+import ... | Java | deleteById ๊ตฌํ์ฒด๋ฅผ ๋ณด์๋ฉด ์กฐํ ํ์ ๊ฐ์ด ์์ ๊ฒฝ์ฐ์๋ง ์ญ์ ํ๊ณ ์์ต๋๋ค.
์ด๋ฐ ๋ถ๋ถ๋ค์ ์ ํ๋ฆฌ์ผ์ด์
์์ ์ง์ ์์ฑํ๊ธฐ๋ณด๋ค๋ Infrastructre layer์์ ๋ด๋นํ๋ ๊ฒ์ด ์ข๋ค๊ณ ์๊ฐํ๋๋ฐ
์ด๋ป๊ฒ ์๊ฐํ์๋์?
```java
@Transactional
@Override
public void deleteById(ID id) {
Assert.notNull(id, ID_MUST_NOT_BE_NULL);
delete(findById(id).orElseThrow(() -> new EmptyResultDataAccessEx... |
@@ -0,0 +1,86 @@
+package nextstep.subway.application;
+
+import java.util.List;
+import java.util.NoSuchElementException;
+import java.util.Optional;
+import java.util.stream.Collectors;
+import nextstep.subway.domain.Line;
+import nextstep.subway.domain.LineRepository;
+import nextstep.subway.domain.Station;
+import ... | Java | ๋ฉ์๋ ๋ณ์๋ก ํ ๋นํ์ ์ด์ ๊ฐ ์์ผ์ ๊ฐ์?
``` java
findAll().stream()
.map(LineResponse::of)
.collect(Collectors.toList());
``` |
@@ -1,16 +1,35 @@
package nextstep.subway.domain;
-import javax.persistence.*;
+import java.util.Objects;
+import javax.persistence.Column;
+import javax.persistence.Entity;
+import javax.persistence.GeneratedValue;
+import javax.persistence.GenerationType;
+import javax.persistence.Id;
+import javax.persistence.Joi... | Java | ์ญ์ด Line์ ๊ฐ์ง๋๊ฒ ๋ง์๊น์?
ํ๋์ ์ญ์ด ์ฌ๋ฌ ๋
ธ์ ์ ์ํ๋ฉด ์ด๋ป๊ฒ ๋๋์.
์๋ฅผ ๋ค์ด ๊ฐ๋จ์ญ์ 2ํธ์ ๊ณผ ์ ๋ถ๋น์ ๋๊ฐ์ง๊ฐ ์์ด์. |
@@ -0,0 +1,156 @@
+package nextstep.subway.acceptance;
+
+import static org.assertj.core.api.Assertions.assertThat;
+
+import io.restassured.RestAssured;
+import io.restassured.response.ExtractableResponse;
+import io.restassured.response.Response;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Ma... | Java | ๋
ธ์ ์์ฑ ์ ์ํ์ข
์ ์ญ๊ณผ ํํ์ข
์ ์ญ์ ๋ฑ๋กํฉ๋๋ค.
๋ฐ๋ผ์ ์ด๋ฒ ๋จ๊ณ์์๋ ์งํ์ฒ ๋
ธ์ ์ ์ญ์ ๋งตํํ๋ ๊ธฐ๋ฅ์ ์์ง ์์ง๋ง ๋
ธ์ ์กฐํ์ ํฌํจ๋ ์ญ ๋ชฉ๋ก์ด ํจ๊ป ์๋ต๋ฉ๋๋ค.
statusCode ์ฝ๋ ๋ฟ๋ง ์๋๋ผ ์ค์ ์๋ต์๋ํด์ ํ
์คํธ ํ ์ ์์ผ๋ฉด ์ข์๊ฒ ๊ฐ์์. |
@@ -0,0 +1,156 @@
+package nextstep.subway.acceptance;
+
+import static org.assertj.core.api.Assertions.assertThat;
+
+import io.restassured.RestAssured;
+import io.restassured.response.ExtractableResponse;
+import io.restassured.response.Response;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Ma... | Java | ์ฑํ ํฝ์ค์ฒ ๋ฐ ๋ฐ์ดํฐ ์ง์ ์ญ์ ํด์ฃผ์
จ์ด์.
๋ค๋ง ์์ฑํด์ผ ํ ๋ฐ์ดํฐ๊ฐ ๋ง๊ฑฐ๋, ์ฐ๊ด ๊ด๊ณ ๋งตํ์ด ์์ผ๋ฉด ์ด๋ป๊ฒ ๋ ์ง ๊ณ ๋ฏผํด๋ณด์๋ฉด ์ข์ ๊ฒ๊ฐ์์. |
@@ -0,0 +1,156 @@
+package nextstep.subway.acceptance;
+
+import static org.assertj.core.api.Assertions.assertThat;
+
+import io.restassured.RestAssured;
+import io.restassured.response.ExtractableResponse;
+import io.restassured.response.Response;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Ma... | Java | ๋
ธ์ ์์ฑ ์ ์ํ์ข
์ ์ญ๊ณผ ํํ์ข
์ ์ญ์ ๋ฑ๋กํฉ๋๋ค.
ํด๋น ์๊ตฌ์ฌํญ์ด ๊ตฌํ๋์ง ์์ ๊ฒ ๊ฐ์์. |
@@ -0,0 +1,86 @@
+package nextstep.subway.application;
+
+import java.util.List;
+import java.util.NoSuchElementException;
+import java.util.Optional;
+import java.util.stream.Collectors;
+import nextstep.subway.domain.Line;
+import nextstep.subway.domain.LineRepository;
+import nextstep.subway.domain.Station;
+import ... | Java | id๋ก ๋ผ์ธ์ ์ฐพ์ ์ฐ๊ด๊ด๊ณ๋ฅผ ์ ๊ฑฐํ๋ ๋ก์ง์ ๋ฃ๊ณ ์ ํ๋๋ฐ์,
๋ผ์ธ์ด ์์ ๊ฒฝ์ฐ์๋ง ์ฒ๋ฆฌํ๋ ค๋ค ๋ณด๋ ๋ฐฉ์ด์ฝ๋ ์ฐจ์์ผ๋ก ๋ฃ์์ต๋๋ค.
์ด ๊ฒฝ์ฐ์๋ deleteById ๋ณด๋ค๋ delete ๋ฉ์๋๊ฐ ๋ ์ ํฉํด ๋ณด์ด๋ค์. ๊ฐ์ฌํฉ๋๋ค! |
@@ -0,0 +1,86 @@
+package nextstep.subway.application;
+
+import java.util.List;
+import java.util.NoSuchElementException;
+import java.util.Optional;
+import java.util.stream.Collectors;
+import nextstep.subway.domain.Line;
+import nextstep.subway.domain.LineRepository;
+import nextstep.subway.domain.Station;
+import ... | Java | ๋ฆฌํฉํ ๋ง ๋จ๊ณ์์ ๋ฏธ์ฒ ์์ ํ์ง ๋ชปํ ๊ฒ ๊ฐ์ต๋๋ค... |
@@ -0,0 +1,31 @@
+package christmas.model.badge.enums;
+
+import java.util.Arrays;
+
+public enum BadgeInfo {
+
+ SANTA_BADGE("์ฐํ", 20_000),
+ TREE_BADGE("ํธ๋ฆฌ", 10_000),
+ START_BADGE("๋ณ", 5_000),
+ NON_BADGE("์์", 0);
+
+ private final String name;
+
+ private final int price;
+
+ BadgeInfo(String ... | Java | ์ค์๋ฅผ ๋ฏธ์
์ด ๋๋๊ณ ๋ฐ๊ฒฌํ์ต๋๋ค ^^..
START -> STAR |
@@ -0,0 +1,32 @@
+package christmas.model.discount;
+
+
+import static christmas.exception.ErrorType.INVALID_ORDER_AMOUNT;
+import static christmas.model.discount.enums.DiscountAmount.CAN_GIVEAWAY_DISCOUNT;
+import static christmas.model.discount.enums.DiscountAmount.NON_DISCOUNT;
+
+import christmas.model.order.enums.... | Java | ์ค์๋ฅผ ๋ฏธ์
์ด ๋๋๊ณ ๋ฐ๊ฒฌํ์ต๋๋ค ^^..
ํ์คํ -> ์ดํ์ธ (๊ฐ๊ฒฉ์ด ๋๊ฐ์์ ๋์น์ฑ์ง ๋ชปํ๋ค์ (__)) |
@@ -0,0 +1,61 @@
+package christmas.model.order.enums;
+
+import static christmas.exception.ErrorType.INVALID_MENU_NOT_EXIST;
+
+import java.util.Arrays;
+
+public enum MenuInfo {
+
+ MUSHROOM_SOUP("์์ก์ด์ํ", 6_000, Category.APPETIZER),
+ TAPAS("ํํ์ค", 5_500, Category.APPETIZER),
+ CAESAR_SALAD("์์ ์๋ฌ๋", 8_000, Ca... | Java | ๋ฉ๋ด ์ข
๋ฅ๋ณ ์ฃผ๋ฌธ ์๋์ ์ ์ฅํ๋ Map์ ๋ง๋๋ ๋ฉ์๋๊ฐ ์์ด๋ ์ข์ ๊ฒ ๊ฐ์ต๋๋ค. |
@@ -0,0 +1,54 @@
+package christmas.model.calendar;
+
+import static christmas.model.calendar.enums.CalendarDate.CHRISTMAS;
+import static christmas.model.calendar.enums.CalendarDate.EVENT_MONTH;
+import static christmas.model.calendar.enums.CalendarDate.EVENT_YEAR;
+import static christmas.model.calendar.enums.Calenda... | Java | `DayOfWeek`๋ `enum` ํ์
์ด๊ธฐ์ ๋ค์๊ณผ ๊ฐ์ด ์ง์ ์ ์ธ ๋๋ฑ์ฑ ๋น๊ต๋ ๊ฐ๋ฅํ๋ฉฐ, ์ด ๊ฒฝ์ฐ๊ฐ ๊ฐ๋
์ฑ๋ ๋ ์ข์์ง ๊ฒ ๊ฐ์ต๋๋ค!
```suggestion
DayOfWeek week = eventDate.getDayOfWeek();
return week == DayOfWeek.FRIDAY || week == DayOfWeek.SATURDAY;
``` |
@@ -0,0 +1,14 @@
+package christmas.model.calendar;
+
+import static christmas.model.calendar.enums.CalendarDate.CHRISTMAS;
+
+public class CalendarFactory {
+
+ public static Calendar createCalendar(int day) {
+ if (day <= CHRISTMAS.getNumber()) {
+ return new ChristmasEventCalendar(day);
+ ... | Java | ์ํ, ์
๋ ฅ ๋ ์ง๊ฐ ํฌ๋ฆฌ์ค๋ง์ค ์ดํ์ธ์ง์ ์ฌ๋ถ์ ๋ฐ๋ผ ๊ฐ๊ฐ ๋ค๋ฅธ `Calendar` ํด๋์ค๋ฅผ ์ฌ์ฉํ๋๋ก ํ์
จ๋ค์.
์ด๋ ๊ฒ๋ ๊ตฌํ์ ํ ์ ์์๊ตฐ์! |
@@ -0,0 +1,31 @@
+package christmas.model.badge.enums;
+
+import java.util.Arrays;
+
+public enum BadgeInfo {
+
+ SANTA_BADGE("์ฐํ", 20_000),
+ TREE_BADGE("ํธ๋ฆฌ", 10_000),
+ START_BADGE("๋ณ", 5_000),
+ NON_BADGE("์์", 0);
+
+ private final String name;
+
+ private final int price;
+
+ BadgeInfo(String ... | Java | ๋ฑ์ง๋ฅผ ์ป์ ์ ์๋ ํํ๊ฐ ๊ธ์ก๋ง ์ค์ ํด ๋๊ณ , `enum`์ ์์๋ฅผ ํ์ฉํ์
จ๋ค์!
`enum`์ ์์์ ์ํฅ์ ๋ฐ๋ ๋ก์ง์ ์์ฑํ๋ ๊ฒ์ด ์ณ์๊ฐ ์ ๋ํ ํ์ ์ด ์์ด ์ด๋ ๊ฒ ๊ตฌํํ์ง ๋ชปํ๋๋ฐ, ์ด๋ ๊ฒ ๊ตฌํํ๋ ๊ฒ์ด ํจ์ฌ ๊ฐ๊ฒฐํ๊ณ ์ข์์ ๊ฒ๋ ๊ฐ๊ตฐ์! |
@@ -0,0 +1,20 @@
+package christmas.model.badge;
+
+import christmas.model.badge.enums.BadgeInfo;
+
+public class Badge {
+
+ private final BadgeInfo badgeInfo;
+
+ public Badge(int totalDiscountAmount) {
+ this.badgeInfo = selectBadge(totalDiscountAmount);
+ }
+
+ public String getBadgeName() {
+ ... | Java | ํด๋น ํด๋์ค๋ ์ด๋ป๊ฒ ๋ณด๋ฉด `BadgeInfo`๋ฅผ ๋ํํ๊ณ ์๋ ๋ํ ํด๋์ค์ฒ๋ผ ๋ณด์ด๋๋ฐ์.
์ด ํด๋์ค๋ฅผ ์ฌ์ฉํ๋ ๊ฒ์๋ ์ด๋ค ์ด์ ์ด ์์ ์ ์์๊น์? |
@@ -0,0 +1,15 @@
+package christmas.model.order.enums;
+
+public enum Category {
+
+ APPETIZER("์ํผํ์ด์ "),
+ MAIN_COURSE("๋ฉ์ธ"),
+ DESSERT("๋์ ํธ"),
+ BEVERAGE("์๋ฃ");
+
+ private final String category;
+
+ Category(String category) {
+ this.category = category;
+ }
+} | Java | ํด๋น ํ๋๋ ํ์ฅ์ฑ์ ์ํ ํ๋์ธ๊ฐ์? |
@@ -0,0 +1,51 @@
+package christmas.model.order;
+
+import static christmas.exception.ErrorType.INVALID_MENU_NAME;
+
+import christmas.model.order.enums.Category;
+import christmas.model.order.enums.MenuInfo;
+import java.util.Collections;
+import java.util.HashMap;
+import java.util.Map;
+
+public class OrderMenu {
+
... | Java | ์ด๋ฆ์ `MainMenu`๋ฅผ ํฌํจํ๋์ง๋ฅผ ํ๋จํ๋ ๋ฉ์๋์ฒ๋ผ ๋๊ปด์ง๋๋ฐ, ์๋์ ๋ก์ง์ ์
๋ ฅ๋ฐ์ ๋ฉ๋ด๊ฐ ๋ฉ์ธ๋ฉ๋ด์ธ์ง๋ฅผ ํ๋จํ๋ค์.
`contain~`๋ณด๋ค `is~`์ ๋ค์ด๋ฐ์ด ์กฐ๊ธ ๋ ์ ์ ํ ์ ์์ ๊ฒ ๊ฐ์ต๋๋ค! |
@@ -0,0 +1,64 @@
+package christmas.model.result;
+
+import static christmas.model.discount.enums.DiscountAmount.NON_DISCOUNT;
+
+public class DiscountResult {
+
+ private int christmasDiscount;
+
+ private int weeksDaysDiscount;
+
+ private int weekendDiscount;
+
+ private int specialDiscount;
+
+ priva... | Java | ์ํ, ์ฒ์์ ๋ชจ๋ ํ ์ธ ์ ์ฉ์ 0์ผ๋ก ๋๊ณ ํ ์ธ์ ์ ์ฉํ ์ ์์ ๋ ๋ด๋ถ์ ๊ฐ๋ค์ ์๋ก ์
๋ฐ์ดํธ ํด์ฃผ๋๊ตฐ์!
์ ์๋ ๋ค๋ฅธ ์ ๊ทผ์ด๋ผ์ ์ ๋ง ์ฌ๋ฏธ์๊ฒ ์ฝ์์ต๋๋ค! |
@@ -0,0 +1,81 @@
+package christmas.model.order;
+
+import static christmas.exception.ErrorType.INVALID_MAX_MENU_QUANTITY;
+import static christmas.exception.ErrorType.INVALID_MENU_ONLY_DRINK;
+import static christmas.utils.Constants.MAX_ORDER_QUANTITY;
+import static christmas.utils.Constants.MIN_ORDER_MENU;
+
+import... | Java | ์ด ์ฝ๋์ ํ๋ฆ์ ์ดํดํด ๋ณด๊ณ ์ ์ ๋ง ์ด์ฌํ ๋
ธ๋ ฅํ๋๋ฐ ์คํจํ์ต๋๋ค...ใ
ใ
์ฃผ๋ฌธ ๋ชฉ๋ก์ ์ฒซ ๋ฒ์งธ ๋ฉ๋ด๋ง ์นดํ
๊ณ ๋ฆฌ๋ฅผ ํ์ธํ๋ ๊ฒ์ผ๋ก ํด์์ ํ๋๋ฐ ์ด๊ฒ ์ด๋ป๊ฒ ์๋ฃ๋ง ์ฃผ๋ฌธํ ๊ฒฝ์ฐ๋ฅผ ํ๋ณํ ์ ์๋ ์ง ๋ชจ๋ฅด๊ฒ ์ด์...
๊ด์ฐฎ์ผ์๋ค๋ฉด ํธํ์ค ๋ ์ค๋ช
ํ๋ฒ๋ง ๋ถํ๋๋ฆฝ๋๋ค..! |
@@ -0,0 +1,30 @@
+package christmas.model.calendar;
+
+import static christmas.exception.ErrorType.INVALID_DAY_OUT_OF_RANGE;
+import static christmas.model.calendar.enums.CalendarDate.CHRISTMAS;
+import static christmas.model.calendar.enums.CalendarDate.EVENT_MONTH;
+import static christmas.model.calendar.enums.Calenda... | Java | ์กฐ๊ฑด๋ฌธ์ด ๊ธธ์ด์ง๋ค๋ฉด ๋ฉ์๋๋ก ๋ฐ๋ก ๋นผ๋๋ ๊ฒ๋ ์ข์ ๊ฒ ๊ฐ์์! |
@@ -0,0 +1,20 @@
+package christmas.model.badge;
+
+import christmas.model.badge.enums.BadgeInfo;
+
+public class Badge {
+
+ private final BadgeInfo badgeInfo;
+
+ public Badge(int totalDiscountAmount) {
+ this.badgeInfo = selectBadge(totalDiscountAmount);
+ }
+
+ public String getBadgeName() {
+ ... | Java | ์ ๋ ๊ฐ์ ์๊ฒฌ์
๋๋ค !
`Badge` ํด๋์ค์์ ์ด๋ค์ง๋ ๋ชจ๋ ๋ก์ง์ `BadgeInfo`์์๋ ๋์ผํ๊ธฐ ์ํํ ์ ์๊ณ
๊ทธ๋ ๊ฒ ํ๋ค๋ฉด ํด๋์ค ๋ช
์ Info ๋ฅผ ์ถ๊ฐํ์ง ์์๋ ๋ผ์ ๋์ฑ ๊น๋ํ ์ฝ๋๊ฐ ๋ ๊ฒ ๊ฐ์์ ! |
@@ -0,0 +1,54 @@
+package christmas.model.calendar;
+
+import static christmas.model.calendar.enums.CalendarDate.CHRISTMAS;
+import static christmas.model.calendar.enums.CalendarDate.EVENT_MONTH;
+import static christmas.model.calendar.enums.CalendarDate.EVENT_YEAR;
+import static christmas.model.calendar.enums.Calenda... | Java | LocalDate๋ฅผ ํ์ฉํ๋ ๋ฐฉ๋ฒ๋ ์์๊ตฐ์ ..!
๋ ๋ค์ํญ ํ์ฉ์ ํ ์ ์์ ๊ฒ ๊ฐ์์! |
@@ -0,0 +1,45 @@
+package christmas.model.discount;
+
+import static christmas.model.discount.enums.DiscountAmount.DESERT_DISCOUNT;
+import static christmas.model.discount.enums.DiscountAmount.NON_DISCOUNT;
+import static christmas.utils.Constants.MIN_ORDER_MENU;
+
+import christmas.model.calendar.Calendar;
+import chr... | Java | `orderDetail.getDesertMenu()` ์์ ๋์ ํธ ๋ฉ๋ด๊ฐ ์๋ค๋ฉด ๋น ์ปฌ๋ ์
์ด ๋ฐํ๋๊ธฐ ๋๋ฌธ์
์ด ๊ฒ์ฆ ๋ก์ง์ด ์์ด๋ ๊ด์ฐฎ์ง ์์๊น? ๋ผ๋ ์๊ฐ์ด ๋ค์ด์! |
@@ -0,0 +1,45 @@
+package christmas.model.discount;
+
+import static christmas.model.discount.enums.DiscountAmount.MAIN_COURSE_DISCOUNT;
+import static christmas.model.discount.enums.DiscountAmount.NON_DISCOUNT;
+import static christmas.utils.Constants.MIN_ORDER_MENU;
+
+import christmas.model.calendar.Calendar;
+impor... | Java | ~~~java
mainMenus.strem()
.mapToInt(menu -> orderDetail.getQuantityByMenu(menuName))
.sum()
~~~
๊ณผ ๊ฐ์ด ์คํธ๋ฆผ์ ํ์ฉํด ๋ณด๋ ๊ฒ๋ ์ข์๋ณด์ฌ์! |
@@ -0,0 +1,83 @@
+package christmas.model.discount.facade;
+
+import static christmas.model.discount.enums.DiscountAmount.CAN_DISCOUNT_AMOUNT;
+import static christmas.model.discount.enums.DiscountAmount.NON_DISCOUNT;
+
+import christmas.model.discount.GiveawayDiscount;
+import christmas.model.result.DiscountResult;
+i... | Java | ํ ์ธ ํํ๋ค์ ๋ชจ๋ `Discount`๋ก ์ถ์ํ ํด๋์
จ๊ธฐ ๋๋ฌธ์
~~~java
List<Discount> discounts = List.of(
new WeekendDiscount(calendar, orderDetail),
new WeekdaysDiscount(calendar, orderDetail),
new SpecialDiscount(calendar)
);
int discountAmount = discounts.stream()
.mapToInt(Discount::calculateDiscount)
.sum()... |
@@ -0,0 +1,81 @@
+package christmas.model.order;
+
+import static christmas.exception.ErrorType.INVALID_MAX_MENU_QUANTITY;
+import static christmas.exception.ErrorType.INVALID_MENU_ONLY_DRINK;
+import static christmas.utils.Constants.MAX_ORDER_QUANTITY;
+import static christmas.utils.Constants.MIN_ORDER_MENU;
+
+import... | Java | ์ด๋ฏธ `OrderMenu`๊ฐ ์ผ๊ธ ์ปฌ๋ ์
์ ์ญํ ์ ํ๊ณ ์๋๋ฐ ๊ตณ์ด ํ๋ฒ ๋ ๊ฐ์ธ์ผ ํ๋?? ๋ผ๋ ์๊ฐ์ด ๋ญ๋๋ค..
๊ฐ์ ์ญํ ์ `OrderMenu`๊ฐ ์ํํด๋ ๋ฌธ๋งฅ์ ์ ํ ์ด์ํ์ง ์์ ๊ฒ ๊ฐ์์! |
@@ -0,0 +1,54 @@
+package christmas.model.calendar;
+
+import static christmas.model.calendar.enums.CalendarDate.CHRISTMAS;
+import static christmas.model.calendar.enums.CalendarDate.EVENT_MONTH;
+import static christmas.model.calendar.enums.CalendarDate.EVENT_YEAR;
+import static christmas.model.calendar.enums.Calenda... | Java | ๊ฐ์ฌํฉ๋๋ค :) |
@@ -0,0 +1,20 @@
+package christmas.model.badge;
+
+import christmas.model.badge.enums.BadgeInfo;
+
+public class Badge {
+
+ private final BadgeInfo badgeInfo;
+
+ public Badge(int totalDiscountAmount) {
+ this.badgeInfo = selectBadge(totalDiscountAmount);
+ }
+
+ public String getBadgeName() {
+ ... | Java | ๊ฐ์ฌํฉ๋๋ค. ๊ฐ์ฒด์๊ฒ ๋ฉ์ธ์ง๋ฅผ ๋์ ธ์ ์บก์ํ ์ํค๋ ค๊ณ ์๋ํ์๋๋ฐ, ์๋นํ ๋ถํ์ํ๋ค๊ณ ์๊ฐ๋๋ค์ ใ
ใ
|
@@ -0,0 +1,15 @@
+package christmas.model.order.enums;
+
+public enum Category {
+
+ APPETIZER("์ํผํ์ด์ "),
+ MAIN_COURSE("๋ฉ์ธ"),
+ DESSERT("๋์ ํธ"),
+ BEVERAGE("์๋ฃ");
+
+ private final String category;
+
+ Category(String category) {
+ this.category = category;
+ }
+} | Java | ๋ค ๋ง์ต๋๋ค! |
@@ -0,0 +1,81 @@
+package christmas.model.order;
+
+import static christmas.exception.ErrorType.INVALID_MAX_MENU_QUANTITY;
+import static christmas.exception.ErrorType.INVALID_MENU_ONLY_DRINK;
+import static christmas.utils.Constants.MAX_ORDER_QUANTITY;
+import static christmas.utils.Constants.MIN_ORDER_MENU;
+
+import... | Java | ์๋จ์ validate๋ฅผ ๋ณด์๋ฉด ์ดํดํ์ค ์ ์์๊ฑฐ์์..! |
@@ -0,0 +1,18 @@
+package subway.config;
+
+import lombok.extern.slf4j.*;
+import org.springframework.http.*;
+import org.springframework.web.bind.annotation.*;
+
+@Slf4j
+@RestControllerAdvice
+public class GlobalExceptionHandler {
+
+ @ExceptionHandler(RuntimeException.class)
+ public ResponseEntity<ErrorRespon... | Java | ์๋ฌ ๊ณตํต ์ฒ๋ฆฌ๋ฅผ ์ ํด์ฃผ์
จ๋ค์! ๐
์์ธ์ข
๋ฅ์ ๋ฐ๋ผ ๋ก๊น
๋ ๋ฒจ์ ์ ์ ํ๊ฒ ๋ถ๋ฆฌํด์ ๋ก๊ทธ๋ฅผ ๋จ๊ธฐ๋ ๊ฒ๋ ์ข์ ๊ฑฐ ๊ฐ์๋ฐ ์ด๋ป๊ฒ ์๊ฐํ์๋์?
logging level ๊ด๋ จํด์๋ ์๋ ๋ด์ฉ์ ์ฐธ๊ณ ํด ์ฃผ์๋ฉด ๊ฐ์ฌํ๊ฒ ์ต๋๋ค.
์) log.error("Unexpected exception occurred: {}", e.getMessage(), e);
โ DEBUG : ๊ฐ๋ฐ๋จ๊ณ์์๋ถํฐ ํ์ฑํ.ํ๋ก์ธ์ค์์ฒ๋ฆฌ์์/ํ๋ฆ์๋ถ์ํ๋๋ฐ ๋์์ด ๋๋ ์ ๋ณด ๋ฑ
โ INFO : ๋๋ฒ๊น
์ ๋ณด์ธ์ ํ๋ก์ธ์ค์ค์ / ๊ธฐ๋์ ๊ด๋ จํ ์ ๋ณด ๋ฑ
โ WARN : ์ค๋ฅ์ํฉ์ ์๋์ง๋ง,... |
@@ -1,13 +1,13 @@
package subway.line;
import lombok.*;
+import subway.*;
+import subway.line.section.*;
import javax.persistence.*;
@Entity
@NoArgsConstructor(access = AccessLevel.PROTECTED)
-@AllArgsConstructor(access = AccessLevel.PRIVATE)
-@Builder
@Getter
public class Line {
@@ -21,13 +21,27 @@ publ... | Java | `@Embedded ์ ์ด์ฉํด ๋๋ฉ์ธ ๋ก์ง์ ์ ๋ถ๋ฆฌํด ์ฃผ์
จ๊ตฐ์! ๐ |
@@ -0,0 +1,49 @@
+package subway.line.section;
+
+import lombok.*;
+import org.springframework.stereotype.*;
+import org.springframework.transaction.annotation.*;
+import subway.*;
+import subway.line.*;
+
+@Service
+@Transactional
+@RequiredArgsConstructor
+public class SectionService {
+
+ private final StationSer... | Java | ํด๋น ํจ์๋ SectionService ์์๋ง ์ฌ์ฉํ๋ ๊ฒ์ผ๋ก ๋ณด์ฌ์ง๋๋ฐ static ์ผ๋ก ์ ์ธํ ์ด์ ๊ฐ ์์๊น์? ๐ |
@@ -0,0 +1,81 @@
+package subway.line.section;
+
+import lombok.*;
+import subway.*;
+
+import javax.persistence.*;
+import java.util.*;
+
+@Embeddable
+@NoArgsConstructor(access = AccessLevel.PRIVATE)
+public class Sections {
+
+ @OneToMany(fetch = FetchType.LAZY, mappedBy = "line", cascade = CascadeType.ALL, orpha... | Java | ๋งค๊ฐ๋ณ์ ํ์
์ Station ์ธ๋ฐ ๋ณ์ ๋ช
์ section ์ด์ฌ์ ํผ๋์ด ์์ด ๋ณด์ฌ์! ๐ |
@@ -0,0 +1,55 @@
+package subway.given;
+
+import io.restassured.response.*;
+import org.springframework.http.*;
+
+import java.util.*;
+
+import static io.restassured.RestAssured.*;
+
+public class GivenLineApi {
+
+ public static final String LINE_PATH = "/lines";
+ public static final String BG_COLOR_600 = "bg... | Java | Map ์ผ๋ก ๋ง๋ค์ด์ ๋๊ธฐ๊ธฐ ๋ณด๋ค๋ DTO ๋ก ๋ง๋ค์ด๋ ์ข์ง ์์๊น์? โบ๏ธ |
@@ -0,0 +1,171 @@
+package subway.line.section;
+
+import io.restassured.response.*;
+import org.junit.jupiter.api.*;
+import org.springframework.boot.test.context.*;
+import org.springframework.test.annotation.*;
+
+import java.util.*;
+
+import static io.restassured.RestAssured.*;
+import static org.assertj.core.api.... | Java | `@DirtiesContext` ๋ฅผ ํ์ฉํด ํ
์คํธ ๊ฒฉ๋ฆฌ๋ฅผ ํด ์ฃผ์
จ๊ตฐ์! ๐
`@DirtiesContext` ๋ ์ปจํ
์คํธ๋ฅผ ๋ค์ ๋ก๋ํ๊ธฐ ๋๋ฌธ์ ํ
์คํธ ์๋๊ฐ ์ค๋ ๊ฑธ๋ฆฐ๋ค๋ ๋จ์ ์ด ์์ต๋๋ค!
์ด ๋ถ๋ถ์ ํ๋ฒ ๊ณ ๋ฏผํด ๋ณด์๋ฉด ์ข์ ๊ฑฐ ๊ฐ์ต๋๋ค ๐ |
@@ -0,0 +1,171 @@
+package subway.line.section;
+
+import io.restassured.response.*;
+import org.junit.jupiter.api.*;
+import org.springframework.boot.test.context.*;
+import org.springframework.test.annotation.*;
+
+import java.util.*;
+
+import static io.restassured.RestAssured.*;
+import static org.assertj.core.api.... | Java | ์์ธ ์๋๋ฆฌ์ค์ ๋ํด ํ
์คํธ๋ฅผ ์ํด์ฃผ์
จ๋ค์! ๐ |
@@ -0,0 +1,63 @@
+package christmas.controller;
+
+import christmas.domain.PromotionService;
+import christmas.domain.order.Day;
+import christmas.domain.order.Order;
+import christmas.dto.response.DiscountPreviewResponse;
+import christmas.view.InputView;
+import christmas.view.OutputView;
+
+import java.util.function... | Java | static ๋ฉ์๋๊ฐ ์๋๊ฐ ๋นจ๋ผ์ง๋ค๋ ์ฅ์ ์ด ์์ง๋ง ๊ฐ์ฒด์งํฅ์์ ๋ฉ์ด์ง๊ธฐ ๋๋ฌธ์ ์ง์ํด์ผํ๋ค๊ณ ์๊ฐํฉ๋๋ค!
ํน์ Controller ๋ด ๋ฉ์๋๋ค์ ๋ชจ๋ static ๋ฉ์๋๋ก ์ ์ธํ์ ์ด์ ๊ฐ ์์ผ์ค๊น์?? |
@@ -0,0 +1,40 @@
+package christmas.domain.order;
+
+import christmas.validator.OrderValidator;
+
+import java.util.Objects;
+
+public class Day {
+
+ private final Integer day;
+
+ private Day(Integer day) {
+ validate(day);
+ this.day = day;
+ }
+
+ public static Day create(Integer day) {
+ ... | Java | Day ๊ฐ์ฒด์ ์ ํจ์ฑ ๊ฒ์ฌ๋ฅผ OrderValidator์์ ์งํํ๊ฒ ๋๋ฉด ๋๋ฉ์ธ ๋ด๋ถ ์ํ ๋ฐ์ดํฐ์ ์บก์ํ๊ฐ ๊นจ์ง ๋ฟ๋๋ฌ ์ ํจ์ฑ ๊ฒ์ฌ์ ์์ด ๋ง์์ง๋ฉด OrderValidator ๊ฐ์ฒด๊ฐ ๋น๋ํด์ง๋ค๋ ๋จ์ ์ด ์๋ค๊ณ ์๊ฐํฉ๋๋ค.
Day ๊ฐ์ฒด ๋ด๋ถ์์ ์งํํ๋ ๊ฒ์ ์ด๋ค๊ฐ์?? |
@@ -0,0 +1,74 @@
+package christmas.domain.order;
+
+import christmas.domain.order.menu.Menu;
+import christmas.domain.order.menu.Quantity;
+import christmas.dto.request.OrderRequest;
+import christmas.dto.response.OrderResponse;
+import christmas.util.InputUtil;
+import christmas.validator.OrderValidator;
+
+import ja... | Java | ์ ๊ทผ์ ์ด์๋ฅผ default๋ก ์ ์ธํ์ ์ด์ ๊ฐ ๊ถ๊ธํฉ๋๋ค! |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.