code stringlengths 41 34.3k | lang stringclasses 8
values | review stringlengths 1 4.74k |
|---|---|---|
@@ -0,0 +1,117 @@
+package christmas.view;
+
+import static christmas.view.messages.PrintMessage.*;
+
+import christmas.domain.Menu;
+import christmas.domain.Order;
+import christmas.domain.Result;
+import christmas.view.messages.PrintMessage;
+import java.util.Map;
+
+public class OutputView {
+ private static fina... | Java | ๋ถํ์ํ ๊ฐํ์ ์ง์์ฃผ์ธ์..! |
@@ -1,28 +1,33 @@
package com.emotionalcart.product.application;
-import com.emotionalcart.core.feature.product.*;
-import com.emotionalcart.core.feature.provider.Provider;
-import com.emotionalcart.core.feature.review.Review;
import com.emotionalcart.core.exception.ErrorCode;
import com.emotionalcart.core.excepti... | Java | files.indexOf(file) + 1์ ํ์ผ์ด ๋ค์ด์จ ์์๋๋ก ํ๊ธฐ ์์๋ฅผ ๋งค๊ฒจ์ฃผ๋ ๊ฒ์ธ๊ฐ์?? |
@@ -1,28 +1,33 @@
package com.emotionalcart.product.application;
-import com.emotionalcart.core.feature.product.*;
-import com.emotionalcart.core.feature.provider.Provider;
-import com.emotionalcart.core.feature.review.Review;
import com.emotionalcart.core.exception.ErrorCode;
import com.emotionalcart.core.excepti... | Java | ๋ง์ต๋๋ค! |
@@ -0,0 +1,21 @@
+import { EOL as LINE_SEPARATOR } from 'os';
+import { TIME, UNITS } from './system.js';
+
+export const OUTPUT_MESSAGES = Object.freeze({
+ intro: `์๋
ํ์ธ์! ์ฐํ
์ฝ ์๋น ${TIME.month}${UNITS.month} ์ด๋ฒคํธ ํ๋๋์
๋๋ค.`,
+ outro: `์ผ์ ์ฐํ
์ฝ ์๋น์์ ๋ฐ์ ์ด๋ฒคํธ ํํ ๋ฏธ๋ฆฌ ๋ณด๊ธฐ!`,
+});
+
+export const INPUT_MESSAGES = Object.freeze({
+... | JavaScript | ์ด๋ฒคํธ๋ฅผ ์งํํ๋ ๋ฌ์ด ๋ฐ๋๋ ๊ฒ์ ๊ณ ๋ คํด `TIME.month` ์์๋ฅผ ๋ฐ๋ก ์์ฑํ ์ ์ด ์ธ์ ๊น์ด์!
`12์ ์ด๋ฒคํธ ์ฐธ์ฌ ๊ณ ๊ฐ์ 5%๊ฐ ๋ด๋
1์ ์ํด ์ด๋ฒคํธ์ ์ฌ์ฐธ์ฌํ๋ ๊ฒ`
์ด๋ฉ์ผ์ ์ด๋ฌํ ๋ฌธ์ฅ์ด ์ ๋ ๋์ ๋ฐํ๊ธด ํ๋๋ฐ ๊ทธ๋ฅ ๊ธฐ๋ฅ ๊ตฌํ์ ์ง์คํ๋๋ผ ์์ด๋ฒ๋ ธ๊ฑฐ๋ ์..
์ ๋ง ์ฌ์ธํ๊ฒ ๊ณ ๋ฏผํ์๋ฉด์ ๊ตฌํํ์ ๊ฒ ๊ฐ์ต๋๋ค! ๊ฐํ๋ง ๋์ค๋ค์ ๐ฎ |
@@ -0,0 +1,28 @@
+export const TIME = Object.freeze({
+ year: '2023',
+ month: '12',
+ dateFormat: `2023-12-`,
+});
+
+export const PROMOTION_TITLES = Object.freeze({
+ 1: '์ํด',
+ 12: 'ํฌ๋ฆฌ์ค๋ง์ค',
+});
+
+export const SYMBOLS = Object.freeze({
+ comma: ',',
+ dash: '-',
+ colon: ':',
+ blank: '',
+});
+
+export co... | JavaScript | ํ์ฅ์ ๊ณ ๋ คํ์
จ๊ตฐ์! ๋ฐฐ์ฐ๊ณ ๊ฐ๋๋ค ๐
์ค์ ํ์ฌ์๋ค๋ฉด ์ด๋ฒคํธ ๊ธฐํ์๊ฐ ๋๋ฌด ์ข์ํ ๊ฒ ๊ฐ์์! |
@@ -0,0 +1,28 @@
+export const TIME = Object.freeze({
+ year: '2023',
+ month: '12',
+ dateFormat: `2023-12-`,
+});
+
+export const PROMOTION_TITLES = Object.freeze({
+ 1: '์ํด',
+ 12: 'ํฌ๋ฆฌ์ค๋ง์ค',
+});
+
+export const SYMBOLS = Object.freeze({
+ comma: ',',
+ dash: '-',
+ colon: ':',
+ blank: '',
+});
+
+export co... | JavaScript | ๊ทธ๋ฅ ๊ฐํ๋ง ๋์ค๋ค์... ํ ๋ง์ด ์๋ค์... ์ต์ข
์ฝํ
์ด๋ฐ๋ถ์ด ๊ฐ์๋๊ตฌ๋... |
@@ -0,0 +1,87 @@
+import VisitDate from '../domain/VisitDate.js';
+import Order from '../domain/Order.js';
+import InputView from '../views/InputView.js';
+import OutputView from '../views/OutputView.js';
+import EventPlanner from '../domain/EventPlanner.js';
+import Save from '../domain/Save.js';
+
+class EventControl... | JavaScript | ์๋ฌ๋ฉ์์ง ์ถ๋ ฅ ๊ธฐ๋ฅ์ `outputView`๊ฐ ์ฑ
์์ ๋งก๋๋ก ํ๊ตฐ์! ๋ฆฌํฉํ ๋ง ํ ๋ ์ ๋ ๋ฐ์ํด๋ด์ผ๊ฒ ์ต๋๋ค ๐ |
@@ -0,0 +1,32 @@
+import { ERROR_MESSAGES } from '../constants/messages.js';
+import { TIME } from '../constants/system.js';
+import validationErrorHandler from '../errors/index.js';
+import { isPositiveInteger, isValidDate } from '../validators/index.js';
+
+class VisitDate {
+ #visitDate;
+
+ constructor(date) {
+ ... | JavaScript | ๊ธฐ๋ณธ ์ ๊ณต๋๋ `Date` ๊ฐ์ฒด๋ฅผ ํ์ฉํ ์๊ฐ์ ๋ชปํ๋ค์!
์ด๋ ๊ฒ ์ ๋ฐํ ๋ฐฉ๋ฒ๋ ์๋ค๋ ๊ฒ์ ์์๊ฐ๋๋ค ๐ |
@@ -0,0 +1,9 @@
+import { ERROR_MESSAGES } from '../constants/messages.js';
+
+class AppError extends Error {
+ constructor(message) {
+ super(`${ERROR_MESSAGES.prefix} ${message}`);
+ }
+}
+
+export default AppError; | JavaScript | ์๋ฌ๋ฅผ ์์ํ์
จ๊ตฐ์! ์ ๋ง ์ฒด๊ณ์ ์ธ ์ฝ๋์ธ ๊ฒ ๊ฐ์์!
`Error`๋ฅผ ์์ํด `AppError` ํด๋์ค๋ฅผ ๋ฐ๋ก ๋ง๋์๊ฒ ๋ ๊ณ๊ธฐ๋ฅผ ์ฌ์ญค๋ด๋ ๋ ๊น์? |
@@ -0,0 +1,12 @@
+import MENUS from '../constants/menus.js';
+
+/**
+ * ๋ฉ๋ด ์ด๋ฆ์ ์
๋ ฅํ๋ฉด ์นดํ
๊ณ ๋ฆฌ ๋ด ๋ฉ๋ด์ ๊ฐ๊ฒฉ ๊ฐ์ ๋ฐํ
+ * @param {string} menu - ๋ฉ๋ด ์ด๋ฆ
+ * @returns {number | undefined}
+ */
+const menuPriceFinder = menu => {
+ return Object.values(MENUS).find(category => menu in category)[menu];
+};
+
+export default menuPriceFinde... | JavaScript | ๊ธฐ๋ฅ์ ๊ตฌํํ๋ค๋ณด๋ฉด ๋ฉ๋ด์ ๊ฐ๊ฒฉ์ ์์ฃผ ๊ฐ์ ธ๋ค ์ฐ๊ฒ ๋๋๋ฐ utils ํด๋์ ๋ฐ๋ก ํจ์๋ฅผ ๊ตฌํํด๋๋ ์ข์ ๊ฒ ๊ฐ์์!
๋ฐฐ์๊ฐ๋๋ค ๐ |
@@ -0,0 +1,15 @@
+import { UNITS } from '../constants/system.js';
+
+/**
+ * number type์ ๊ฐ๊ฒฉ์ ์
๋ ฅ๋ฐ์ ๊ฐ๊ฒฉ์ ๋ณํ ํ '์'์ ํฌํจํ string type์ผ๋ก ๋ณํ
+ * 20000์ด๋ผ๋ ๋งค๊ฐ๋ณ์๋ฅผ ํตํด '20,000์'์ ๋ฐํ
+ * @param {number} price ๊ฐ๊ฒฉ
+ * @returns {string}
+ */
+const priceFormatter = price => {
+ const formattedPrice = new Intl.NumberFormat().format(pr... | JavaScript | `Intl.NumberFormat` ๋ฅผ ์ฒ์ ์ ํ๋๋ฐ ์ด๋ ๊ฒ ๊ฐ๊ฒฉ์ ํฌ๋งทํ๋ ๊ฐ๋จํ ๋ฐฉ๋ฒ์ด ์์๊ตฐ์!
์ ๋ ์ ๊ทํํ์์ผ๋ก ๊ตฌํํ๋๋ฐ ์๋ก์ด ๋ฐฉ๋ฒ์ ์์๊ฐ๊ฒ ๋ผ์ ์ข์์! |
@@ -0,0 +1,68 @@
+import { ERROR_MESSAGES } from '../constants/messages.js';
+import { SYMBOLS } from '../constants/system.js';
+import validationErrorHandler from '../errors/index.js';
+import { isValidMenuName } from '../validators/index.js';
+import { isOnlyBeverage } from '../validators/is-valid-menu/name.js';
+imp... | JavaScript | ๋ฉ์๋ ์์๋ฅผ ์ ์ ํ์
์ ์ดํดํ๊ธฐ ์ ๋ง ์ข์์ต๋๋ค!
์ด, ์ด ๋ฉ์๋๋ ๋ญ์ง? ์ถ์ผ๋ฉด ๋ฐ๋ก ๋ฐ์ ๊ทธ ๋ฉ์๋๊ฐ ์์ด์ ์ ์ ์ฝํ์ด์!
๋ฉ์๋ ์์๋ ์ปจ๋ฒค์
์ด๋ผ๊ณ ํ๋ ๊ณตํต ํผ๋๋ฐฑ์ด ์์๋๋ฐ ๊ทธ๊ฑธ ์ ๋ฐ์ํ์ ๊ฒ ๊ฐ์์ ๐ |
@@ -0,0 +1,57 @@
+import { GIVEAWAYS, TITLES } from '../constants/events.js';
+import { NONE } from '../constants/system.js';
+import menuPriceFinder from '../utils/menuPriceFinder.js';
+
+class Benefit {
+ #isFitGiveaway;
+
+ #benefitList;
+
+ #totalPrice;
+
+ constructor(discountList, isFitGiveaway) {
+ this.#... | JavaScript | 3์ฃผ์ฐจ ๊ณตํต ํผ๋๋ฐฑ์ `ํ๋์ ์๋ฅผ ์ค์ด๊ธฐ ์ํด ๋
ธ๋ ฅํ๋ค`๋ผ๋ ๋ง์ด ์์์ฃ !
`#benefitList`์ `#totalPrice`๋
์์ฑ์์ ์ธ์๋ก ์ ๋ฌ๋ `discountList`, `isFitGiveaway`์ผ๋ก ๋ง๋ค ์ ์๊ธฐ ๋๋ฌธ์
๊ผญ ํ๋๋ก ์ ์ธํด์ผ ํ๋ ๊ฑด์ง์ ๋ํ ์๋ฌธ์ด ์๊น๋๋ค!
ํ๋์ ๊ฐ์๋ฅผ ์ต๋ํ ์ค์ด๋ ๊ฒ ์ ๋ง ์ณ์ ๊ฒ์ธ์ง ๊ณ ๋ฏผ์ด ๋ง์์ง๋ค์
ํฌํ๋ ์๊ฐ์ ์ด๋ ์ ๊ฐ์?! |
@@ -0,0 +1,106 @@
+import { BADGES, GIVEAWAYS } from '../constants/events.js';
+import { NONE } from '../constants/system.js';
+import menuPriceFinder from '../utils/menuPriceFinder.js';
+import Benefit from './Benefit.js';
+import Discount from './Discount.js';
+
+class EventPlanner {
+ #benefit;
+
+ #preTotalPrice;... | JavaScript | `switch`๋ฌธ์ ์ฌ์ฉํ๋ ์ ๋ง ๊น๋ํ ๊ฒ ๊ฐ์์! |
@@ -0,0 +1,43 @@
+import fs from 'fs';
+import { FILE_PATH } from '../constants/system.js';
+
+class Save {
+ #eventPlanner;
+
+ #filePath;
+
+ constructor(eventPlanner) {
+ this.#eventPlanner = eventPlanner;
+ this.#filePath = FILE_PATH;
+ this.#writeData();
+ }
+
+ // ๊ธฐ์กด JSON ๋ฐ์ดํฐ์ ์ ๊ท ๋ฐ์ดํฐ๋ฅผ ์ถ๊ฐํ๊ณ ์ ์ฅ
+ #wr... | JavaScript | ๋ฐฉ๋ฌธํ ์๋๋ค์ ๋ํ ๋ฐ์ดํฐ๋ฅผ ์ ์ฅํ๋ ๊ธฐ๋ฅ์ ์๊ฐ ๋ชป ํ๋๋ฐ
๋๋ฌด ์ข์ ์์ด๋์ด์
๋๋ค โจ |
@@ -0,0 +1,21 @@
+import { EOL as LINE_SEPARATOR } from 'os';
+import { TIME, UNITS } from './system.js';
+
+export const OUTPUT_MESSAGES = Object.freeze({
+ intro: `์๋
ํ์ธ์! ์ฐํ
์ฝ ์๋น ${TIME.month}${UNITS.month} ์ด๋ฒคํธ ํ๋๋์
๋๋ค.`,
+ outro: `์ผ์ ์ฐํ
์ฝ ์๋น์์ ๋ฐ์ ์ด๋ฒคํธ ํํ ๋ฏธ๋ฆฌ ๋ณด๊ธฐ!`,
+});
+
+export const INPUT_MESSAGES = Object.freeze({
+... | JavaScript | ์ด๋ฒ ๋ฏธ์
์์๋ ํ์ฅ์ฑ์ ์ ๊ฒฝ์ฐ๊ณ ์ ๋
ธ๋ ฅํ๋๋ฐ ์์๋ด์ฃผ์
์ ๊ฐ์ฌํ ๋ฐ๋ฆ์
๋๋ค! ๐ |
@@ -0,0 +1,32 @@
+import { ERROR_MESSAGES } from '../constants/messages.js';
+import { TIME } from '../constants/system.js';
+import validationErrorHandler from '../errors/index.js';
+import { isPositiveInteger, isValidDate } from '../validators/index.js';
+
+class VisitDate {
+ #visitDate;
+
+ constructor(date) {
+ ... | JavaScript | ์๋ง ๋ ์ข์ ๋ฐฉ๋ฒ์ด ์์๊ฒ๋๋ค! :) ์ ๋ `Date` ๊ฐ์ฒด๋ฅผ ์ ํ์ฉํ์ง ๋ชปํ ๊ฒ ๊ฐ์์ ๋ ๊ณต๋ถํด๋ณด๋ ค๊ตฌ์! |
@@ -0,0 +1,9 @@
+import { ERROR_MESSAGES } from '../constants/messages.js';
+
+class AppError extends Error {
+ constructor(message) {
+ super(`${ERROR_MESSAGES.prefix} ${message}`);
+ }
+}
+
+export default AppError; | JavaScript | ์๋ฌด๋๋ `[ERROR]` ๋ผ๋ prefix๋ฅผ ํตํด ์๋ฌ ๋ฉ์์ง๋ฅผ ์ ์ํ๋ ๊ณผ์ ์์ ๋ง๋ค๊ฒ ๋์๋๋ฐ์, ์ง์ ์๋ฌ ํด๋์ค๋ฅผ ์ฌ์ฉํ๋ฉด ์ถํ์ ๋ ์ฝ๊ฒ ํ์ฅํ ์ ์๋ ์ฅ์ ์ด ์์ง ์์๊น๋ผ๋ ์๊ฐ์ด์์ต๋๋ค! |
@@ -0,0 +1,15 @@
+import { UNITS } from '../constants/system.js';
+
+/**
+ * number type์ ๊ฐ๊ฒฉ์ ์
๋ ฅ๋ฐ์ ๊ฐ๊ฒฉ์ ๋ณํ ํ '์'์ ํฌํจํ string type์ผ๋ก ๋ณํ
+ * 20000์ด๋ผ๋ ๋งค๊ฐ๋ณ์๋ฅผ ํตํด '20,000์'์ ๋ฐํ
+ * @param {number} price ๊ฐ๊ฒฉ
+ * @returns {string}
+ */
+const priceFormatter = price => {
+ const formattedPrice = new Intl.NumberFormat().format(pr... | JavaScript | `Intl.NumberFormat` ์์ฑ์๋ฅผ ํตํด ๋ค์ํ ํตํ ์์์ ๋ณํํ ์ ์๋๋ผ๊ตฌ์!
[Intl.NumberFormat](https://developer.mozilla.org/ko/docs/Web/JavaScript/Reference/Global_Objects/Intl/NumberFormat)
๋์์ด ๋ ๊น์ถ์ด ๋งํฌ ์ฒจ๋ถํด๋์์ต๋๋ค :) |
@@ -0,0 +1,57 @@
+import { GIVEAWAYS, TITLES } from '../constants/events.js';
+import { NONE } from '../constants/system.js';
+import menuPriceFinder from '../utils/menuPriceFinder.js';
+
+class Benefit {
+ #isFitGiveaway;
+
+ #benefitList;
+
+ #totalPrice;
+
+ constructor(discountList, isFitGiveaway) {
+ this.#... | JavaScript | ์ ๋ ์ฐ์ ๋ชจ๋ ๋ฉ์๋์ ํ๋๋ฅผ `private`์ผ๋ก ์ง์ ํ๊ณ ๋์, ์ดํ์ `public`์ผ๋ก ์ ๊ทผ์ ํด์ผ๋ง ํ ๋ `public`์ผ๋ก ์ ํํ์์ต๋๋ค!
์๋ง ์ด ๊ณผ์ ์์๋ ํด๋์ค ๋ด ๋ฉ์๋๊ฐ `benefitList`์ `totalPrice`๋ฅผ ์ฌ์ฉํจ์ ์์ด์ `public`์ผ๋ก ์ ํํ์ง ์์๋ ๋ ๊ฒ ๊ฐ์์ ๊ทธ๋๋ก ๋์์ต๋๋ค :)
์ ๋ ์ฌ์ค ๊ณตํต ํผ๋๋ฐฑ์ ๋ฐ๊ณ ๋์ ํ๋์ ๊ฐ์๋ฅผ ์ต๋ํ ์ค์ฌ์ผํ๋ ๊ฒ๊ณผ, ์ต๋ํ private ํ๋๋ก ์บก์ํ๋ฅผ ๊ตฌํํ๋ ๊ฒ ์ฌ์ด์์์ ์ค๊ฐ์ ์ ๋ชป์ฐพ๊ฒ ๋๋ผ๊ตฌ์!
์ข์ ํผ๋๋ฐฑ ๊ฐ์ฌ๋๋ฆฝ๋๋ค! `benefitList`์ `totalP... |
@@ -0,0 +1,68 @@
+import { ERROR_MESSAGES } from '../constants/messages.js';
+import { SYMBOLS } from '../constants/system.js';
+import validationErrorHandler from '../errors/index.js';
+import { isValidMenuName } from '../validators/index.js';
+import { isOnlyBeverage } from '../validators/is-valid-menu/name.js';
+imp... | JavaScript | ์ ์ฝ๋๋ ์ค์ค๋ก ๋ค์ ๋์กํ ์ฝ๋๋ผ๊ณ ์๊ฐ์ด ๋๋๋ฐ, ๋คํ์
๋๋ค ํํ |
@@ -0,0 +1,15 @@
+import { UNITS } from '../constants/system.js';
+
+/**
+ * number type์ ๊ฐ๊ฒฉ์ ์
๋ ฅ๋ฐ์ ๊ฐ๊ฒฉ์ ๋ณํ ํ '์'์ ํฌํจํ string type์ผ๋ก ๋ณํ
+ * 20000์ด๋ผ๋ ๋งค๊ฐ๋ณ์๋ฅผ ํตํด '20,000์'์ ๋ฐํ
+ * @param {number} price ๊ฐ๊ฒฉ
+ * @returns {string}
+ */
+const priceFormatter = price => {
+ const formattedPrice = new Intl.NumberFormat().format(pr... | JavaScript | ์ ๋ ์ด ๋ถ๋ถ์ [Number.toLocaleString()](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number/toLocaleString)์ ์ ์ฉํ๋๋ฐ, ์ซ์ ํ์๊ณผ ๊ด๋ จ๋ ๋ถ๋ถ์ Intl ๊ฐ์ฒด๋ฅผ ์ฌ์ฉํ๋๊ฒ ๋ ์ ํํ ๊ฒ ๊ฐ๋ค์ ๐ (๋ด๋ถ์ ์ผ๋ก ๊ฐ์ ๋ฉ์๋๋ฅผ ์ฌ์ฉํ๋ ๊ฑฐ ๊ฐ์์ ใ
ใ
) |
@@ -0,0 +1,24 @@
+const MENUS = Object.freeze({
+ appetizer: {
+ ์์ก์ด์ํ: 6_000,
+ ํํ์ค: 5_500,
+ ์์ ์๋ฌ๋: 8_000,
+ },
+ main: {
+ ํฐ๋ณธ์คํ
์ดํฌ: 55_000,
+ ๋ฐ๋นํ๋ฆฝ: 54_000,
+ ํด์ฐ๋ฌผํ์คํ: 35_000,
+ ํฌ๋ฆฌ์ค๋ง์คํ์คํ: 25_000,
+ },
+ dessert: {
+ ์ด์ฝ์ผ์ดํฌ: 15_000,
+ ์์ด์คํฌ๋ฆผ: 5_000,
+ },
+ beverage: {
+ ์ ๋ก์ฝ๋ผ: 3_000,
+ ... | JavaScript | ํน์ menu๋ data ํด๋์ ๋ฃ๋ ๋ฐฉํฅ๋ ์๊ฐํด ๋ณด์
จ์๊น์? ์ ๊ฐ์ ๊ฒฝ์ฐ์ ์์๋ก ๋ฌถ๊ธฐ์ ๊ฑธ๋ฆฌ๋ ๋ถ๋ถ๋ค์ด ์์๋ ๊ฒ ๊ฐ์์์! ๊ฐ์ธ์ ์ผ๋ก ๊ถ๊ธํด์ ์ฌ์ญค๋ด
๋๋ค! ๐ |
@@ -1,5 +1,15 @@
+import EventController from './controller/index.js';
+
class App {
- async run() {}
+ #controller;
+
+ constructor() {
+ this.#controller = new EventController();
+ }
+
+ async run() {
+ await this.#controller.startEvent();
+ }
}
export default App; | JavaScript | App์ด ์ ๋ง ๊น๋ํ๋ค์..! ๋ค์ ์จ๊ฒจ์ง ์ฝ๋๋ค ๋ณด๊ณ ๋ง์ด ๋ฐฐ์๊ฐ๋๋ค! ๐โโ๏ธ |
@@ -0,0 +1,52 @@
+import { PROMOTION_TITLES, TIME, UNITS } from './system.js';
+
+export const DISCOUNT_PRICES = Object.freeze({
+ dDay: 1_000,
+ dDayInc: 100,
+ week: 2_023,
+ special: 1_000,
+});
+
+export const BADGES = Object.freeze({
+ star: { title: '๋ณ', price: 5_000 },
+ tree: { title: 'ํธ๋ฆฌ', price: 10_000 ... | JavaScript | `dDayInc`๋ณด๋ค๋ ์ข๋ ๊ตฌ์ฒด์ ์ธ ์์๋ช
์ ์ด๋จ๊น์? |
@@ -0,0 +1,52 @@
+import { PROMOTION_TITLES, TIME, UNITS } from './system.js';
+
+export const DISCOUNT_PRICES = Object.freeze({
+ dDay: 1_000,
+ dDayInc: 100,
+ week: 2_023,
+ special: 1_000,
+});
+
+export const BADGES = Object.freeze({
+ star: { title: '๋ณ', price: 5_000 },
+ tree: { title: 'ํธ๋ฆฌ', price: 10_000 ... | JavaScript | ์ํด ์ด๋ฒคํธ๊น์ง๋ ์๊ฐ์ํด๋ดค๋๋ฐ ๊ผผ๊ผผํ์ญ๋๋ค!๐ |
@@ -0,0 +1,15 @@
+import { UNITS } from '../constants/system.js';
+
+/**
+ * number type์ ๊ฐ๊ฒฉ์ ์
๋ ฅ๋ฐ์ ๊ฐ๊ฒฉ์ ๋ณํ ํ '์'์ ํฌํจํ string type์ผ๋ก ๋ณํ
+ * 20000์ด๋ผ๋ ๋งค๊ฐ๋ณ์๋ฅผ ํตํด '20,000์'์ ๋ฐํ
+ * @param {number} price ๊ฐ๊ฒฉ
+ * @returns {string}
+ */
+const priceFormatter = price => {
+ const formattedPrice = new Intl.NumberFormat().format(pr... | JavaScript | ๋ง์ต๋๋ค! ์ํ๋ ๋ง์์ฒ๋ผ ๊ฒฐ๊ตญ `toLocaleString()`์ด ๊ถ๊ทน์ ์ผ๋ก `Intl.NumberFormat` API๋ฅผ ์ฌ์ฉํ๋๋ผ๊ตฌ์ :)
์ด๋ป๊ฒ๋ณด๋ฉด ์ข๋ ์์ฌ์ด ์ฌ์ฉ์ ์ํ `toLocaleString()` ๋ฉ์๋ ์ฌ์ฉ์ด ๋ ๋ชฉ์ ์ ๋ถํฉํ ์๋ ์๋ค๊ณ ์๊ฐ์ด ๋๋ค์ :) |
@@ -1,6 +1,9 @@
package bridge;
+import bridge.domain.constant.MoveCommand;
import java.util.List;
+import java.util.stream.Collectors;
+import java.util.stream.IntStream;
/**
* ๋ค๋ฆฌ์ ๊ธธ์ด๋ฅผ ์
๋ ฅ ๋ฐ์์ ๋ค๋ฆฌ๋ฅผ ์์ฑํด์ฃผ๋ ์ญํ ์ ํ๋ค.
@@ -18,6 +21,10 @@ public BridgeMaker(BridgeNumberGenerator bridgeNumberGenerator) {
* @return... | Java | ์ด ๋ถ๋ถ ๊ฐ์ฒด์งํฅ์ ์ผ๋ก ์ค๊ณ๋ฅผ ์ํ์
จ๋ค์!! ๊ฐ๋
์ฑ ์์ฃผ ๊ตฟ์
๋๋ค |
@@ -0,0 +1,95 @@
+package bridge.controller;
+
+import bridge.domain.model.Bridge;
+import bridge.domain.model.BridgeGame;
+import bridge.domain.constant.MoveCommand;
+import bridge.domain.constant.RetryCommand;
+import bridge.domain.constant.Status;
+import bridge.view.InputView;
+import bridge.view.OutputView;
+
+pub... | Java | depth๊ฐ 3์ด๋ค์ ใ
ใ
ํจ์๋ฅผ ๋ถ๋ฆฌํ์
์ผํ ๊ฑฐ ๊ฐ์ต๋๋ค |
@@ -0,0 +1,41 @@
+package bridge.domain.model;
+
+import bridge.domain.constant.MoveCommand;
+import bridge.domain.constant.Status;
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.List;
+
+public class GameDashboard {
+
+ private final List<Status> upResult = new ArrayList<>();
+ pri... | Java | ์ด ๋ถ๋ถ ์ข๋ค์! ์ ๋ Map ์ ์ธ๋ถ๋ก ๋บ์ง ๋ง์ง ๊ณ ๋ฏผํ๋ค๊ฐ ์๋บ๋๋ฐ ๋บ ํ์ Player๊ฐ ๊ฐ์ง๊ณ ์๋ ๊ธฐ๋ฅ๋ค์ ์ฎ๊ฒจ์ฃผ๋๊ฒ ๋ ์ข์์๊ฑฐ ๊ฐ์ต๋๋ค. |
@@ -0,0 +1,95 @@
+package bridge.controller;
+
+import bridge.domain.model.Bridge;
+import bridge.domain.model.BridgeGame;
+import bridge.domain.constant.MoveCommand;
+import bridge.domain.constant.RetryCommand;
+import bridge.domain.constant.Status;
+import bridge.view.InputView;
+import bridge.view.OutputView;
+
+pub... | Java | ์ด ๋ถ๋ถ์ BridgeGame์์ ์งํํ๋ ๋ฐฉ๋ฒ์ ์์์๊น์??? |
@@ -0,0 +1,64 @@
+package bridge.view;
+
+import static bridge.view.ViewMessage.*;
+
+import bridge.domain.model.BridgeGame;
+import bridge.domain.model.GameDashboard;
+import bridge.domain.constant.Status;
+import java.util.List;
+import java.util.stream.Collectors;
+
+/**
+ * ์ฌ์ฉ์์๊ฒ ๊ฒ์ ์งํ ์ํฉ๊ณผ ๊ฒฐ๊ณผ๋ฅผ ์ถ๋ ฅํ๋ ์ญํ ์ ํ๋ค.
+ */
+pu... | Java | ๋งค๊ฐ๊ฐ์ BridgeGame์ด ์๋ GameDashBoard๋ก ๋ฐ์์ผ๋ฉด ์ด๋ ์๊น์??? |
@@ -0,0 +1,23 @@
+package bridge.view;
+
+public enum ViewMessage {
+ START_MESSAGE("๋ค๋ฆฌ ๊ฑด๋๊ธฐ ๊ฒ์์ ์์ํฉ๋๋ค."),
+ INPUT_BRIDGE_SIZE_MESSAGE("๋ค๋ฆฌ์ ๊ธธ์ด๋ฅผ ์
๋ ฅํด์ฃผ์ธ์."),
+ INPUT_MOVE_COMMAND_MESSAGE("์ด๋ํ ์นธ์ ์ ํํด์ฃผ์ธ์. (์: U, ์๋: D)"),
+ INPUT_RETRY_COMMAND_MESSAGE("๊ฒ์์ ๋ค์ ์๋ํ ์ง ์ฌ๋ถ๋ฅผ ์
๋ ฅํด์ฃผ์ธ์. (์ฌ์๋: R, ์ข
๋ฃ: Q)"),
+ RESULT_MESSAG... | Java | StringJoiner ๋ฅผ ์ฐ๋ฉด ํด๋น ๋ถ๋ถ์ ํ๋ฒ์ ํด๊ฒฐํ ์ ์๋๋ผ๊ตฌ์! |
@@ -12,19 +12,22 @@
import nextstep.security.authorization.access.MvcRequestMatcher;
import nextstep.security.authorization.access.RequestMatcherEntry;
import nextstep.security.authorization.manager.AuthenticatedAuthorizationManager;
+import nextstep.security.authorization.manager.AuthorizationManager;
import nexts... | Java | ํ
์คํธ๋ฅผ ์ํ ์ฝ๋๊ฐ ํ๋ก๋์
์ฝ๋์ ์ถ๊ฐ๋์ด ์๋ค์! ํ
์คํธ ํ๊ฒฝ์์๋ง ์ํฅ์ ๋ฐ๋๋ก ๊ตฌ์กฐ๋ฅผ ๊ฐ์ ํด๋ณด๋ฉด ์ด๋จ๊น์? |
@@ -2,11 +2,24 @@
import nextstep.security.authentication.Authentication;
import nextstep.security.authorization.AuthorizationDecision;
+import nextstep.security.authorization.GrantedAuthority;
+import nextstep.security.authorization.role.NullRoleHierarchy;
+import nextstep.security.authorization.role.RoleHierarchy... | Java | ```suggestion
this(new NullRoleHierarchy());
```
์์ํ์ง๋ง.. ์ฃผ ์์ฑ์๋ฅผ ์ ํด ํ๋์ ์์ฑ์์์๋ง ์ด๊ธฐํ๋ฅผ ๋ด๋นํ๋ฉด ์ ์ง๋ณด์์ฑ์ ๋์ผ ์ ์์ต๋๋ค! |
@@ -0,0 +1,87 @@
+package nextstep.security.authorization.role;
+
+import nextstep.security.SimpleGrantedAuthority;
+import nextstep.security.authorization.GrantedAuthority;
+import org.assertj.core.api.Assertions;
+import org.junit.jupiter.api.Test;
+
+import java.util.List;
+import java.util.Set;
+
+import static org... | Java | ํ
์คํธ ๋๋ฌด ์ข๋ค์ ๐
์ถ๊ฐ๋ก ์ํ ์ฐธ์กฐ๊ฐ ๋ฐ์ํ์ ๋์ ๊ฐ์ ์์ธ ์ํฉ์ ๋ํ ํ
์คํธ๋ ์ถ๊ฐํด๋ณด๋ฉด ์ด๋จ๊น์? |
@@ -0,0 +1,148 @@
+package nextstep.security.authorization.role;
+
+import nextstep.security.SimpleGrantedAuthority;
+import nextstep.security.authorization.GrantedAuthority;
+
+import java.util.ArrayDeque;
+import java.util.Collection;
+import java.util.Collections;
+import java.util.HashMap;
+import java.util.HashSet... | Java | ์ง๊ธ์ stream ๊ธฐ๋ฅ์ ์ ํ์ฉํด์ ๊ตฌํํด ์ฃผ์
จ๋๋ฐ์! ์คํ๋ง๊ณผ ๊ฐ์ ํ๋ ์์ํฌ์ ๊ฒฝ์ฐ ๊ฐ๋
์ฑ๋ณด๋ค ์ฑ๋ฅ์ ์ฐ์ ํ๊ธฐ ๋๋ฌธ์ stream ๋ณด๋จ for๋ฌธ์ ์ ํธํ๊ณ ์์ต๋๋ค.
๊ธฐ์กด ์ ํ๋ฆฌ์ผ์ด์
์ ๋ฐฉํฅ์ฑ์ธ ๊ฐ๋
์ฑ๋ณด๋ค ์ฑ๋ฅ์ ์ฐ์ ์ผ๋ก ๊ตฌํํด๋ณด๋ ๊ฒ๋ ํ๋์ ์ฌ๋ฏธ๊ฐ ๋ ์ ์์ ๊ฒ ๊ฐ์ต๋๋ค :) |
@@ -0,0 +1,148 @@
+package nextstep.security.authorization.role;
+
+import nextstep.security.SimpleGrantedAuthority;
+import nextstep.security.authorization.GrantedAuthority;
+
+import java.util.ArrayDeque;
+import java.util.Collection;
+import java.util.Collections;
+import java.util.HashMap;
+import java.util.HashSet... | Java | ```suggestion
Queue<GrantedAuthority> queue = new ArrayDeque<>(authorities);
```
BFS ์๊ณ ๋ฆฌ์ฆ์ ํ์ฉํ์ฌ ์ ๊ตฌํํด ์ฃผ์
จ๋ค์ ๐
์๊ณ ๋ฆฌ์ฆ์ ๋ง๋ ์๋ฃ๊ตฌ์กฐ๋ก ๋ฐ๊พผ๋ค๋ฉด ์ฑ๋ฅ์ด ๋ ์ฌ๋ผ๊ฐ ๊ฒ ๊ฐ์ต๋๋ค! |
@@ -0,0 +1,148 @@
+package nextstep.security.authorization.role;
+
+import nextstep.security.SimpleGrantedAuthority;
+import nextstep.security.authorization.GrantedAuthority;
+
+import java.util.ArrayDeque;
+import java.util.Collection;
+import java.util.Collections;
+import java.util.HashMap;
+import java.util.HashSet... | Java | ์ค... ๊ทธ๋ ๊ตฐ์ !! ์๊ฐํด๋ณด๋ ์คํ๋ง์ด๋ ์ํ๋ฆฌํฐ ์ฝ๋๋ฅผ ๋ณด๋ฉด์ stream์ ์ฌ์ฉํ ๋ถ๋ถ์ด ๊ฑฐ์ ์๋ณด์ธ๋ค ์ถ๊ธด ํ๋๋ฐ ์ฑ๋ฅ์ ์ธ ๋ถ๋ถ์ ์ฑ๊ฒจ๊ฐ๋ ๊ฒ์ด์๊ตฐ์. ์ด๋ถ๋ถ์ for loop์ผ๋ก ๋ณ๊ฒฝํด์ ์ ์ฉํด๋ณด๊ฒ ์ต๋๋ค. !! |
@@ -0,0 +1,87 @@
+package nextstep.security.authorization.role;
+
+import nextstep.security.SimpleGrantedAuthority;
+import nextstep.security.authorization.GrantedAuthority;
+import org.assertj.core.api.Assertions;
+import org.junit.jupiter.api.Test;
+
+import java.util.List;
+import java.util.Set;
+
+import static org... | Java | ์์ฑ์์ ํ์งํ๋ ๊ฒ์ด ์ข์ ๊ฒ ๊ฐ์ ์์ฑ์์ชฝ์ ์ถ๊ฐํด๋ณด์์ต๋๋ค! |
@@ -12,19 +12,22 @@
import nextstep.security.authorization.access.MvcRequestMatcher;
import nextstep.security.authorization.access.RequestMatcherEntry;
import nextstep.security.authorization.manager.AuthenticatedAuthorizationManager;
+import nextstep.security.authorization.manager.AuthorizationManager;
import nexts... | Java | ํ
์คํธ์ ๋ถ๋ฆฌ๋๋ ์ฝ๋๊ฐ ๋ช
ํํ๋ค์ ๐ |
@@ -0,0 +1,148 @@
+package nextstep.security.authorization.role;
+
+import nextstep.security.SimpleGrantedAuthority;
+import nextstep.security.authorization.GrantedAuthority;
+
+import java.util.ArrayDeque;
+import java.util.Collection;
+import java.util.Collections;
+import java.util.HashMap;
+import java.util.HashSet... | Java | ๋๋ฌด ์ข๋ค์ฉ ๐ฏ |
@@ -0,0 +1,90 @@
+package nextstep.app;
+
+import jakarta.servlet.http.HttpServletRequest;
+import nextstep.security.authorization.Secured;
+import nextstep.security.authorization.access.AnyRequestMatcher;
+import nextstep.security.authorization.access.MvcRequestMatcher;
+import nextstep.security.authorization.access.R... | Java | ํ์ฌ ํ๋ก๋์
์ฝ๋์ ํ
์คํธ ์ฝ๋์์ ๋์ผํ ์ค์ ์ด ์ค๋ณต๋๊ณ ์๋๋ฐ, Spring์์ ํ์ฉํ๋ Configurer ํจํด(์ค์ ์ ํจํด)์ ํ์ฉํ๋ฉด ํ์ฅ์ฑ์ด ๋์ด๋ ์ค๋ณต์ ์์ ๋ณผ ์ ์๊ฒ ๋ค์~
์๊ฐ์ด ๋จ๊ณ ์ฌ์ฌํ์ค๊น๋ด ํ์ตํ๋ฉด ์ข์ ๋ด์ฉ ํ๋ ๋์ง๊ณ ๊ฐ๋๋ค ใ
ใ
|
@@ -0,0 +1,148 @@
+package nextstep.security.authorization.role;
+
+import nextstep.security.SimpleGrantedAuthority;
+import nextstep.security.authorization.GrantedAuthority;
+
+import java.util.ArrayDeque;
+import java.util.Collection;
+import java.util.Collections;
+import java.util.HashMap;
+import java.util.HashSet... | Java | ๋ฐ๋ณต๋ฌธ์ผ๋ก ๊น๋ํ๊ฒ ๋ณ๊ฒฝํด ์ฃผ์
จ๋ค์ ๐
๋ฏธ์
์ ๋ค๋ฅธ ๋ถ๋ถ์๋ ์์ง ์คํธ๋ฆผ ์ฝ๋๊ฐ ๋จ์ ์๋๋ฐ, ์ด๋ฒ ๋ณ๊ฒฝ์ด ํด๋น ๋ถ๋ถ๋ง ์์ ํ๋ ๊ฒ์ด ๋ง์๊น์?
๋ค๋ฅธ ์ฝ๋์ ์ฝ๋ฉํธ๋ฅผ ๋๋ฆฌ๋ ค ํ๋๋ฐ, ํน์ ์๋ํ์ ๊ฒ์ธ์ง ํ์ธ์ ์ํด ๋ฆฌ๋ทฐ ๋จ๊น๋๋ค. |
@@ -0,0 +1,148 @@
+package nextstep.security.authorization.role;
+
+import nextstep.security.SimpleGrantedAuthority;
+import nextstep.security.authorization.GrantedAuthority;
+
+import java.util.ArrayDeque;
+import java.util.Collection;
+import java.util.Collections;
+import java.util.HashMap;
+import java.util.HashSet... | Java | ์ ์ ๊ฐ ๋ค๋ฅธ๊ณณ์์๋ ์ฌ์ฉ์ค์ด์๋ค์ ๐ฅฒ
์ด๋ถ๋ถ์ ํ์ธ์ ๋ชปํ์ต๋๋ค ใ
ใ
ใ
๋ฐ์ํ์ต๋๋ค. ๊ผผ๊ผผํ ๋ฆฌ๋ทฐ ๊ฐ์ฌํฉ๋๋ค ! |
@@ -0,0 +1,14 @@
+package step1;
+
+public class Print {
+
+ private int calculateResult;
+
+ public Print(int calculateResult) {
+ this.calculateResult = calculateResult;
+ }
+
+ public void printResult() {
+ System.out.println("calculateResult = " + calculateResult);
+ }
+} | Java | Print๊ฐ ํ๋์ ๊ณ์ฐ๊ฒฐ๊ณผ๋ฅผ ์ํ๋ก ๊ฐ์ง๋๋ก ๊ตฌํํ์
จ๋ค์!
๋ง์ฝ Print๋ฅผ ํตํด ๋ ๋ค๋ฅธ ๊ณ์ฐ ๊ฒฐ๊ณผ๋ฅผ ์ถ๋ ฅํด์ผํ๋ค๋ฉด ์ด๋ป๊ฒ ๋ ๊น์? Print๋ผ๋ ํด๋์ค์ ์ฑ
์์ ๋ง๋ ์ญํ ์ ํ๊ณ ์๋ค๊ณ ๋ณผ ์ ์์๊น์? |
@@ -0,0 +1,50 @@
+package step1;
+
+import java.util.List;
+
+public class Calculator {
+
+ private CalculatorResource calculatorResource;
+
+ public Calculator(String stringCalculatorSentence) {
+ this.calculatorResource = new CalculatorResource(stringCalculatorSentence);
+ }
+
+ public int calculat... | Java | java์ Enum ํด๋์ค๋ฅผ ์ฌ์ฉํ๋ฉด ์ํ์ ํ์๋ฅผ ํ๊ณณ์์ ๊ด๋ฆฌํ ์ ์๋๋ฐ์!
๋งํฌ๋ฅผ ๋ณด์๊ณ ์ฐธ๊ณ ํ์
์ enum ํด๋์ค๋ฅผ ์ฌ์ฉํด๋ณด๋ฉด ์ข์ ๊ฒ ๊ฐ์ต๋๋ค :)
https://techblog.woowahan.com/2527/ |
@@ -0,0 +1,50 @@
+package step1;
+
+import java.util.List;
+
+public class Calculator {
+
+ private CalculatorResource calculatorResource;
+
+ public Calculator(String stringCalculatorSentence) {
+ this.calculatorResource = new CalculatorResource(stringCalculatorSentence);
+ }
+
+ public int calculat... | Java | ๋ฉ์๋์ ํ๋ผ๋ฏธํฐ์ ๊ฐ์๋ฅผ 2๊ฐ ์ดํ๋ก ๋ฆฌํฉํฐ๋งํด๋ณด๋๊ฑด ์ด๋จ๊น์?
ํด๋ฆฐ ์ฝ๋ ์ฑ
์์๋ ๋ฉ์๋์ ํ๋ผ๋ฏธํฐ ๊ฐ์๋ 0~2๊ฐ๊ฐ ์ ์ ํ๋ฉฐ 4๊ฐ ์ด์์ ๋ฌด์กฐ๊ฑด์ ์ผ๋ก ํผํด์ผํ๋ค๊ณ ์ด์ผ๊ธฐํฉ๋๋ค.
ํ๋ผ๋ฏธํฐ์ ๊ฐ์๊ฐ ๋ง์ ์๋ก ํ๋์ ๋ฉ์๋์์ ํ๋ ์ผ์ด ๋ง์์ง ์ ์๊ณ ์ฝ๋๋ฅผ ์ฝ๊ธฐ ์ด๋ ค์์ง๊ธฐ ๋๋ฌธ์
๋๋ค :) |
@@ -0,0 +1,50 @@
+package step1;
+
+import java.util.List;
+
+public class Calculator {
+
+ private CalculatorResource calculatorResource;
+
+ public Calculator(String stringCalculatorSentence) {
+ this.calculatorResource = new CalculatorResource(stringCalculatorSentence);
+ }
+
+ public int calculat... | Java | `๊ณ์ฐ๊ธฐ`๊ฐ ํ๋์ `๊ณ์ฐ๊ธฐ ์์`์ ์ํ๋ก ๊ฐ์ง๋๋ก ๊ตฌํํ์
จ๋ค์ !
๋ง์ฝ ๊ณ์ฐ๊ธฐ๊ฐ ๋ ๋ค๋ฅธ ์์์ ๋ํ ๊ณ์ฐ์ ํด์ผํ๋ ์ํฉ์ด๋ผ๋ฉด ์ด๋ป๊ฒ ํด์ผํ ๊น์?
ํ์ฌ ์ํ์์๋ ํ๋์ ๊ณ์ฐ๊ธฐ ๊ฐ์ฒด๊ฐ ํ๋์ ์์๋ง์ ๊ณ์ฐํ ์ ์๋๋ฐ์.
์ฌ๋ฌ ๊ฐ์ ์์์ ๋ํด ๊ณ์ฐํ ์ ์๋๋ก ๊ฐ์ ํด๋ณด๋ฉด ์ข์ ๊ฒ ๊ฐ์ต๋๋ค :) |
@@ -0,0 +1,64 @@
+package step1;
+
+import java.util.ArrayList;
+import java.util.List;
+
+public class CalculatorResource {
+
+ private String sentence;
+ private String[] sentenceArray;
+ private List<Integer> numberArray;
+ private List<String> operatorArray;
+
+ public List<Integer> getNumberArray() ... | Java | CalculatorResource ํด๋์ค ๋ค์ด๋ฐ์ ์ถ์ํ๊ฐ ๋ง์ด ๋์ด ์๋ ํด๋์ค ๋ช
์
๋๋ค.
ํด๋์ค ๋ด๋ถ๋ฅผ ๋ณด์ง ์์ผ๋ฉด ์ด๋ค ์ํ๋ฅผ ๊ฐ์ง๊ณ ์๋์ง ์ ์ถํ๊ธฐ ํ๋ญ๋๋ค. ์กฐ๊ธ ๋ ๊ตฌ์ฒด์ ์ธ ํด๋์ค ๋ช
์ ๋ง๋ค์ด๋ณด๋ฉด ์ข์ ๊ฒ ๊ฐ์์ :) |
@@ -0,0 +1,64 @@
+package step1;
+
+import java.util.ArrayList;
+import java.util.List;
+
+public class CalculatorResource {
+
+ private String sentence;
+ private String[] sentenceArray;
+ private List<Integer> numberArray;
+ private List<String> operatorArray;
+
+ public List<Integer> getNumberArray() ... | Java | ๊ฐ์ฒด๊ฐ ์์ฑ๋ ์ดํ์ ๋ ๋ณ์๋ ์ฌ์ฉ๋์ง ์๊ณ ์๋ค์! ๐ค
๊ทธ๋ ๋ค๋ฉด ๊ณ์ฐ๊ธฐ ์์ํด๋์ค์์ sentence์ sentenceArray๋ฅผ ์ํ๋ก ๊ฐ์ง๊ณ ์์ ํ์๊ฐ ์์๊น์? |
@@ -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 '../../src/constants/event';
+import EventPlanner from '../../src/services/EventPlanner';
+
+const ORDERS = [
+ { menu: '์์ก์ด์ํ', amount: 1 },
+ { menu: 'ํํ์ค', amount: 1 },
+ { menu: 'ํฐ๋ณธ์คํ
์ดํฌ', amount: 2 },
+ { menu: '์ด์ฝ์ผ์ดํฌ', amount: 1 },
+ { menu: '์์ด์คํฌ๋ฆผ', amount: 1 },... | 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 | isWeekend === true๋ ๋ถํ์ํด ๋ณด์ด๋๋ฐ, ์ฌ์ฉํ์ ์ด์ ๊ฐ ์์ผ์ ๊ฐ์? |
@@ -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,47 @@
+import { Console } from '@woowacourse/mission-utils';
+import MESSAGES from '../constants/messages.js';
+
+const OutputView = {
+ printResult(msgObj, result) {
+ const { title, printMsg } = msgObj;
+
+ Console.print(title);
+ Console.print(printMsg(result));
+ },
+
+ printStart() {
+ Co... | JavaScript | ์ด๋ฐ์์ผ๋ก ๋ณด๋ด๋ฉด ์กฐ๊ธ ๋ ๊น๋ํด์ง๋๊ตฐ์...!!! |
@@ -0,0 +1,94 @@
+import OrderItem from './OrderItem.js';
+
+import MESSAGES from '../constants/messages.js';
+
+import throwError from '../utils/throwError.js';
+import {
+ hasDuplicatedMenu,
+ hasOnlyBeverages,
+ isTotalAmountOfMenusValid,
+} from '../utils/validators.js';
+
+class Receipt {
+ #orders;
+
+ #orde... | JavaScript | get์ ์ฌ์ฉ๋ฒ ๋ฐฐ์ฐ๊ณ ๊ฐ๋๋ค...! |
@@ -0,0 +1,46 @@
+import MESSAGES from '../constants/messages.js';
+import { CATEGORIES, MENUS } from '../constants/menus.js';
+
+import { getValueOfField } from '../utils/object.js';
+import throwError from '../utils/throwError.js';
+import { isMenuExists } from '../utils/validators.js';
+
+class OrderItem {
+ #categ... | JavaScript | get set ํจ์๋ฅผ ์ด๋ ๊ฒ ์ง์ ํ ์ ์๋ค๋ ๊ฑธ ์ฒ์ ์๊ฒ๋์๋ค์! |
@@ -0,0 +1,38 @@
+/**
+ * ๋ ๊ฐ์ฒด๊ฐ ๊ฐ์ ๊ฐ์ ๊ฐ์ง๊ณ ์๋์ง ์๊ฒ ๋น๊ต
+ * @param {object} obj1
+ * @param {object} obj2
+ */
+export const shallowEqual = (objA, objB) => {
+ let result = true;
+
+ // ๋ ๊ฐ์ฒด์ key ๊ฐ์ ๋น๊ต
+ const keysA = Object.keys(objA);
+ const keysB = Object.keys(objB);
+ if (keysA.length !== keysB.length) result = f... | JavaScript | ๋ด์ฉ ์ ๋ดค์ต๋๋ค ใ
ใ
|
@@ -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 | ๋ฌผ๋ก Truthy๋ฅผ ์ฌ์ฉํ ์๋ ์๋ ์ํฉ์ด์ง๋ง, ์ค์ ๋ก ์ด์ํ๋ ์๋น์ค๋ผ๋ฉด ์ํ๊ฐ ์ด์ํ๊ฑฐ๋ ์๋ฒ์์ ์๋ชป๋ ๊ฐ์ด ๋ ์์์ ๋ ์ก์ ์ ์๋ ์ฝ๋์ฌ์ผ ํ๋ค๊ณ ์๊ฐํ์ต๋๋ค! ๊ทธ๋์ ํ์
๊ณผ ๊ฐ์ ์ ํํ ๊ฒ์ฌํ๋ ๋ฐฉ์์ผ๋ก ์์ฑํ์ด์. |
@@ -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 | ๋น์ฆ๋์ค์ ๊ด๋ จํ ์ค์ํ ๋ก์ง์ด๊ธฐ ๋๋ฌธ์ ๊ทธ ์ ๋ณด๊ฐ ๋น ๋ฅด๊ฒ ๋ณด์ฌ์ผ ํ๋ฉด์ ๋ค๋ฅธ ๊ณณ์์ ์ฌ์ฌ์ฉ๋์ง ์๋ ์๋ ์์๋ก ๋นผ์ง ์์์ต๋๋ค.
๋ง์ฝ '์ฆ์ ํ ์๋ น ์ต์ ์ฃผ๋ฌธ ๊ธ์ก'์ด๋ผ๋ ์ด๋ฆ์ ์์๋ฅผ ๋ง๋ ๋ค๋ฉด ๊ทธ ์๋ฏธ๋ ๋ด๊ณ ์๊ฒ ์ง๋ง, ๊ทธ๊ฒ ์ผ๋ง์ธ์ง ์๊ธฐ ์ํด์๋ ๋ค๋ฅธ ํ์ผ์ ์ด์ด ๋ณด๊ฑฐ๋ ์์ ์ ์ด๋ํด์ผ ํ๋ ๋ถํธํจ์ด ์๊ธธ ๊ฑฐ๋ผ ์๊ฐํ์ต๋๋ค. :)
๋น์ทํ ๊ฒฐ์ ์ ๋ด๋ฆฐ ์ฌ๋ก๋ก EventPlanner์ getBadge ํจ์๊ฐ ์์ต๋๋ค.๐ |
@@ -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 | ์ํ ๊ทธ๋ ๊ตฐ์. ๊ทธ๋ ๋ค๋ฉด ์ด๋ ๊ฒ๋ ์ด๋ ์ ๊ฐ์?
```
isEventAvailable({ totalPrice }) {
const evenAvaliableAmount = 120_000;
return totalPrice >= evenAvaliableAmount;
```
๋ถํ์ํ ํ ์ค์ด๋ผ๊ณ ์๊ฐํ์ค ์ ์์ง๋ง, ๋ง์ํ์ ๋ฌธ์ ๋ฅผ ํด๊ฒฐํ๋ฉด์๋ ์๋ฏธ๋ฅผ ๋ด์ ์ ์๋ค๊ณ ์๊ฐํ์ต๋๋ค! |
@@ -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,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 | EVENT_MONTH๋ ์์๋ณด๋ค๋ 12์๋ก ๋ฐ๋ก ๋ฃ๋ ๊ฒ๋ ๊ณ ๋ คํด๋ณด์๋ฉด ์ข์ ๊ฒ ๊ฐ์์
์ด ๋ถ๋ถ์ ๋ํด์ ๋ง์ด ๊ณ ๋ฏผํ์๋๋ฐ, ํด๋น ํฌ๋ฆฌ์ค๋ง์ค ์ด๋ฒคํธ๋ ๋ด๋
์๋ ๊ฐ์ต๋ ์ ์์ผ๋๊น ๋
๋๋ ๋ฐ๋๋๋ผ๋, ํฌ๋ฆฌ์ค๋ง์ค๋๊น 12์์ ์๋ณํ๊ฒ ๋ค ์ถ์์ต๋๋ค! |
@@ -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 | toLocaleString ๋ถ๋ถ์ด ๊ฐ๊ฒฉ์ ๋ฐํํด์ค๋๋ ๋ค ์ฐ์ด๋๋ฐ, ๋ฐ๋ก ๋ชจ๋ํ ์ํค๋ ๊ฒ๋ ์ข์ ๊ฒ ๊ฐ์์! |
@@ -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 | ๋ฐ์์๋ `totalBenefitMoney`๋ก ์์ธํ๊ฒ ๋ฉ์๋๋ช
์ ์ง์ผ์
์ ์ด๊ฒ๋ `benefits`๋ณด๋ค๋ `benefitsDetail`๋ก ์ข๋ ๊ตฌ์ฒด์ ์ธ๊ฑด ์ด๋จ๊น์? |
@@ -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 | `Period` ๊ผผ๊ผผํ์ญ๋๋ค! ๐๐๐ |
@@ -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 | new Date(2023,11,25)๋ฑ์ผ๋ก๋ ๋ฃ์ ์ ์์ต๋๋ค! ๊ทธ๋ฐ๋ฐ month์ ๊ฒฝ์ฐ 0์ผ๋ก ์์ํด์ 1๋นผ์ค์ผ ํ๋๋ผ๊ตฌ์... |
@@ -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,1,2,~ ๋์ FRIDAY๋ก ๋ฐ๊พธ๋๊น ํจ์ฌ ๊ฐ๋
์ฑ ์ข์์ง๋ค์! ๋ฐฐ์๊ฐ๋๋ค!๐๐๐ |
@@ -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 | 1_000, 1000 ์ค์ ํ๋๋ก ํต์ผํ๋ฉด ์ข์ ๊ฒ ๊ฐ์์! |
@@ -0,0 +1,94 @@
+import OrderItem from './OrderItem.js';
+
+import MESSAGES from '../constants/messages.js';
+
+import throwError from '../utils/throwError.js';
+import {
+ hasDuplicatedMenu,
+ hasOnlyBeverages,
+ isTotalAmountOfMenusValid,
+} from '../utils/validators.js';
+
+class Receipt {
+ #orders;
+
+ #orde... | JavaScript | ํน์ ์ฌ๊ธฐ ๊ณต๋ฐฑ์ด ์๋ ์ด์ ๊ฐ ์์๊น์?? |
@@ -0,0 +1,94 @@
+import OrderItem from './OrderItem.js';
+
+import MESSAGES from '../constants/messages.js';
+
+import throwError from '../utils/throwError.js';
+import {
+ hasDuplicatedMenu,
+ hasOnlyBeverages,
+ isTotalAmountOfMenusValid,
+} from '../utils/validators.js';
+
+class Receipt {
+ #orders;
+
+ #orde... | JavaScript | ๊ตฌ์กฐ๋ถํด ํ ๋น ์ ์ฐ์ญ๋๋น! ๐ |
@@ -0,0 +1,144 @@
+import EventCalendar from '../domain/EventCalendar.js';
+import Receipt from '../domain/Receipt.js';
+
+import {
+ EVENT_MONTH,
+ EVENT_NAMES,
+ EVENT_PERIOD,
+ EVENT_YEAR,
+} from '../constants/event.js';
+import MESSAGES from '../constants/messages.js';
+
+import { isInteger, isNumberInRange } ... | JavaScript | ํด๋น ๋ถ๋ถ์ ๋ฐ๋ก ๊ฐ์ฒด๋ก ๊ด๋ฆฌํด๋ ์ข์ ๊ฒ ๊ฐ์์! |
@@ -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 | ์ฝ๋๋ฆฌ๋ทฐ์ ์์, ๊ฐ์ฒด ๊ธฐ๋ฅ๋ณ๋ก ๋ถ๋ฆฌ๋์ด ์์ด ์ ์ฒด ๋น์ฆ๋์ค ๋ก์ง ๋ฐ ๊ฐ ๊ฐ์ฒด์ ์ญํ ์ ํ์
ํ๊ธฐ ํธ๋ฆฌํ์ด์ ๐ |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.