code stringlengths 41 34.3k | lang stringclasses 8
values | review stringlengths 1 4.74k |
|---|---|---|
@@ -0,0 +1,48 @@
+package store.domain;
+
+import static store.global.constant.MessageConstant.FORMAT;
+
+import java.text.DecimalFormat;
+
+public class PaymentProduct {
+
+ private static final DecimalFormat PRICE_FORMAT = new DecimalFormat("###,###");
+
+ private final String name;
+ private final int quant... | Java | promotion ๋ณ์์ ์ ํํ ๋ป์ด ๋ฌด์์ธ๊ฐ์?
ํ๋ก๋ชจ์
์ฌ๋ถ์ธ๊ฐ์? ํ๋ก๋ชจ์
๊ฐ๊ฒฉ์ธ๊ฐ์? ๊ตณ์ด int ํ์
์ผ๋ก ์์ฑํ์ ์ด์ ๊ฐ ๊ถ๊ธํฉ๋๋ค! |
@@ -0,0 +1,89 @@
+package store.domain;
+
+import static store.global.constant.MessageConstant.FORMAT;
+
+import java.text.DecimalFormat;
+import java.util.ArrayList;
+import java.util.List;
+
+public class PaymentProductList {
+
+ private static final DecimalFormat PRICE_FORMAT = new DecimalFormat("###,###");
+
+ ... | Java | ์ฐ์ํํ
ํฌ์ฝ์ค์ ๊ณตํต ํผ๋๋ฐฑ์์ ๋ณ์๋ช
์ ์๋ฃํ(List) ๊ฐ์ ๊ฑธ ๋ฃ์ง ๋ง๋ผ๊ณ ํ๋๋ฐ, ์ด์ ๋ํด ๋ณ์๋ ์๋์ง๋ง PaymentProductList ๋ผ๋ ํด๋์ค ๋ช
์ ๋ํด ์ด๋ป๊ฒ ์๊ฐํ์๋์? |
@@ -0,0 +1,89 @@
+package store.domain;
+
+import static store.global.constant.MessageConstant.FORMAT;
+
+import java.text.DecimalFormat;
+import java.util.ArrayList;
+import java.util.List;
+
+public class PaymentProductList {
+
+ private static final DecimalFormat PRICE_FORMAT = new DecimalFormat("###,###");
+
+ ... | Java | ์ฌ๊ธฐ์ - ๊ฐ์ ๊ฒ์ ์์๋ก ์ฒ๋ฆฌํ๋ ๊ฒ์ด ๋์ ๊ฒ ๊ฐ์๋ฐ ์ด๋ป๊ฒ ์๊ฐํ์๋์? |
@@ -0,0 +1,89 @@
+package store.domain;
+
+import static store.global.constant.MessageConstant.FORMAT;
+
+import java.text.DecimalFormat;
+import java.util.ArrayList;
+import java.util.List;
+
+public class PaymentProductList {
+
+ private static final DecimalFormat PRICE_FORMAT = new DecimalFormat("###,###");
+
+ ... | Java | ์ ์ฒด์ ์ผ๋ก ์ฌ๊ธฐ 8000 ์ด๋ผ๋ ์ซ์๋ ๊ทธ๋ ๊ณ , ์์ํ๋ฅผ ํ์ผ๋ฉด ๋ ๊ฐ๋
์ฑ์ด ์ข์์ ๊ฒ ๊ฐ์์! |
@@ -0,0 +1,83 @@
+package store.domain;
+
+import java.time.LocalDate;
+import store.domain.product.Name;
+import store.domain.product.Price;
+import store.domain.product.Quantity;
+
+public class Product {
+
+ private static final String INFO_DELIMITER = " ";
+
+ private final Name name;
+ private final Price... | Java | ๋ชจ๋ ํ๋๊ฐ ๋ํ๋์ด ์๋ ๊ฒ์ด ๊ฐ๋
์ฑ๊ณผ ๋ก์ง ๋ถ๋ฆฌ์ ์ข์ ์ํฅ์ ๋ผ์น๋ ๊ฒ ๊ฐ์์! ๐ |
@@ -0,0 +1,46 @@
+package store.domain;
+
+import java.time.LocalDate;
+
+public class Promotions {
+
+ private final String name;
+ private final int buy;
+ private final int get;
+ private final LocalDate startDate;
+ private final LocalDate endDate;
+
+ public Promotions(String name, String buy, St... | Java | ์ ๋ ๊ถ๊ธํฉ๋๋ค! |
@@ -0,0 +1,32 @@
+package store.global.constant;
+
+public enum ErrorMessage {
+ INVALID_INPUT_PURCHASE("์ฌ๋ฐ๋ฅด์ง ์์ ํ์์ผ๋ก ์
๋ ฅํ์ต๋๋ค. ๋ค์ ์
๋ ฅํด ์ฃผ์ธ์."),
+ INVALID_INPUT("์๋ชป๋ ์
๋ ฅ์
๋๋ค. ๋ค์ ์
๋ ฅํด ์ฃผ์ธ์."),
+
+ INVALID_PRICE_NUMERIC("๋ฌผํ ๊ฐ๊ฒฉ์ ์ซ์๋ง ๊ฐ๋ฅํฉ๋๋ค. ๋ค์ ํ์ธํด ์ฃผ์ธ์."),
+ INVALID_PRICE_OUT_OF_RANGE("๋ฌผํ ๊ฐ๊ฒฉ์ ๋ฒ์๋ด๋ง ๋ฑ๋กํ ์ ์์ต๋๋ค. ๋ค์ ํ์ธํด ์ฃผ์ธ์... | Java | ์ด๋ ๊ฒ [ERROR]์ ํ๋ฒ์ ์ฒ๋ฆฌํ๋ ๋ฐฉ์ ์ข๋ค์. |
@@ -0,0 +1,13 @@
+package store.global.exception;
+
+import store.global.constant.ErrorMessage;
+
+public class FileException extends RuntimeException {
+ public FileException(ErrorMessage error, String fileName) {
+ super(String.format(error.getMessage(), fileName));
+ }
+
+ public FileException(ErrorM... | Java | FileExceiption์ ๋ฐ๋ก ์ ์ํ์ ์ด์ ๊ฐ ์์๊น์? ๊ถ๊ธํฉ๋๋ค. |
@@ -0,0 +1,61 @@
+package store.global.util;
+
+import java.util.ArrayList;
+import java.util.List;
+import store.domain.Product;
+import store.domain.PromotionsList;
+import store.domain.product.Name;
+import store.domain.product.Price;
+import store.domain.product.Quantity;
+
+public class ProductParser {
+ privat... | Java | ์ ๋ FileUtil์์ ์ฌ์ค ๋ชจ๋ ํ์ฑ๋ ์ฒ๋ฆฌํ๋๋ก ์์ฑํ๋๋ฐ, ์ด๋ ๊ฒ Parser์ ๋ฐ๋ก ๊ตฌ๋ถํ๋ ๊ฒ์ด ๋ ์ข์ ์ค๊ณ์ธ ๊ฒ ๊ฐ์ต๋๋ค! ์นญ์ฐฌํด์ :) |
@@ -0,0 +1,185 @@
+package pairmatching.controller;
+
+import java.util.function.Function;
+import org.mockito.internal.util.Supplier;
+import pairmatching.enums.Course;
+import pairmatching.enums.Crew;
+import pairmatching.enums.Functions;
+import pairmatching.enums.Level;
+import pairmatching.enums.Missions;
+import ... | Java | ```suggestion
if (Functions.isEquals(input, Functions.QUIT)) {
performFunctions(input, inputView);
return
}
```
์ฌ์ํ๊ฑฐ์ง๋ง return์ ์ฌ์ฉํ๋ค๋ฉด ์๋์ if๋ฌธ์ ์๋ง๋ค๊ณ ์ฒ๋ฆฌํ ์ ์์์ ๊ฑฐ ๊ฐ์์ |
@@ -0,0 +1,34 @@
+package pairmatching.model;
+
+import java.util.List;
+import java.util.Map;
+import java.util.Set;
+
+public class Pairs {
+
+ private Map<String, List<String>> pairs;
+
+ public Pairs(Map<String, List<String>> pair){
+ this.pairs = pair;
+ }
+
+ public Set<Map.Entry<String, List<S... | Java | for-each์ string Joiner๋ฅผ ์จ์ ํด๊ฒฐํ์ด๋ ๋์๊ฑฐ ๊ฐ์์! |
@@ -54,11 +54,20 @@ export const REVIEW_GROUP_API_PARAMS = {
},
};
+export const WRITTEN_REVIEW_PARAMS = {
+ resource: 'reviews/authored',
+ queryString: {
+ lastReviewId: 'lastReviewId',
+ size: 'size',
+ },
+};
+
export const REVIEW_WRITING_API_URL = `${serverUrl}/${VERSION2}/${REVIEW_WRITING_API_PARA... | TypeScript | ```suggestion
if (!lastReviewId) return defaultEndpoint;
return defaultEndpoint + '&' + `${WRITTEN_REVIEW_PARAMS.queryString.lastReviewId}=${lastReviewId}`;
},
```
์ด๋ฐ ๊ตฌ์กฐ๋ก ๋ฐ๊พธ๋ฉด lastReviewId๊ฐ ์์ ๋ endpoint ๊ฐ์ ํ์
ํ๋๋ฐ ๋ ์ฌ์ธ ๊ฒ ๊ฐ๋ค์ |
@@ -6,11 +6,17 @@ import {
GroupedSection,
GroupedReviews,
ReviewInfoData,
+ WrittenReviewList,
} from '@/types';
import createApiErrorMessage from './apiErrorMessageCreator';
import endPoint from './endpoints';
+export interface GetInfiniteReviewListApi {
+ lastReviewId: number | null;
+ size: numbe... | TypeScript | ํจ์์ ํ๋ผ๋ฏธํฐ ํ์
์ด๋ผ์, ์ ๋ ์ด๋ด ๋ ํ์
๋ช
๋ค์ params๋ฅผ ์ถ๊ฐํ๋ ํธ์ด์์. |
@@ -0,0 +1,78 @@
+import { useMemo } from 'react';
+
+import { useGetDetailedReview, useReviewId } from '@/hooks';
+import { substituteString } from '@/utils';
+
+import QuestionAnswerSection from './QuestionAnswerSection';
+import ReviewDescription from './ReviewDescription';
+import * as S from './styles';
+
+interfa... | Unknown | sections ๊ด๋ จ๋ ๋ถ๋ถ ์ฝ๋๊ฐ ๊ธธ์ด์, header์ questions๋ฅผ ๋ถ๋ฆฌํ๊ณ ๊ฐ๊ฐ useMemo๋ฅผ ์ฌ์ฉํ๋ ๊ฒ์ ์ด๋จ๊น์'? |
@@ -0,0 +1,28 @@
+import { Country } from "../types/country";
+
+const CountryCard = ({
+ country,
+ handleToggleCountry,
+}: {
+ country: Country;
+ handleToggleCountry: (country: Country) => void;
+}) => {
+ return (
+ <div
+ className="flex flex-col border rounded gap-2 px-4"
+ onClick={() => handl... | Unknown | h2 ํ๊ทธ๋ฅผ ์ฌ์ฉํ๊ธฐ์ ๋๋ฌด ๋ง์ ์ง ๊ฒ ๊ฐ์๋ฐ, ์ ์ฒด์ ์ธ ๊ด์ ์ผ๋ก ๋ดค์๋ h2์ ๋ ๋ฒจ์ ๊ฐ์ง ํ
์คํธ๋ ์๋ ๊ฒ ๊ฐ์์์! strong ํ๊ทธ๋์ h2๋ฅผ ์ฐ์ ์ด์ ๊ฐ ๊ถ๊ธํฉ๋๋ค! |
@@ -0,0 +1,66 @@
+import { useQuery } from "@tanstack/react-query";
+import { getCountries } from "../api/countryAPI";
+import CountryCard from "./CountryCard";
+import { useEffect } from "react";
+import { Country } from "../types/country";
+import useCountryStore from "../zustand/countryStore";
+
+const CountryList =... | Unknown | early if pattern ์ถ์ฒ๋๋ฆฝ๋๋ค .. >_< |
@@ -0,0 +1,66 @@
+import { useQuery } from "@tanstack/react-query";
+import { getCountries } from "../api/countryAPI";
+import CountryCard from "./CountryCard";
+import { useEffect } from "react";
+import { Country } from "../types/country";
+import useCountryStore from "../zustand/countryStore";
+
+const CountryList =... | Unknown | countryList ์ปดํฌ๋ํธ๋ฅผ ๋ณด๋, ๋จ์ UI๋ง ์ ๊ณตํ๋ ๊ฒ์ด ์๋ ํต์ฌ ๋ก์ง๋ค์ ์ ๋ถ ๋ค ๊ฐ์ง๊ณ ์๋ ๊ฒ์ผ๋ก ๋ณด์
๋๋ค.
ํ์ผ๋ช
์ผ๋ก๋ง ๋ณด์์๋, UI ์ญํ ๋ง ํ๊ณ ์์ ๊ฒ์ผ๋ก ์ถ์ธก๋์๋๋ฐ ์ฌํ์ฉ ๊ฐ๋ฅํ ์ปดํฌ๋ํธ๋ ์๋ ๊ฒ ๊ฐ์์์~
๊ฐ์ธ์ ์ธ ์๊ฒฌ์ผ๋ก๋ List์๋ ๋จ์ ๋ด๋ ค์ค ๋ฐ์ดํฐ๋ฅผ ๋
ธ์ถํ๊ฒ๋ง ํ๊ณ , ๋น์ฆ๋์ค ๋ก์ง์ ์์์ ์ ๋ฌํด์ฃผ๋ ๊ฒ์ด ์ด๋ค์ง ์ฝ๋ฉํธ ๋๋ฆฝ๋๋ค! |
@@ -0,0 +1,15 @@
+import axios from "axios";
+import { Country } from "../types/country";
+
+export const countryApi = axios.create({
+ baseURL: "https://restcountries.com/v3.1",
+});
+
+export const getCountries = async (): Promise<Country[]> => {
+ try {
+ const response = await countryApi.get("/all");
+ retu... | TypeScript | ๋ณ๋ก ์ค์ํ ๊ฒ์ ์๋์ง๋ง ใ
ใ
throw new Error() ์๊ธฐ์ ๋ญ๊ฐ๋ฅผ ๋ฃ์ด์ฃผ์๋ฉด ์ข์์
```javascript
throw new Error(error.response?.data.message);
```
์ด๋ฐ์์ผ๋ก์ ใ
ใ
|
@@ -0,0 +1,66 @@
+import { useQuery } from "@tanstack/react-query";
+import { getCountries } from "../api/countryAPI";
+import CountryCard from "./CountryCard";
+import { useEffect } from "react";
+import { Country } from "../types/country";
+import useCountryStore from "../zustand/countryStore";
+
+const CountryList =... | Unknown | ํํฐ๋ฅผ ํ๊ธฐ ์ํ ์๋๋ก setCountries ๋ฅผ ๋ง๋ค์ด ๊ฐ์ ๋ณ๊ฒฝํ๊ณ ์๋ ๊ฒ์ผ๋ก ๋ณด์
๋๋ค!
favoriteCountries ๋ผ๋ ์ํ๋ฅผ ๋ฐ๋ก ์ง๋๊ณ ์๊ธฐ์ countries๋ฅผ ๋ณ๊ฒฝํ๋ ๊ฒ๋ณด๋ค ์๋์์ filter๋ง ํด์ฃผ๋ ๋ก์ง์ผ๋ก ๋ณ๊ฒฝํ๋ ๊ฒ์ด ์ด๋จ์ง ์ ์ ๋๋ฆฝ๋๋ค! |
@@ -0,0 +1,66 @@
+import { useQuery } from "@tanstack/react-query";
+import { getCountries } from "../api/countryAPI";
+import CountryCard from "./CountryCard";
+import { useEffect } from "react";
+import { Country } from "../types/country";
+import useCountryStore from "../zustand/countryStore";
+
+const CountryList =... | Unknown | ์ด๊ฒ๋ ์์ฃผ ์ฌ์ํ ๊ฑฐ์ง๋ง ใ
ใ
isDone ๋ณด๋ค isFavorite ์ด ์๊ธฐ ์ฌ์ธ๊ฒ ๊ฐ์์ฉใ
ใ
|
@@ -0,0 +1,66 @@
+import { useQuery } from "@tanstack/react-query";
+import { getCountries } from "../api/countryAPI";
+import CountryCard from "./CountryCard";
+import { useEffect } from "react";
+import { Country } from "../types/country";
+import useCountryStore from "../zustand/countryStore";
+
+const CountryList =... | Unknown | ๋์ผํฉ๋๋ค! |
@@ -0,0 +1,18 @@
+import CountryList from "../components/CountryList";
+
+const Home = () => {
+ return (
+ <>
+ <h1 className="flex justify-center items-center mt-8 mb-8 text-2xl font-bold">
+ Favorite Countries
+ </h1>
+ <CountryList isDone={true} />
+ <h1 className="flex justify-center... | Unknown | h1์ด ๋๋ฌด ๋ง์ต๋๋ค! ํ์ด์ง์ ํ๋๋ง ์กด์ฌํด์ผํฉ๋๋ค.
ํ์ง๋ง ์ฝ๋์์๋ ํผ๋์ ์ผ๊ธฐํ ์ ์๋ ํค๋ฉํ๊ทธ๋ฅผ ์ง์ํ๋ ๊ฒ์ ์ ์๋๋ฆฝ๋๋ค :) |
@@ -0,0 +1,15 @@
+import axios from "axios";
+import { Country } from "../types/country";
+
+export const countryApi = axios.create({
+ baseURL: "https://restcountries.com/v3.1",
+});
+
+export const getCountries = async (): Promise<Country[]> => {
+ try {
+ const response = await countryApi.get("/all");
+ retu... | TypeScript | ์ ๊ฐ ์ด๋ฒ์ ์ค์ค๋ก ์จ๋ณธ๊ฑด ์ฒ์์ด๋ผ ์ ๋ชฐ๋๋๋ฐ ์๋ ์ฝ๋ ๋ณด๋ฉด์ ๊นจ๋ฌ์์ต๋๋ค ๊ฐ์ผ๋ |
@@ -0,0 +1,66 @@
+import { useQuery } from "@tanstack/react-query";
+import { getCountries } from "../api/countryAPI";
+import CountryCard from "./CountryCard";
+import { useEffect } from "react";
+import { Country } from "../types/country";
+import useCountryStore from "../zustand/countryStore";
+
+const CountryList =... | Unknown | ์๋ง ๊ณต๋ถ๋ฅผ ์ํด์ ํ์ ๋ฏ ํฉ๋๋ค๋ง..!
zustand ์คํ ์ด์ countries ์ favoriteCountries ๊ฐ ์๊ณ ์ค์ ๋ก
```javascript
const isDoneCountries = isDone ? favoriteCountries : countries;
```
์ด๋ฐ ๋ถ๋ถ์์๋ useQuery ์ data ๋ฅผ ๋ฐ๋ก ์ฐ์ง๋ ์์ผ๋, ์ด๋ฐ ๊ฒฝ์ฐ๋ผ๋ฉด tanstack์ ์์ฐ๋ ๋ฐฉํฅ๋ ์์ ๊ฒ ๊ฐ์ต๋๋ค~
๋ฌผ๋ก ๊ณต๋ถ์ฉ์ด๊ธฐ ๋๋ฌธ์ ๋ฌด์ํ์
๋ ๋ฉ๋๋ค ^^;; |
@@ -0,0 +1,28 @@
+import { Country } from "../types/country";
+
+const CountryCard = ({
+ country,
+ handleToggleCountry,
+}: {
+ country: Country;
+ handleToggleCountry: (country: Country) => void;
+}) => {
+ return (
+ <div
+ className="flex flex-col border rounded gap-2 px-4"
+ onClick={() => handl... | Unknown | ์ ๊ทธ๋ฅ..h1๋ฐ์ ํ์๋ก ์๋ค ์๊ฐํด์ ์๋ฌด ์๊ฐ์์ด h2๋ฅผ ์ด๊ฒ๋๋ค.. ๊ทธ๋ ๊ตฐ์ฌ.. html css์ ๋ํด์ ๋ฐ๋ก ๊ณต๋ถ๋ฅผ ์ํ๊ณ ํ์ํ ๋๋ง๋ค ๊ทธ๋ฅ ๊ทธ ๋ ๊ทธ๋ ์ฐ๋ค๋ณด๋ ์ด๋ฐ ๋ถ๋ถ์ด ์์ง ๋ง์ด ๋ฏธํกํ๋ฏํ๋ค์ฌ ํ... |
@@ -0,0 +1,66 @@
+import { useQuery } from "@tanstack/react-query";
+import { getCountries } from "../api/countryAPI";
+import CountryCard from "./CountryCard";
+import { useEffect } from "react";
+import { Country } from "../types/country";
+import useCountryStore from "../zustand/countryStore";
+
+const CountryList =... | Unknown | ์ค์ค ๊ฐ์ ์๊ฐ์
๋๋ค~~ |
@@ -0,0 +1,66 @@
+import { useQuery } from "@tanstack/react-query";
+import { getCountries } from "../api/countryAPI";
+import CountryCard from "./CountryCard";
+import { useEffect } from "react";
+import { Country } from "../types/country";
+import useCountryStore from "../zustand/countryStore";
+
+const CountryList =... | Unknown | ๋ง๋ ๋ง์์
๋๋ค ํจ์ฌ ์ข๊ฒ๊ตฐ์ฌ |
@@ -0,0 +1,18 @@
+import CountryList from "../components/CountryList";
+
+const Home = () => {
+ return (
+ <>
+ <h1 className="flex justify-center items-center mt-8 mb-8 text-2xl font-bold">
+ Favorite Countries
+ </h1>
+ <CountryList isDone={true} />
+ <h1 className="flex justify-center... | Unknown | h1ํ๊ทธ๋ ํ์ด์ง๋น 1๊ฐ๋ง ์จ์ผํ๋์ง ๋ชฐ๋๋ค์ฌ... ๋ช
์ฌํ๊ฒ ์ต๋๋น |
@@ -0,0 +1,15 @@
+import axios from "axios";
+import { Country } from "../types/country";
+
+export const countryApi = axios.create({
+ baseURL: "https://restcountries.com/v3.1",
+});
+
+export const getCountries = async (): Promise<Country[]> => {
+ try {
+ const response = await countryApi.get("/all");
+ retu... | TypeScript | ์ฃผ์ :: ํ์
์คํฌ๋ฆฝํธ ์ ๋ชฐ๋ผ์ ์ด์ํ ์๋ฆฌ์ผ ์ ์์ต๋๋ค ใ
getCountires ํจ์์ ๋ฐํ๊ฐ์ด Promise<Country[]>์์ ๋ช
์ํด์ฃผ๊ณ ๊ณ์๋ ๊ฒ ๊ฐ์ต๋๋ค.
์ ๋ ์ด๋ฒ API ๊ตฌ์กฐ๊ฐ ๋ณต์กํด์์ธ์ง ๋ฌด์จ ์๋ฌ์๋์ง ์์ธํ ๊ธฐ์ต์ ์ ๋์ง๋ง ์๋ฌ๋ฅผ ๊ณ์ ๊ฒช์์ต๋๋ค~!
try๋ฌธ ์์์ get ์์ฒญ ๋ถ๋ถ์ ๋ณด๋ฉด ์๋ต๊ฐ์ ํ์
์ง์ ์ด ์ ๋์ด ์๋๋ฐ, ์ ๋ ์ด ๋ถ๋ถ์์ ๋ฌธ์ ๋ฅผ ํด๊ฒฐํ ์ ์์๋ ๊ฒ์ผ๋ก ๊ธฐ์ตํฉ๋๋ค!
`const response = await countryApi.get<Country[]>("/all");`
์๋ฅผ ๋ค์ด์ dat... |
@@ -0,0 +1,66 @@
+import { useQuery } from "@tanstack/react-query";
+import { getCountries } from "../api/countryAPI";
+import CountryCard from "./CountryCard";
+import { useEffect } from "react";
+import { Country } from "../types/country";
+import useCountryStore from "../zustand/countryStore";
+
+const CountryList =... | Unknown | ํํ์ด์ง ๊ด๋ จํด์ ์ ์ด์ฃผ์ ๊ฒ์ฒ๋ผ ํ๊ทธ ์ด๋ฆ์ ๋ฐ๊พธ๋๊ฒ ์ข๋ค๋ ๋ง์์ด์ ๊ฐ์? |
@@ -0,0 +1,28 @@
+import { Country } from "../types/country";
+
+const CountryCard = ({
+ country,
+ handleToggleCountry,
+}: {
+ country: Country;
+ handleToggleCountry: (country: Country) => void;
+}) => {
+ return (
+ <div
+ className="flex flex-col border rounded gap-2 px-4"
+ onClick={() => handl... | Unknown | ์ฐธ๊ณ :
- https://techblog.woowahan.com/15541/
- https://webactually.com/2020/03/03/%3Csection%3E%EC%9D%84-%EB%B2%84%EB%A6%AC%EA%B3%A0-HTML5-%3Carticle%3E%EC%9D%84-%EC%8D%A8%EC%95%BC-%ED%95%98%EB%8A%94-%EC%9D%B4%EC%9C%A0/ |
@@ -0,0 +1,66 @@
+import { useQuery } from "@tanstack/react-query";
+import { getCountries } from "../api/countryAPI";
+import CountryCard from "./CountryCard";
+import { useEffect } from "react";
+import { Country } from "../types/country";
+import useCountryStore from "../zustand/countryStore";
+
+const CountryList =... | Unknown | ๊ทธ ์๊ฐ์ ๋ชปํด๋ดค๋๋ฐ ๋์ผํ ๊ฒฐ๊ณผ๊ฐ...๋์ค๋์ง ํด๋ณด๊ฒ ์ต๋๋ค ใ
ใ
... ํ๋ฒ์ ๋์์ผ๋ก ์ ์กฐ๊ฑด๋ฌธ์ ๊ฐ์ ํ๋ฉด ๋๊ฒ ๊ตฐ์ฌ! |
@@ -0,0 +1,66 @@
+import { useQuery } from "@tanstack/react-query";
+import { getCountries } from "../api/countryAPI";
+import CountryCard from "./CountryCard";
+import { useEffect } from "react";
+import { Country } from "../types/country";
+import useCountryStore from "../zustand/countryStore";
+
+const CountryList =... | Unknown | ์ด๊ฑด ์ ๊ฐ ๋ญ ๋ง์ํ์๋์ง ์ ๋ชฐ๋ผ์...ํ์ตํ๊ฒ ์ต๋๋ค ใ
.. |
@@ -0,0 +1,66 @@
+import { useQuery } from "@tanstack/react-query";
+import { getCountries } from "../api/countryAPI";
+import CountryCard from "./CountryCard";
+import { useEffect } from "react";
+import { Country } from "../types/country";
+import useCountryStore from "../zustand/countryStore";
+
+const CountryList =... | Unknown | ์ด ๋ถ๋ถ์ home.tsx์์๋ ์ ์ฒด์ ์ธ UI ๋ฐ ํ์ด์ง ๊ด๋ จ๋ง ๋ํ๋ด๊ณ List์์ Card๋ฅผ ํธ๋ค๋ง ํ ์ ์๋๋ก ์๊ฐ์ ํด์ ๋ก์ง์ ๊ตฌํํ๋๋ฐ ์ด๋ฐ ํธ๋ค๋ง ๋ก์ง์ home.tsx๊ฐ ๋ ์ ์ ํ๋จ ๋ง์์ด์ค๊น์ฌ?? |
@@ -0,0 +1,15 @@
+import axios from "axios";
+import { Country } from "../types/country";
+
+export const countryApi = axios.create({
+ baseURL: "https://restcountries.com/v3.1",
+});
+
+export const getCountries = async (): Promise<Country[]> => {
+ try {
+ const response = await countryApi.get("/all");
+ retu... | TypeScript | ์ ๊ทธ๋ ๊ตฐ์ฌ! ์ ๋ ์ผ๋จ jsํ๋ฏ์ด ์์ฑ ํ ํ์ strict๋ชจ๋๊ฐ ์ค์ ๋์ด์์ผ๋ ts์์ ์๋ก ๋ฐ์ํ ์ค๋ฅ์ ๋ง์ถฐ ์์ ํ์ด๊ฐ์ง๊ณ ๋ฐํ๊ฐ๋ง ๋ช
์ํ๊ณ ์ค๋ฅ๊ฐ ์ฌ๋ผ์ก๊ธธ๋ ๊ทธ ๋ถ๋ถ์ ๋ฏธ์ฒ ์๊ฐ์ ๋ชปํ์ต๋๋ค.
์๋ฌด๋๋ ๋ชจ๋ ๊ฐ์ ์ ํํ ํ์
์ ๋ช
์ํ๋๊ฑด ์ ๋ ํด์ผ๊ฒ ๋ค ์๊ฐํ๋๋ฐ ๊ฐ์ฌํฉ๋๋ค! |
@@ -0,0 +1,66 @@
+import { useQuery } from "@tanstack/react-query";
+import { getCountries } from "../api/countryAPI";
+import CountryCard from "./CountryCard";
+import { useEffect } from "react";
+import { Country } from "../types/country";
+import useCountryStore from "../zustand/countryStore";
+
+const CountryList =... | Unknown | prop ํ์
์ ์ธ๋ผ์ธ์ผ๋ก ์ ์ํ ์ด์ ๊ฐ ์๋์ง ๊ถ๊ธํฉ๋๋ค! |
@@ -0,0 +1,66 @@
+import { useQuery } from "@tanstack/react-query";
+import { getCountries } from "../api/countryAPI";
+import CountryCard from "./CountryCard";
+import { useEffect } from "react";
+import { Country } from "../types/country";
+import useCountryStore from "../zustand/countryStore";
+
+const CountryList =... | Unknown | ์...์๋ data๋ก mpa์ ๋๋ ธ์๋๋ฐ...;; ์ด๊ฒ isDone๊ฐ์ ๊ผญ ์จ๋ณด๋ ค๊ณ ๋
ธ๋ ฅํ๋ค๋ณด๋ ์ด์ฉ๋ค ๊ทธ๋ ๊ฒ ๋์์ต๋๋ค ใ
ใ
... ๋ง์๋๋ก ์ง๊ธ ์ฟผ๋ฆฌ๊ฐ ์ด๊ธฐ๊ฐ ๋ฃ์ด์ฃผ๋๊ฑฐ๋ง๊ณ ๋ฑํ ์์ฐ์ด๊ธดํฉ๋๋ค.. |
@@ -0,0 +1,66 @@
+import { useQuery } from "@tanstack/react-query";
+import { getCountries } from "../api/countryAPI";
+import CountryCard from "./CountryCard";
+import { useEffect } from "react";
+import { Country } from "../types/country";
+import useCountryStore from "../zustand/countryStore";
+
+const CountryList =... | Unknown | ์ ๋ ๊ถ๊ธํฉ๋๋ค..!!! |
@@ -0,0 +1,84 @@
+export interface Country {
+ name: {
+ common: string;
+ official: string;
+ nativeName: {
+ [key: string]: {
+ official: string;
+ common: string;
+ };
+ };
+ };
+ tld: string[];
+ cca2: string;
+ ccn3: string;
+ cca3: string;
+ cioc: string;
+ independent:... | TypeScript | ์ ๋ ์ฌ์ค ๋ชจ๋ ๋ฐ์ดํฐ๋ฅผ ๋ค ๋ณด์ง ์์์ง๋ง, ๋ช๋ช ๋ฐ์ดํฐ๋ ์ ํ์ ์ผ๋ก ๋ค์ด์ค๋ ๊ฒ ๊ฐ๋๋ผ๊ตฌ์..!! ๊ทธ๋์ ๋ชจ๋ ๋ฐ์ดํฐ์ ๋ค ๋ค์ด์ค๋ ๊ฒ์ด ์๋๋ผ๋ฉด ์ต์
๋์ ๋ถ์ฌ์ฃผ๋ฉด ์ข์ ๊ฒ ๊ฐ์ต๋๋ค..!! |
@@ -0,0 +1,89 @@
+package store.controller;
+
+import java.util.ArrayList;
+import java.util.List;
+import store.model.Order;
+import store.model.Promotion;
+import store.model.Receipt;
+import store.model.Store;
+import store.service.StoreService;
+import store.view.InputView;
+import store.view.OutputView;
+
+public ... | Java | order๋ฅผ do ๋ด๋ถ์์ ์ ์ธํ๋ ๊ฒ์ด ๋ ๊น๋ํ์ง ์์๊น ์๊ฐ์ด ๋๋ค์..!
checkEnd() ๋ด๋ถ์ updateStore() ๋ฅผ do ๊ตฌ๋ฌธ ๋ด๋ถ๋ก ์ด๋์ํจ๋ค๋ฉด ๊ฐ๋ฅํ ๊ฒ ๊ฐ์ต๋๋ค..! |
@@ -0,0 +1,59 @@
+package store.model;
+
+import static store.utils.ErrorMessage.INVALID_FORMAT;
+
+import java.util.ArrayList;
+import java.util.List;
+
+public class Order {
+ private List<Product> order;
+
+ public Order(String inputOrder) {
+ validateProductFormat(inputOrder);
+ this.order = gen... | Java | replaceAll() ์ด๋ผ๋ ๋ฉ์๋๋ก๋ ๊ฐ์ ๊ธฐ๋ฅ์ ๊ตฌํํ ์ ์์ต๋๋ค!
์ด๋ฏธ ์์ค์๋ ์์ง๋ง ํน์๋ ํด์ ๋ง์๋๋ฆฝ๋๋ค..! |
@@ -0,0 +1,73 @@
+package store.model;
+
+import camp.nextstep.edu.missionutils.DateTimes;
+import java.text.ParseException;
+import java.text.SimpleDateFormat;
+import java.util.Arrays;
+import java.util.Date;
+import java.util.List;
+
+public class Promotion {
+ private String name;
+ private int buy;
+ priv... | Java | `now.after(startDate) && now.before(endDate)` ๋ ๊ฐ์ ์๋ฏธ์ธ๋ฐ
ํ์ฌ ์ฝ๋์ฒ๋ผ ์์ฑํ์ ์ด์ ๊ฐ ์์ผ์ค๊น์?
๊ถ๊ธํด์ ์ง๋ฌธ๋๋ฆฝ๋๋ค..! |
@@ -0,0 +1,294 @@
+package store.service;
+
+import static store.model.Promotion.parsePromotions;
+import static store.model.Store.*;
+import static store.utils.ErrorMessage.INVALID_INPUT;
+import static store.utils.ErrorMessage.INVALID_NAME;
+import static store.utils.ErrorMessage.INVALID_QUANTITY;
+
+import java.io.B... | Java | ํ์ผ๋ช
์ ์์๋ก ์ฌ์ฉํ๋ค๋ฉด ๋ ์ข์ ๊ฒ ๊ฐ์ต๋๋ค! |
@@ -0,0 +1,294 @@
+package store.service;
+
+import static store.model.Promotion.parsePromotions;
+import static store.model.Store.*;
+import static store.utils.ErrorMessage.INVALID_INPUT;
+import static store.utils.ErrorMessage.INVALID_NAME;
+import static store.utils.ErrorMessage.INVALID_QUANTITY;
+
+import java.io.B... | Java | ๋ฆฌํฉํ ๋งํ๋ค๋ฉด ์ฌ๊ธฐ ์ํ์ ์๋์ ๊ตฌํ๋ ๋ถ๋ถ์
ํ๋์ ๋ฉ์๋๋ก ๋ถ๋ฆฌํ์๋ ๊ฒ๋ ์ข๊ฒ ๋ค์ |
@@ -0,0 +1,294 @@
+package store.service;
+
+import static store.model.Promotion.parsePromotions;
+import static store.model.Store.*;
+import static store.utils.ErrorMessage.INVALID_INPUT;
+import static store.utils.ErrorMessage.INVALID_NAME;
+import static store.utils.ErrorMessage.INVALID_QUANTITY;
+
+import java.io.B... | Java | ์๋ฐ ํ์ผ ์
์ถ๋ ฅ์ ์ฌ๋ฌ ๋ฐฉ๋ฒ์ด ์๋๋ฐ ๋ฒํผ๋ฆฌ๋ ํ์์ ์ฌ์ฉํ์ ์ด์ ๊ฐ ์์ผ์ค๊น์?? |
@@ -0,0 +1,294 @@
+package store.service;
+
+import static store.model.Promotion.parsePromotions;
+import static store.model.Store.*;
+import static store.utils.ErrorMessage.INVALID_INPUT;
+import static store.utils.ErrorMessage.INVALID_NAME;
+import static store.utils.ErrorMessage.INVALID_QUANTITY;
+
+import java.io.B... | Java | ํด๋น ๋ฉ์๋๋ ์๋น์ค๊ฐ ํ๋ ๊ธฐ๋ฅ ๋ณด๋ค๋ ๋ค๋ฅธ ํด๋์ค๋ก ์ฎ๊ธฐ๋๊ฒ ๋ ์ ํฉํด๋ณด์
๋๋ค..! |
@@ -0,0 +1,294 @@
+package store.service;
+
+import static store.model.Promotion.parsePromotions;
+import static store.model.Store.*;
+import static store.utils.ErrorMessage.INVALID_INPUT;
+import static store.utils.ErrorMessage.INVALID_NAME;
+import static store.utils.ErrorMessage.INVALID_QUANTITY;
+
+import java.io.B... | Java | ์ด ๋ถ๋ถ๋ ๋์ค์ receiptservice๋ก ๋ถ๋ฅํ๋ฉด ์ด๋จ๊น์..? |
@@ -0,0 +1,294 @@
+package store.service;
+
+import static store.model.Promotion.parsePromotions;
+import static store.model.Store.*;
+import static store.utils.ErrorMessage.INVALID_INPUT;
+import static store.utils.ErrorMessage.INVALID_NAME;
+import static store.utils.ErrorMessage.INVALID_QUANTITY;
+
+import java.io.B... | Java | Math.min์ ์ฌ์ฉํ์๋ฉด ํ์ค๋ก ๋ง๋ค์์์๊ฑฐ๊ฐ์์ |
@@ -0,0 +1,14 @@
+package store.utils;
+
+public class ErrorMessage {
+ public static final String ERROR = "[ERROR] ";
+ public static final String RETRY = " ๋ค์ ์
๋ ฅํด ์ฃผ์ธ์.";
+ public static final String INVALID_FORMAT = " ์ฌ๋ฐ๋ฅด์ง ์์ ํ์์ผ๋ก ์
๋ ฅํ์ต๋๋ค. ";
+ public static final String INVALID_NAME = " ์กด์ฌํ์ง ์๋ ์ํ์
๋๋ค.";
+... | Java | enum์ ์ฌ์ฉํ์ง ์๊ณ class๋ก ๋ถ๋ฆฌํ ์ด์ ๊ฐ ๊ถ๊ธํฉ๋๋ค |
@@ -0,0 +1,89 @@
+package store.controller;
+
+import java.util.ArrayList;
+import java.util.List;
+import store.model.Order;
+import store.model.Promotion;
+import store.model.Receipt;
+import store.model.Store;
+import store.service.StoreService;
+import store.view.InputView;
+import store.view.OutputView;
+
+public ... | Java | ํจ์๋ช
์ ๋์ฌ๋ก ํ๋ ๊ฑด ์ด๋จ๊น์?? ์๋ฅผ ๋ค์ด `calculatePrice` ์ฒ๋ผ ๋ง์ด์ฃ !! |
@@ -0,0 +1,91 @@
+package store.model;
+
+import java.util.Arrays;
+import java.util.List;
+
+public class Store {
+ private final String name;
+ private int price;
+ private int quantity;
+ private String promotion;
+
+ public Store(String name, int price, int quantity, String promotion) {
+ this... | Java | ๊ฐ๊ฐ์ ์ธ๋ฑ์ค๊ฐ ์ด๋ค ๊ฒ์ ์๋ฏธํ๋์ง ์์ํ ํ์ผ๋ฉด ๋ ์ข์์ ๊ฒ ๊ฐ์ต๋๋ค!!! |
@@ -0,0 +1,73 @@
+package store.model;
+
+import camp.nextstep.edu.missionutils.DateTimes;
+import java.text.ParseException;
+import java.text.SimpleDateFormat;
+import java.util.Arrays;
+import java.util.Date;
+import java.util.List;
+
+public class Promotion {
+ private String name;
+ private int buy;
+ priv... | Java | ๋ฌธ์์ด์ ํ๋ก๋ชจ์
์ผ๋ก ํ์ฑํ๋ ์ญํ ์ ํ์ฑํ๋ ๊ฐ์ฒด๋ฅผ ๋ง๋ค์ด์ ๊ฑฐ๊ธฐ๋ก ๋๊ธฐ๋๊ฑด ์ด๋จ๊น์!! |
@@ -0,0 +1,294 @@
+package store.service;
+
+import static store.model.Promotion.parsePromotions;
+import static store.model.Store.*;
+import static store.utils.ErrorMessage.INVALID_INPUT;
+import static store.utils.ErrorMessage.INVALID_NAME;
+import static store.utils.ErrorMessage.INVALID_QUANTITY;
+
+import java.io.B... | Java | answer์ enum ์์๋ก ๋ง๋๋ ๊ฒ์ ์ด๋จ๊น์? |
@@ -0,0 +1,59 @@
+package store.model;
+
+import static store.utils.ErrorMessage.INVALID_FORMAT;
+
+import java.util.ArrayList;
+import java.util.List;
+
+public class Order {
+ private List<Product> order;
+
+ public Order(String inputOrder) {
+ validateProductFormat(inputOrder);
+ this.order = gen... | Java | ๊ฐ์ธ์ ์ผ๋ก ์์ ์ ๋ค [ ] ํ์ธํ๋ ๋ถ๋ถ๊ณผ ๋น๋ฌธ์์ด์ธ์ง ํ์ธํ๋ ๋ก์ง์ ๋ถ๋ฆฌํด๋ ๋ ๊ฒ ๊ฐ์ต๋๋ค! |
@@ -0,0 +1,50 @@
+package store.model;
+
+public class Receipt {
+ private String name;
+ private int individualPrice;
+ private int quantity;
+ private int promotionQuantity;
+ private int promotionBuy;
+
+ public Receipt(String name, int individualPrice, int quantity, int promotionBuy) {
+ th... | Java | ์ด๋ฒ ๊ณผ์ ์์ ๊ฒํฐ ์ฌ์ฉ์ ์ค์ด๊ธฐ๊ฐ ์ฝ์ง ์์, ์ ๋ ๊ฒฐ๊ตญ ์ฌ์ฉํ ์๋ฐ์ ์์์ต๋๋คใ
ใ
๊ฒํฐ๋ฅผ ์ฌ์ฉํ๋ฉด ๊ฐ์ฒด์ ์บก์ํ๋ฅผ ์๋ฐํ ์ํ์ด ์๊ณ , ๊ฐ์ฒด์ ์ํ๋ฅผ ์ธ๋ถ์์ ์ฝ๊ฒ ๋ณ๊ฒฝํ ์ ์๊ฒ ๋์ด ๊ฐ์ฒด์ ์ฑ
์์ด ์ธ๋ถ๋ก ๋ฐ๋ ค๋ ์ ์๊ธฐ ๋๋ฌธ์ ์ง์ํด์ผ ํ๋ค๊ณ ์๊ณ ์์ต๋๋ค.
๊ทธ๋์ ์์ผ๋ก ๊ฒํฐ ์ฌ์ฉ์ ์ค์ด๊ธฐ ์ํด DTO๋ฅผ ํ์ฉํด๋ณด๋ ๊ฒ๋ ์ข์ ๋ฐฉ๋ฒ์ด ๋ ๊ฒ ๊ฐ์ต๋๋ค! |
@@ -0,0 +1,294 @@
+package store.service;
+
+import static store.model.Promotion.parsePromotions;
+import static store.model.Store.*;
+import static store.utils.ErrorMessage.INVALID_INPUT;
+import static store.utils.ErrorMessage.INVALID_NAME;
+import static store.utils.ErrorMessage.INVALID_QUANTITY;
+
+import java.io.B... | Java | ์๋น์ค์์ View๋ฅผ ํธ์ถํ๋๊ฑด ๊ฐ์ธ์ ์ผ๋ก layered architecture๊ตฌ์กฐ์ ์ ํฉํ์ง ์๋ค๊ณ ์๊ฐ๋ฉ๋๋ค!
Layered architecture๋ ๊ด์ฌ์ฌ๋ณ๋ก ๊ณ์ธต์ ๋๋ ๊ตฌ์กฐ๋ก ์๊ณ ์์ต๋๋ค. Presentation Layer ๋ ์ฌ์ฉ์์์ ์ํธ์์ฉ์ ๋ด๋นํ๋ ์ญํ , business Layer ๋ ๋น์ง๋์ค ๋ก์ง๋ง ๋ด๋นํ๋ ์ญํ ์
๋๋ค. ๋ฐ๋ผ์ View ๊ฐ์ฒด๋ค์ presentation layer ์ ์ํ๋ค๊ณ ๋ณผ ์ ์์ต๋๋ค.
ํ์ง๋ง ํ์ฌ ์ฝ๋๋ฅผ ๋ณด๋ฉด business layer ๊ฐ presentation layer ๋ฅผ ์์กดํ๋ ๊ฒ์ผ๋ก ๋ณด์ด๋๋ฐ, ์ด๋ ๊ฒ... |
@@ -0,0 +1,86 @@
+package store.view;
+
+import static store.utils.ErrorMessage.ERROR;
+import static store.utils.ErrorMessage.RETRY;
+
+import java.util.List;
+import store.model.Receipt;
+import store.model.Store;
+
+public class OutputView {
+ private static final String ERROR_ANSWER = "[ERROR] ์๋ชป๋ ์
๋ ฅ์
๋๋ค. ๋ค์ ์
๋ ฅํด ... | Java | ์ด ๋ถ๋ถ์ ์์๋ก ์ฒ๋ฆฌํ์ง ์์ ์ด์ ๊ฐ ์์๊น์? |
@@ -0,0 +1,89 @@
+package store.controller;
+
+import java.util.ArrayList;
+import java.util.List;
+import store.model.Order;
+import store.model.Promotion;
+import store.model.Receipt;
+import store.model.Store;
+import store.service.StoreService;
+import store.view.InputView;
+import store.view.OutputView;
+
+public ... | Java | do while๋ฌธ์ ์ฒ์ ์ฌ์ฉํด์ ์ ๋ชฐ๋๋๋ฐ ์์์ ์ ์ธํ๋ ๋ฐฉ๋ฒ์ ์๊ฐ๋ ๋ชปํ๋ค์ ๋ฐฐ์๊ฐ๋๋ค! |
@@ -0,0 +1,73 @@
+package store.model;
+
+import camp.nextstep.edu.missionutils.DateTimes;
+import java.text.ParseException;
+import java.text.SimpleDateFormat;
+import java.util.Arrays;
+import java.util.Date;
+import java.util.List;
+
+public class Promotion {
+ private String name;
+ private int buy;
+ priv... | Java | ๊ฐ๋
์ฑ์ด ๋ ์ข๋ค๊ณ ์๊ฐ๋๋ ๋ฐฉํฅ์ผ๋ก ์์ฑํ์ต๋๋ค |
@@ -0,0 +1,294 @@
+package store.service;
+
+import static store.model.Promotion.parsePromotions;
+import static store.model.Store.*;
+import static store.utils.ErrorMessage.INVALID_INPUT;
+import static store.utils.ErrorMessage.INVALID_NAME;
+import static store.utils.ErrorMessage.INVALID_QUANTITY;
+
+import java.io.B... | Java | readLine() ์ ์ฌ์ฉํ์ฌ ํ ์ค์ฉ ์ฝ๊ธฐ ์ข๋ค๊ณ ์๊ฐํ์ฌ ์ฌ์ฉํ์ต๋๋ค |
@@ -0,0 +1,14 @@
+package store.utils;
+
+public class ErrorMessage {
+ public static final String ERROR = "[ERROR] ";
+ public static final String RETRY = " ๋ค์ ์
๋ ฅํด ์ฃผ์ธ์.";
+ public static final String INVALID_FORMAT = " ์ฌ๋ฐ๋ฅด์ง ์์ ํ์์ผ๋ก ์
๋ ฅํ์ต๋๋ค. ";
+ public static final String INVALID_NAME = " ์กด์ฌํ์ง ์๋ ์ํ์
๋๋ค.";
+... | Java | ๊ฐ๋ค์ ๊ทธ๋ฃนํ ํ์ฌ ์ฌ์ฉํ์ง ์๊ณ ๋จ์ ๋ฉ์ธ์ง ์ถ๋ ฅ์ด๊ธฐ์ ์์ ํด๋์ค๋ก ํด๋ ์ข์ ๊ฒ ๊ฐ๋ค๊ณ ์๊ฐํ์ต๋๋ค |
@@ -0,0 +1,73 @@
+package store.model;
+
+import camp.nextstep.edu.missionutils.DateTimes;
+import java.text.ParseException;
+import java.text.SimpleDateFormat;
+import java.util.Arrays;
+import java.util.Date;
+import java.util.List;
+
+public class Promotion {
+ private String name;
+ private int buy;
+ priv... | Java | ์ญํ ๋ถ๋ฆฌ๋ฅผ ์ข ๋ ์์ธํ ํด์ผ ๋ ๊ฒ ๊ฐ๋ค์.. ์ฐธ๊ณ ํ๊ฒ ์ต๋๋ค! |
@@ -0,0 +1,50 @@
+package store.model;
+
+public class Receipt {
+ private String name;
+ private int individualPrice;
+ private int quantity;
+ private int promotionQuantity;
+ private int promotionBuy;
+
+ public Receipt(String name, int individualPrice, int quantity, int promotionBuy) {
+ th... | Java | ๋ง์ํ์ ๋ด์ฉ ๋ฃ๊ณ ์ ์ฝ๋๋ฅผ ๋ค์ ์ดํด๋ณด๋, ๊ฐ์ฒด๋ด์์๋ ๋จ์ํ ๋ฐ์ดํฐ๋ง ๋ด์๋๊ณ ๊ฒํฐ ์ฌ์ฉ์ผ๋ก ๋๋ถ๋ถ ์ธ๋ถ์์ ๋ก์ง์ ์ฒ๋ฆฌํ์ฌ ๊ฐ์ฒด์งํฅ์ ์๋ฏธ๋ฅผ ์์ ์ฝ๋๋ฅผ ์์ฑํ ๊ฒ ๊ฐ์ต๋๋ค...
๊ตฌํํ๋๋ฐ ๋๋ฌด ๊ธ๊ธํ๋๊ฑฐ๊ฐ๋ค์ใ
ใ
ํผ๋๋ฐฑ ๊ฐ์ฌํฉ๋๋ค |
@@ -0,0 +1,294 @@
+package store.service;
+
+import static store.model.Promotion.parsePromotions;
+import static store.model.Store.*;
+import static store.utils.ErrorMessage.INVALID_INPUT;
+import static store.utils.ErrorMessage.INVALID_NAME;
+import static store.utils.ErrorMessage.INVALID_QUANTITY;
+
+import java.io.B... | Java | OutputView ํด๋์ค์์ ์ ์ผํ๊ฒ ์์ฑํ ์คํํฑ ๋ฉ์๋ ์
๋๋ค.
์ ๋ ๊ตฌํํ๋ ๊ณผ์ ์์ ์ณ์ง ์๋ค๊ณ ์๊ฐํ์ง๋ง,
๋น์ฆ๋์ค ๋ก์ง์ ์ฒ๋ฆฌํ๋ ๊ณผ์ ์์ ์ณ์ง ์์ ์
๋ ฅ์ด ์์ ๋ outputView ๊ฐ์ฒด๋ฅผ ์ฐธ์กฐ ํ ๋ฐฉ๋ฒ์ด ๋ ์ค๋ฅด์ง ์์ ์ด๋ ๊ฒ ์์ฑํ๊ฒ ๋์ต๋๋ค..
์ ํฉํ์ง ์์ ์ด์ ๋ฅผ ์์ธํ๊ฒ ๋ง์ํด ์ฃผ์
์ ์๋กญ๊ฒ ํ๋ ๋ ๋ฐฐ์๊ฐ๋๋ค ๊ฐ์ฌํฉ๋๋ค..! |
@@ -0,0 +1,16 @@
+package store.constant;
+
+public enum CommonMessage {
+ YES("Y"),
+ NO("N");
+ private final String commonMessage;
+
+ CommonMessage(final String commonMessage) {
+ this.commonMessage = commonMessage;
+ }
+
+ public String getCommonMessage() {
+ return commonMessage;
+... | Java | ์
๋ ฅ์ด ๋๋ฟ์ธ ๊ฒฝ์ฐ์ ๋ํด์ Enum์ผ๋ก ๊ด๋ฆฌํ๋ ๊ฒ๋ ์ข์ ๋ฐฉ๋ฒ์ธ ๊ฒ ๊ฐ์์! |
@@ -0,0 +1,22 @@
+package store.constant;
+
+public enum FileMessage {
+ PRODUCTS_FILE_NAME("products.md"),
+ PROMOTION_FILE_NAME("promotions.md"),
+ NULL("null"),
+ SOFT_DRINK("ํ์ฐ2+1"),
+ MD_RECOMMEND_PRODUCT("MD์ถ์ฒ์ํ"),
+ FLASH_DISCOUNT("๋ฐ์งํ ์ธ"),
+ FILE_START_WORD("name");
+
+ private final Stri... | Java | ํ์ผ์ ์๋ ํ๋ก๋ชจ์
๋ฐ์ดํฐ๋ฅผ Enum์ผ๋ก ๊ด๋ฆฌํ๋๊ฑด ์ข์ง ์์ ๊ฒ ๊ฐ์ต๋๋ค
ํ๋ก๋ชจ์
์ข
๋ฅ๊ฐ 3๊ฐ ๊ณ ์ ์ด ์๋๋ผ ๊ฐ๊ธฐ ๋ค๋ฅธ ์๋ฐฑ ๊ฐ, ์์ฒ ๊ฐ๋ก ๋์ด๋ ์ ์์ ๊ฒ ๊ฐ์์! |
@@ -0,0 +1,71 @@
+package store.domain;
+
+import java.util.ArrayList;
+import java.util.List;
+import store.constant.CommonMessage;
+import store.constant.CommonValue;
+
+public class Receipt {
+ private final double THIRTY_PERCENT = 0.3;
+ private final List<ReceiptItem> receiptItems = new ArrayList<>();
+
+ ... | Java | model์ ์ญํ ์ ์ํํ๋ ํด๋์ค๋ก ๋ณด์ด๋๋ฐ ํจํค์ง๋ฅผ ๋ถ๋ฆฌํ์ง ์๊ณ , domain ํจํค์ง์ ๊ฐ์ด ๋์ ์ด์ ๊ฐ ์์๊น์? |
@@ -0,0 +1,143 @@
+package store.controller;
+
+import camp.nextstep.edu.missionutils.DateTimes;
+import java.util.List;
+import java.util.function.Supplier;
+import store.constant.CommonMessage;
+import store.constant.CommonValue;
+import store.constant.SignMessage;
+import store.domain.GeneralProduct;
+import store.d... | Java | `userMembership()`์์ ๋ฉค๋ฒ์ญ ํ ์ธ ์ฌ๋ถ์ ๋ฐ๋ผ ์ต์ข
๊ณ์ฐ ๊ธ์ก์์ 30% ํ ์ธ์ด ๋๊ณ ์๋๋ฐ,
์๊ตฌ์ฌํญ์์๋ ํ๋ก๋ชจ์
์ํ์ ์ ์ธํ ์ผ๋ฐ ์ํ์ผ๋ก ๊ฒฐ์ ๋ ์ํ๋ค์ ๋ํด์๋ง ๋ฉค๋ฒ์ญ ํ ์ธ์ด ๋์ด์ผ ํ๋ค๊ณ ๋ช
์๋์ด ์์ต๋๋ค
์ด ๋ถ๋ถ์ด ์ฒ๋ฆฌ๋์ง ์์ ๊ฒ ๊ฐ์ต๋๋ค! |
@@ -0,0 +1,19 @@
+package store.constant;
+
+public enum CommonValue {
+ ZERO(0),
+ ONE(1),
+ TWO(2),
+ EIGHT_THOUSAND(8000);
+
+ private final int value;
+
+ CommonValue(final int value) {
+ this.value = value;
+ }
+
+ public int getValue() {
+ return value;
+ }
+
+} | Java | ์์๋ค์ enum์ผ๋ก ์ ๊ด๋ฆฌํด์ฃผ์
จ๋๋ฐ์!
์ ๋ ๊ฐ์ธ์ ์ผ๋ก enum์ ๊ฐ์ ๊บผ๋ด๊ธฐ ์ํด `.getValue()` ๊น์ง ๋ถ๋๊ฒ ์กฐ๊ธ ์ง์ ๋ถํด๋ณด์
๋๋ค.
static ์์์ ๊ฒฝ์ฐ `Constant.ZERO` ์ด๋ฐ์์ผ๋ก ์ฌ์ฉํ ์ ์์ง๋ง enum์ `CommonValue.ZERO.getValue()` ๋ก 1depth ๋ ๋์ด๋๋ ๋๋์ด๋๊น์..? |
@@ -0,0 +1,71 @@
+package store.domain;
+
+import java.util.ArrayList;
+import java.util.List;
+import store.constant.CommonMessage;
+import store.constant.CommonValue;
+
+public class Receipt {
+ private final double THIRTY_PERCENT = 0.3;
+ private final List<ReceiptItem> receiptItems = new ArrayList<>();
+
+ ... | Java | int๋ฅผ double๊ณผ ๊ณฑํ ๋ค int๋ก ํ๋ณํ์ ํ๊ณ ์๋๋ฐ์!
double๋ก ๊ณ์ฐ๋๋ ๊ณผ์ ์์ ๋ถ๋์์์ ์ค๋ฅ๋ฅผ ํผํ ์ ์์ ๊ฒ์ผ๋ก ๋ณด์
๋๋ค. ์ด๋๋ `* 30 / 100` ์ผ๋ก ๊ณ์ฐํด์ ์์ ์์์ ์ด ์์๊ธฐ๋๋ก ๊ณ์ฐํ์๋ ๊ฒ์ ์ด๋จ๊น์? |
@@ -0,0 +1,143 @@
+package store.controller;
+
+import camp.nextstep.edu.missionutils.DateTimes;
+import java.util.List;
+import java.util.function.Supplier;
+import store.constant.CommonMessage;
+import store.constant.CommonValue;
+import store.constant.SignMessage;
+import store.domain.GeneralProduct;
+import store.d... | Java | ์ ๋ MVC ํจํด์ Service ๊ณ์ธต์ ์ถ๊ฐํด์ ์ฑ
์ ๋ถ๋ฆฌ์ ์ ๋จน์์๋๋ฐ, Service๊ฐ ์์ผ๋ ์ข ๋ ์์ฐ์ค๋ฝ๊ฒ ๋ฐ์ดํฐ ์ ๋ฌ์ด ์ด๋ฃจ์ด์ง๋ค์..!! |
@@ -0,0 +1,141 @@
+package store.view.output;
+
+import java.util.List;
+import store.domain.GeneralProduct;
+import store.domain.PromotionProduct;
+import store.domain.Receipt;
+import store.domain.ReceiptItem;
+import store.domain.Storage;
+import store.exception.ConvenienceStoreException;
+
+public class OutputView ... | Java | ํ๋ก๋ชจ์
์ํ์ด ์์ง๋๊ณ ๋์ ํ๋ก๋ชจ์
์ํ๋ ์ฌ๊ณ ์์์ผ๋ก ์ถ๋ ฅ๋๋๋ฐ,
์ฌ์ฉ์๋ ํ๋ก๋ชจ์
์ํ์ ๊ตฌ๋งคํ ์ ์์ผ๋ฏ๋ก ์์ ๋
ธ์ถ์ํค์ง ์๋ ๊ฒ๋ ์ข์ ๊ฒ ๊ฐ์์!
UX์ชฝ์ผ๋ก๋ ํ๋ฒ ๊ณ ๋ฏผํด๋ณด์๋ฉด ์ข์ ๊ฒ ๊ฐ์ต๋๋ค๐ |
@@ -0,0 +1,38 @@
+package store.domain;
+
+public class GeneralProduct {
+ private final String name;
+ private final String price;
+ private int quantity;
+
+ public GeneralProduct(final String name, final String price, final int quantity) {
+ this.name = name;
+ this.price = price;
+ ... | Java | ๊ฐ์ธ์ ์ธ ๊ถ๊ธ์ฆ์ผ๋ก ์ฌ์ญค๋ด
๋๋ค
`price`๋ฅผ `String` ์ผ๋ก ๊ด๋ฆฌํ์ ํน๋ณํ ์ด์ ๊ฐ ์์ผ์ค๊น์? |
@@ -0,0 +1,143 @@
+package store.controller;
+
+import camp.nextstep.edu.missionutils.DateTimes;
+import java.util.List;
+import java.util.function.Supplier;
+import store.constant.CommonMessage;
+import store.constant.CommonValue;
+import store.constant.SignMessage;
+import store.domain.GeneralProduct;
+import store.d... | Java | `HYPHEN`์ด๋ `ZERO` ๊ฐ์ด ์ด๋ฆ ์์ฒด๊ฐ ์๋ฏธ๋ฅผ ์ง๊ด์ ์ผ๋ก ๋ด๊ณ ์๋ ๊ฒฝ์ฐ๋
enum๋ณด๋ค ์ผ๋ฐ ํด๋์ค๋ฅผ ์ฌ์ฉํด์ `getValue()`๋ฉ์๋๋ฅผ ์ฌ์ฉํ์ง ์๋ ํธ์ด ์กฐ๊ธ ๋ ๊น๋ํ์ง ์์๊น์..? |
@@ -0,0 +1,40 @@
+package store.domain;
+
+import java.time.LocalDate;
+import java.time.LocalDateTime;
+
+public class Promotion {
+ private final String name;
+ private final int buy;
+ private final int get;
+ private final LocalDate startDate;
+ private final LocalDate endDate;
+
+ public Promotio... | Java | ์กฐ๊ฑด๋ถ๊ฐ ๊ธธ๋ค๋ณด๋๊น ๋ ์ง๊ฐ ๊ธฐ๊ฐ์ ํฌํจ๋๋์ง ํ์ธํ๋ ๋ฉ์๋๋ฅผ ๊ตฌํํ๋ ๊ฒ๋ ๋์์ง ์๋ค๊ณ ์๊ฐ์ด ๋ค์์ต๋๋ค
```
boolean isBetween(LocalDate date) {
return !date.isBefore(startDate) && !date.isAfter(endDate);
}
``` |
@@ -0,0 +1,83 @@
+package store.domain;
+
+import java.util.Collections;
+import java.util.List;
+import store.constant.CommonValue;
+import store.constant.SignMessage;
+import store.exception.ConvenienceStoreException;
+import store.exception.ErrorMessage;
+
+public class Storage {
+ private final List<GeneralProdu... | Java | `Unmodifiable Collection`์ ์ฌ์ฉํ์
์
์ธ๋ถ์ ๋ณํ์ ๋ง์ผ์ ์ ๋๋ฌด ์ข์ต๋๋ค..! |
@@ -0,0 +1,114 @@
+package store.service;
+
+import java.io.IOException;
+import java.util.ArrayList;
+import java.util.List;
+import store.constant.FileMessage;
+import store.constant.SignMessage;
+import store.domain.GeneralProduct;
+import store.domain.Promotion;
+import store.domain.PromotionProduct;
+import store.... | Java | ์ด ์์๋ `ErrorMessage` ํด๋์ค์ ํฌํจ๋์ง ์์ ์ด์ ๊ฐ ํน์ ์์๊น์? |
@@ -0,0 +1,16 @@
+package store.constant;
+
+public enum CommonMessage {
+ YES("Y"),
+ NO("N");
+ private final String commonMessage;
+
+ CommonMessage(final String commonMessage) {
+ this.commonMessage = commonMessage;
+ }
+
+ public String getCommonMessage() {
+ return commonMessage;
+... | Java | ๊ฐ์ฌํฉ๋๋ค!
ํน์ ๋ฒ์์ ๊ฐ๋ง ์ฌ์ฉ์ ํ๋๊น enum์ผ๋ก ์ฌ์ฉํด๋ณผ๊น? ์๊ฐํด๋ดค์ด์! |
@@ -0,0 +1,19 @@
+package store.constant;
+
+public enum CommonValue {
+ ZERO(0),
+ ONE(1),
+ TWO(2),
+ EIGHT_THOUSAND(8000);
+
+ private final int value;
+
+ CommonValue(final int value) {
+ this.value = value;
+ }
+
+ public int getValue() {
+ return value;
+ }
+
+} | Java | ์ฌ์ค ์ด ๋ถ๋ถ์ ๋ํด ๊ณ ๋ฏผ์ ๋ง์ด ํ์ต๋๋ค.
์์๋ฅผ enum์ผ๋ก ๊ด๋ฆฌํ ์ง ์ฌ๋ถ๋ฅผ ๊ณ ๋ฏผํ๋ ์ด์ ๋, ํด๋น ์์๋ค์ด ํน์ ํ ๊ฐ์ ๋ฒ์์ ์ํ์ง ์๊ณ , `==`์ ํตํ ๋น๊ต๋ฅผ ์ํํ๋ ๋ถ๋ถ๋ ์์๊ธฐ ๋๋ฌธ์
๋๋ค. ๊ทธ๋์ ๊ตณ์ด enum์ ์ฌ์ฉํ ํ์๊ฐ ์๋ค๊ณ ์๊ฐํ์ต๋๋ค.
๋ค๋ง, ๊ฐ๋
์ฑ ์ธก๋ฉด์์ ์ฝ๋๋ฅผ ๋ช
ํํ๊ฒ ๋ง๋ค๊ณ ์ enum์ ์ ํํ๋๋ฐ, ์ค์ ์ฌ์ฉ ์ `CommonValue.ZERO.getValue()`์ฒ๋ผ ์ ๊ทผํ๋ ๊ฒ์ด ์ฝ๋๊ฐ ๊ธธ์ด์ง๊ณ ๋ค์ ๋ถํธํ๊ฒ ๋๊ปด์ง ์ ์์ต๋๋ค.
์ด ์ ์์ ๋ณด๋ฉด, ๋ง์ํ์ ๋๋ก static ์์๋ก ๊ด๋ฆฌํ๋ ๊ฒ์ด ๋ ๊ฐ๊ฒฐํ๊ณ ์ง๊ด... |
@@ -0,0 +1,22 @@
+package store.constant;
+
+public enum FileMessage {
+ PRODUCTS_FILE_NAME("products.md"),
+ PROMOTION_FILE_NAME("promotions.md"),
+ NULL("null"),
+ SOFT_DRINK("ํ์ฐ2+1"),
+ MD_RECOMMEND_PRODUCT("MD์ถ์ฒ์ํ"),
+ FLASH_DISCOUNT("๋ฐ์งํ ์ธ"),
+ FILE_START_WORD("name");
+
+ private final Stri... | Java | ํผ๋๋ฐฑ ๊ฐ์ฌ๋๋ฆฝ๋๋ค!
๋ง์ํด์ฃผ์ ๋๋ก, Enum์ ์ฃผ๋ก ๊ณ ์ ๋ ์์ ๊ฐ์ ์ ์ํ ๋ ์ฌ์ฉ๋ฉ๋๋ค. ๊ทธ๋ฐ๋ฐ ์๋ก์ด ํ๋ก๋ชจ์
์ด ์ถ๊ฐ๋๊ฑฐ๋ ๋ณ๊ฒฝ๋ ๋๋ง๋ค ์ฌ์ปดํ์ผํด์ผ ํ๋ ๋ถํธํจ์ด ์์ ๊ฒ ๊ฐ์ต๋๋ค.
์ด ๋ถ๋ถ์ ์ ๊ฐ ๋ฏธ์ฒ ๊ณ ๋ คํ์ง ๋ชปํ๋ ์ ์ธ๋ฐ, ์ง์ ํด์ฃผ์
์ ๊ฐ์ฌ๋๋ฆฝ๋๋ค! |
@@ -0,0 +1,143 @@
+package store.controller;
+
+import camp.nextstep.edu.missionutils.DateTimes;
+import java.util.List;
+import java.util.function.Supplier;
+import store.constant.CommonMessage;
+import store.constant.CommonValue;
+import store.constant.SignMessage;
+import store.domain.GeneralProduct;
+import store.d... | Java | ์ฌ์ค Service ๊ณ์ธต์ ์ถ๊ฐํด์ ์ฑ
์์ ๋ถ๋ฆฌํ๋ ค๊ณ ํ์ต๋๋ค.
์ปค๋ฐ ๊ธฐ๋ก์ ๋ณด์๋ฉด ์์๊ฒ ์ง๋ง, ๋ง์ง๋ง ๋ ์ ReceiptService๋ฅผ ์ถ๊ฐํ์ต๋๋ค! ์ํ ๊ด๋ จ ๋ถ๋ถ๋ ๋ถ๋ฆฌํ๋ ค๊ณ ํ๋๋ฐ, ์๊ฐ์ด ๋ถ์กฑํด์ ๋ ๋ฆฌํฉํ ๋งํ์ง ๋ชปํ ์ ์ด ์์ฝ์ต๋๋ค ๐
๊ทธ๋ผ์๋ ์ข๊ฒ ๋ด์ฃผ์
์ ๊ฐ์ฌํฉ๋๋ค! |
@@ -0,0 +1,143 @@
+package store.controller;
+
+import camp.nextstep.edu.missionutils.DateTimes;
+import java.util.List;
+import java.util.function.Supplier;
+import store.constant.CommonMessage;
+import store.constant.CommonValue;
+import store.constant.SignMessage;
+import store.domain.GeneralProduct;
+import store.d... | Java | ๋ง์ํด์ฃผ์ ๋ด์ฉ์ ํ์ธํด๋ณด์์ต๋๋ค!
์ ๊ฐ ์๊ณ ์๋ ์๊ตฌ์ฌํญ์, `[์ฝ๋ผ-2]`, `[์๋์ง๋ฐ-1]`์ ๊ตฌ๋งคํ ๊ฒฝ์ฐ 1๊ฐ ๋ฌด๋ฃ ์ฆ์ ์ ๋ฐ๊ณ , ๋ฉค๋ฒ์ญ์ ์ ์ฉํ๋ค๋ฉด ์๋์ง๋ฐ 1๊ฐ์ ๋ํด์๋ง ๋ฉค๋ฒ์ญ ํ ์ธ์ด ์ ์ฉ๋๋ ๊ฒ์
๋๋ค.
๋ง์ฐฌ๊ฐ์ง๋ก, `[์ฝ๋ผ-2]`๊ฐ๋ฅผ ๊ตฌ๋งคํ๊ณ ๋ฌด๋ฃ ์ฆ์ ์ ๋ฐ์ง ์๋๋ค๋ฉด, ์ฝ๋ผ 2๊ฐ์ ๋ํด์ ๋ฉค๋ฒ์ญ ํ ์ธ์ด ์ ์ฉ๋๋ ๊ฒ์ผ๋ก ์ดํดํ๊ณ ์์ต๋๋ค.
์ ๋ก์ง์ ์์ ๊ฐ์ ๋ฐฉ์์ผ๋ก ๋์ํ๊ณ ์์ต๋๋ค.
ํน์ ๋ค๋ฅธ ์๊ตฌ์ฌํญ์ด ์์๋ค๋ฉด ์ค๋ช
ํด ์ฃผ์ค ์ ์์ผ์ ๊ฐ์?
์๋ฅผ ๋ค์ด, `[์ฝ๋ผ-2]`, `[์๋์ง๋ฐ-1]`๋ฅผ ๊ตฌ๋งคํ ์ํฉ์์ ์ฝ๋ผ 1๊ฐ๋ฅผ ... |
@@ -0,0 +1,143 @@
+package store.controller;
+
+import camp.nextstep.edu.missionutils.DateTimes;
+import java.util.List;
+import java.util.function.Supplier;
+import store.constant.CommonMessage;
+import store.constant.CommonValue;
+import store.constant.SignMessage;
+import store.domain.GeneralProduct;
+import store.d... | Java | ๋ง์ํ์ ๋ถ๋ถ์ ๋์ํฉ๋๋ค.
HYPHEN์ด๋ ZERO์ ๊ฐ์ด ์ด๋ฆ ์์ฒด๊ฐ ์๋ฏธ๋ฅผ ์ง๊ด์ ์ผ๋ก ๋ด๊ณ ์๋ ๊ฒฝ์ฐ, Enum๋ณด๋ค๋ ์ผ๋ฐ ํด๋์ค๋ฅผ ์ฌ์ฉํ์ฌ getValue() ๋ฉ์๋๋ฅผ ์ฌ์ฉํ์ง ์๋ ๋ฐฉ์์ด ๋ ๊น๋ํ ๊ฒ ๊ฐ์์!!
์ด๋ ๊ฒ ํ๋ฉด ์ฝ๋์ ๊ฐ๋
์ฑ์ด ๋์์ง๊ณ , ๋ถํ์ํ getValue() ํธ์ถ์ ํผํ ์ ์์ด ๋ ์ง๊ด์ ์ผ ๊ฒ ๊ฐ์ต๋๋ค.
Enum์ ๋ณดํต ์ํ๋ ๋ฒ์๊ฐ ๋ช
ํํ ์์๋ค์ ์ ์ํ ๋ ์ ํฉํ๋ฐ, ์ด ๊ฒฝ์ฐ์๋ ์ผ๋ฐ ํด๋์ค๋ฅผ ์ฌ์ฉํ๋ ๊ฒ์ด ๋ ๋์ ๊ฒ ๊ฐ์ต๋๋ค.... |
@@ -0,0 +1,38 @@
+package store.domain;
+
+public class GeneralProduct {
+ private final String name;
+ private final String price;
+ private int quantity;
+
+ public GeneralProduct(final String name, final String price, final int quantity) {
+ this.name = name;
+ this.price = price;
+ ... | Java | ์๋จ.. ํน๋ณํ ์ด์ ๋ ์์์ต๋๋ค
์ฐ์ ๋ฌธ์์ด๋ก ๋ฐ์ ํ์ ์ถํ์ intํ์ผ๋ก ์์ ํ๋ ค๊ณ ํ์๋๋ฐ ๊น๋จน๊ณ ๋์น ๊ฒ ๊ฐ์์!
๋ง์ํด์ฃผ์
์ ๊ฐ์ฌ๋๋ฆฝ๋๋ค! |
@@ -0,0 +1,40 @@
+package store.domain;
+
+import java.time.LocalDate;
+import java.time.LocalDateTime;
+
+public class Promotion {
+ private final String name;
+ private final int buy;
+ private final int get;
+ private final LocalDate startDate;
+ private final LocalDate endDate;
+
+ public Promotio... | Java | ์กฐ๊ฑด์ด ๊ธธ์ด์ง๋ค ๋ณด๋, ๋ ์ง๊ฐ ๊ธฐ๊ฐ์ ํฌํจ๋๋์ง ํ์ธํ๋ ๋ฉ์๋๋ฅผ ๊ตฌํํ๋ ๊ฒ๋ ์ข์ ์ ๊ทผ ๊ฐ์์. `isBetween` ๋ฉ์๋๋ฅผ ์ฌ์ฉํ๋ฉด ์ฝ๋ ๊ฐ๋
์ฑ์ ๋์ด๋ ๋ฐ ๋์์ด ๋ ๊ฒ ๊ฐ๋ค์! |
@@ -0,0 +1,71 @@
+package store.domain;
+
+import java.util.ArrayList;
+import java.util.List;
+import store.constant.CommonMessage;
+import store.constant.CommonValue;
+
+public class Receipt {
+ private final double THIRTY_PERCENT = 0.3;
+ private final List<ReceiptItem> receiptItems = new ArrayList<>();
+
+ ... | Java | ์ข์ ์ง๋ฌธ ๊ฐ์ฌํฉ๋๋ค!
Receipt ํด๋์ค๋ฅผ domain ํจํค์ง์ ๋๋ ์ด์ ๋ ์ด ํด๋์ค๊ฐ ์ ํ๋ฆฌ์ผ์ด์
์ ํต์ฌ ๋๋ฉ์ธ ๋ก์ง์ ์ฒ๋ฆฌํ๊ณ ์๊ธฐ ๋๋ฌธ์
๋๋ค.
Receipt๋ ๊ทธ ์์ฒด๋ก ๊ตฌ๋งค ๋ด์ญ์ ๋ค๋ฃจ๊ณ ์ด๋ฅผ ๊ธฐ๋ฐ์ผ๋ก ๋น์ฆ๋์ค ๋ก์ง์ ์ฒ๋ฆฌํ๋ ํด๋์ค์ด๊ธฐ ๋๋ฌธ์ ๋๋ฉ์ธ ๊ณ์ธต์ ์์นํ๋ ๊ฒ์ด ์์ฐ์ค๋ฝ๋ค๊ณ ์๊ฐํ์ต๋๋ค.
๋ฌผ๋ก , model์ด๋ผ๋ ๋ณ๋์ ํจํค์ง๋ฅผ ๋๊ณ ๊ด๋ฆฌํ ์๋ ์์ง๋ง, ํ์ฌ ๊ตฌ์กฐ์์๋ domain ํจํค์ง๊ฐ ์ ํ๋ฆฌ์ผ์ด์
์ ์ฃผ์ ๋น์ฆ๋์ค ๋ก์ง์ ๋ชจ๋ ํฌํจํ๊ณ ์์ด์, Receipt์ ๊ฐ์ ํด๋์ค๋ฅผ ๋ณ๋๋ก ๋ถ๋ฆฌํ์ง ์๊ณ ๋๋ฉ์ธ ๋ด์ ํฌํจ์ํค๋ ๊ฒ์ด ์ฝ๋์ ... |
@@ -0,0 +1,71 @@
+package store.domain;
+
+import java.util.ArrayList;
+import java.util.List;
+import store.constant.CommonMessage;
+import store.constant.CommonValue;
+
+public class Receipt {
+ private final double THIRTY_PERCENT = 0.3;
+ private final List<ReceiptItem> receiptItems = new ArrayList<>();
+
+ ... | Java | ์ข์ ์ง์ ๊ฐ์ฌํฉ๋๋ค!
๋ง์ํ์ ๋๋ก ๋ถ๋์์์ ์ค์ฐจ๊ฐ ๋ฐ์ํ ์ ์๋ค๋ ์ ์ ๊ฐ๊ณผํ๋ ๊ฒ ๊ฐ์ต๋๋ค.
์ข์ ๋ฐฉ๋ฒ์ธ ๊ฒ ๊ฐ์์! |
@@ -0,0 +1,83 @@
+package store.domain;
+
+import java.util.Collections;
+import java.util.List;
+import store.constant.CommonValue;
+import store.constant.SignMessage;
+import store.exception.ConvenienceStoreException;
+import store.exception.ErrorMessage;
+
+public class Storage {
+ private final List<GeneralProdu... | Java | ๊ฐ์ฌํฉ๋๋ค! |
@@ -0,0 +1,114 @@
+package store.service;
+
+import java.io.IOException;
+import java.util.ArrayList;
+import java.util.List;
+import store.constant.FileMessage;
+import store.constant.SignMessage;
+import store.domain.GeneralProduct;
+import store.domain.Promotion;
+import store.domain.PromotionProduct;
+import store.... | Java | ์.. ์ด ๋ถ๋ถ๋ ๋ฆฌํฉํ ๋งํ๋ฉด์ ErrorMessage์ ์ฎ๊ฒจ์ผ ํ๋๋ฐ ๋์ณค๋ ๊ฒ ๊ฐ์์!
๋ง์ํด์ฃผ์
์ ๊ฐ์ฌ๋๋ฆฝ๋๋ค! |
@@ -0,0 +1,141 @@
+package store.view.output;
+
+import java.util.List;
+import store.domain.GeneralProduct;
+import store.domain.PromotionProduct;
+import store.domain.Receipt;
+import store.domain.ReceiptItem;
+import store.domain.Storage;
+import store.exception.ConvenienceStoreException;
+
+public class OutputView ... | Java | ์ ๋ ๊ฐ์ธ์ ์ผ๋ก ํ๋ก๋ชจ์
์ํ์ด ์์ง๋ ๊ฒฝ์ฐ์๋ '์ฌ๊ณ ์์'์ ํ์ํ๋ ๊ฒ์ด ์ค์ํ๋ค๊ณ ์๊ฐํฉ๋๋ค.
์ฌ๊ณ ์์์ ํ์ํ์ง ์์ผ๋ฉด, ์ฌ์ฉ์๊ฐ ํด๋น ์ํ์ด ํ๋ก๋ชจ์
๊ธฐ๊ฐ์ ํฌํจ๋ ๊ฒ์ธ์ง ์๋์ง๋ฅผ ๊ตฌ๋ถํ๊ธฐ ์ด๋ ค์ธ ์ ์๊ธฐ ๋๋ฌธ์
๋๋ค.
๋ฐ๋ผ์ ํ๋ก๋ชจ์
๊ธฐ๊ฐ ์ค์ ์ฌ๊ณ ๊ฐ ์๋ค๋ฉด '์ฌ๊ณ ์์'์ ๋ช
์ํ๋ ๊ฒ์ด ์ฌ์ฉ์์๊ฒ ๋ ๋ช
ํํ๊ณ ํผ๋์ ์ค์ผ ์ ์์ ๊ฒ ๊ฐ์ต๋๋ค.
๋ฌผ๋ก ํ๋ก๋ชจ์
๊ธฐ๊ฐ์ด ์๋ ๊ฒฝ์ฐ์๋ '์ฌ๊ณ ์์'์ด ํ์๋์ง ์๋ ๊ฒ์ด ๋ง๋ค๊ณ ์๊ฐํฉ๋๋ค!
์ข์ ์๊ฒฌ ๊ฐ์ฌ๋๋ฆฝ๋๋ค! ๋ง์ํด์ฃผ์ ๋ด์ฉ์ ๋๋ถ์ UX ์ธก๋ฉด์์๋ ๋ค์ ํ ๋ฒ ๊ณ ๋ฏผํด๋ณผ ์ ์์์ต๋๋ค. |
@@ -0,0 +1,143 @@
+package store.controller;
+
+import camp.nextstep.edu.missionutils.DateTimes;
+import java.util.List;
+import java.util.function.Supplier;
+import store.constant.CommonMessage;
+import store.constant.CommonValue;
+import store.constant.SignMessage;
+import store.domain.GeneralProduct;
+import store.d... | Java | CommonMessage.YES.getCommonMessage() ํด๋น ๊ตฌ๋ฌธ์ด ์์ฃผ ์ฌ์ฉ๋์ด ๋ณด์ด๋ค์. ํด๋น ๋ถ๋ถ์ CommonMessage ํด๋์ค์ ๋ฉ์๋๋ก ๊ตฌํํ๋ ๋ฐฉ์์ ์ด๋จ๊น์?
๋ํ InputView์์ validateUserAnswer() ๋ฉ์๋์์ ์ฌ์ฉ์ ์
๋ ฅ์ด Y๋ N ๋ enum ํด๋์ค์ ์ ์์ ๊ฐ์ ์ง ํ์ธํ๊ณ ๋ค๋ฅด๋ฉด ์์ธ๋ฅผ ๋์ง๋ ๊ฒ๋ณด๋ค, CommonMessage์ Dto ์ฒ๋ผ ํ์ฉํ์ฌ ํด๋น dto๋ฅผ ์์ฑํจ์ ์์ด์ ์ฌ์ฉ์ ์
๋ ฅ์ ๋๊ฒจ์ฃผ๊ณ (new CommonMessage(String input)) ์
๋ ฅ ์ ์์ ๋ค๋ฅผ ์์ dto ์์ฑ์์์ ์... |
@@ -0,0 +1,19 @@
+package store.constant;
+
+public enum SignMessage {
+ COMMA(","),
+ LEFT_SQUARE_BRACKET("["),
+ RIGHT_SQUARE_BRACKET("]"),
+ HYPHEN("-");
+
+ private final String sign;
+
+ SignMessage(final String sign) {
+ this.sign = sign;
+ }
+
+ public String getSign() {
+ r... | Java | ์ด๋ฌํ ',', '[' ๋ฑ๊ณผ ๊ฐ์ด ๋น์ฆ๋์ค ๋ก์ง๊ณผ ๊ด๋ ค๋ ๋ถ๋ถ์ ๋ฐ๋ก ์์ ํด๋์ค๋ฅผ ๋๋ ๊ฒ๋ณด๋ค ๊ทธ๋ฅ ์ฌ์ฉ ํด๋์ค ๋ด์ ์์ ํ๋๋ก๋ง ๋์ด๋ ๋ ๊ฒ ๊ฐ์์.
์ ๊ฐ์ ๊ฒฝ์ฐ๋ ์์ ํด๋์ค๋ก ๋ฐ๋ก ๊ด๋ฆฌํ๋ ๋ถ๋ถ์ ๋น์ฆ๋์ค์ ๊ด๋ จ๋ ๋ถ๋ถ์ ํ๋ฒ์ ๋ชจ์๋ณด๋ ๊ฐ๋
์ฑ๋ฉด์ด ์ ์ผ ํฌ๋ค๊ณ ์๊ฐํ๊ฑฐ๋ ์! ์๋ฐ์์๋ ๋ฌธ์์ด ๋ฆฌํฐ๋ด์ ๋ฐ๋ก ์์ํ์์ ํ๋ฒ์ ๊ด๋ฆฌํ๋ฏ๋ก ์ ๋ฐ ๋ฆฌํฐ๋ด ๋ถ๋ถ์ ํด๋์ค์ ์ค๋ณต๋์ด ์ ์ธ๋์ด๋ ๋ฉ๋ชจ๋ฆฌ์์์๋ ๋ฌธ์ ์์ผ๋๊น ์ฌ์ฉํ๋ ํด๋์ค์ ์์ ํ๋๋ก ๋์ด๋ ๋ ๊ฒ ๊ฐ์์.
์ด๋ ์ ๊ฐ์ธ์ ์๊ฒฌ์ด๋ผ ๋ค๋ฅธ ๋ถ๋ค์ ์๊ฒฌ๋ ๊ถ๊ธํ๋ค์! |
@@ -0,0 +1,143 @@
+package store.controller;
+
+import camp.nextstep.edu.missionutils.DateTimes;
+import java.util.List;
+import java.util.function.Supplier;
+import store.constant.CommonMessage;
+import store.constant.CommonValue;
+import store.constant.SignMessage;
+import store.domain.GeneralProduct;
+import store.d... | Java | ์คํ๋ ค ๊ฐ์ฒด๋ก๋ง ํ๋ ฅํ๋๋ก ํ ๋ถ๋ถ์ด ๋
ธ๋ จํ ๊ฒ ๊ฐ์์! ์ ๋ ๊ฐ์ฒด๋ฅผ ๋ค๋ฃจ๊ณ ํ๋ ฅํ๋ ๋ถ๋ถ์ด ์ด๋ ค์์ ์๋น์ค ์ธต์ ๋์๊ฑฐ๋ ์ ๐คฃ |
@@ -0,0 +1,38 @@
+package store.domain;
+
+public class GeneralProduct {
+ private final String name;
+ private final String price;
+ private int quantity;
+
+ public GeneralProduct(final String name, final String price, final int quantity) {
+ this.name = name;
+ this.price = price;
+ ... | Java | ์ ๋ ์ด๋ฌํ 2์ฃผ์ฐจ ๋๊ฐ? ๊ฐ์ฒด ์ถ๋ ฅ๊ณผ ๊ด๋ จ๋ ๋ถ๋ถ์ ํด๋น ๊ฐ์ฒด ์์์ ํ๋๊ฒ ์ฝ๋๋ ๊น๋ํ๊ณ ์ข์ง์์๊นํ์ฌ ์ด๋ ๊ฒ ์์ฑํ ์ ์ด์์ต๋๋ค!
ํ์ง๋ง ๊ฒฐ๊ตญ ๋ง์ง๋ง ์ฏค toStirng๊ณผ ๊ด๋ จ๋ ์ฝ๋๋ ๋ชจ๋ ์ง์ฐ๊ณ view์์๋ง ๋ดํ๋๋ก ํ์๋๋ฐ์, ๊ทธ ์ด์ ๋ก ์ฒซ ๋ฒ์งธ๋ toString์ ์ฌ๋งํ๋ฉด ๋ก๊ทธ ํ์ธ์ฉ์ผ๋ก๋ง ์ฌ์ฉ๋๋ค๊ณ ๋ค์์ต๋๋ค. 3์ฃผ์ฐจ ๊ณตํต ํผ๋๋ฐฑ์๋ ์ด์ ๋ํ ์ฌํญ์ด ์ ํ์๋๋ผ๊ตฌ์! ๋ ๋ฒ์งธ๋ก ์ถ๋ ฅํ์์ด ๋ฐ๋๋ฉด View ๋ฟ๋ง์๋๋ผ ๊ด๋ จ ํด๋์ค๋ค์ ์ฐพ์ผ๋ฌ ๋ค๋๋ฉด์ ๊ณ ์ณ์ผํ ๊ฒ ๊ฐ๋ค๋ ์๊ฐ์ ์ถ๋ ฅ๊ด๋ จ์ ์ค์ง View์ ์ฑ
์์ผ๋ก๋ง ์ฃผ์์์ต๋๋ค!
์ ๋ ๊ฐํก์งํก ํ... |
@@ -0,0 +1,34 @@
+package store.view;
+
+public enum Sentence {
+
+ PRODUCT_SELECT_STATEMENT("๊ตฌ๋งคํ์ค ์ํ๋ช
๊ณผ ์๋์ ์
๋ ฅํด ์ฃผ์ธ์. (์: [์ฌ์ด๋ค-2],[๊ฐ์์นฉ-1])"),
+ HELLO_STATEMENT("์๋
ํ์ธ์. Wํธ์์ ์
๋๋ค."),
+ CURRENT_PRODUCTS_STATEMENT("ํ์ฌ ๋ณด์ ํ๊ณ ์๋ ์ํ์
๋๋ค."),
+ NUMBER_FORMAT("#,###"),
+ PRODUCT_FORMAT("- %s %s์ "),
+ QUANTITY_FORM... | Java | ๋จ์ํ ์ถ๋ ฅ ๋ฌธ๊ตฌ๋ค๋ ์์ํ ํด์ผ ํ๋์ง ์ด์ง ์๋ฌธ์
๋๋ค. ์์ํ์ ์ด์ ์ ์ค๋ณต์ ์ ๊ฑฐํ๊ณ ๊ฐ๋
์ฑ์ ํฅ์ ์ํค๋ ๋ฑ์ ํจ๊ณผ๊ฐ ์์ง๋ง ๋ถํ์ํ ๋ณต์ก์ฑ ์ฆ๊ฐ, ์ฝ๋ ์ ์ง ๊ด๋ฆฌ์ ์ด๋ ค์ ๋ฑ์ ๋จ์ ๋ ์์ต๋๋ค. ์ ๋ฌธ๊ตฌ๋ฅผ ์์ํ ํ์ ๋ ์ ํํ ์ด๋ค ๋์์ด ๋๋์ง ๋ค์ ์๊ฐํด๋ณด์๋ฉด ์ข์ ๊ฒ ๊ฐ์์ |
@@ -0,0 +1,52 @@
+package store.view;
+
+import store.domain.Product;
+import store.domain.Products;
+import store.dto.ReceiptDto;
+
+public class View {
+
+ private final InputView inputView;
+ private final OutputView outputView;
+
+ public View(InputView inputView, OutputView outputView) {
+ this.inp... | Java | ์ข์ ์ :
InputView์ OutputView๋ฅผ View ํด๋์ค์์ ๋ฌถ์ด์ฃผ๋ ๊ตฌ์กฐ๋ ๊ฐ ๋ทฐ ๊ฐ์ฒด์ ๋ํ ์์กด์ฑ์ ์ค์ด๊ณ , View ํด๋์ค๊ฐ ํ๋์ ํตํฉ๋ ์ญํ ์ ํ๊ฒ ๋ง๋ค์ด์ฃผ๋ ์ ์์ ์ข์ ์ ๊ทผ์ด์์.
๊ฐ์ ์ฌํญ:
ํ์ง๋ง ํ์ฌ View ํด๋์ค๋ ์ฌ์ค์ InputView์ OutputView์ ๋ฉ์๋๋ฅผ ๊ทธ๋๋ก ์ ๋ฌํ๋ ์ญํ ๋ง ํ๊ณ ์์ด์. ์ด๋ ๊ฒ ์ ๋ฌํ๋ ๋ฐฉ์๋ง์ผ๋ก๋ View ํด๋์ค์ ์กด์ฌ ์ด์ ๊ฐ ์กฐ๊ธ ๋ถ๋ช
ํํ ์ ์์ต๋๋ค. ๋ง์ฝ ์ด ํด๋์ค๊ฐ ๋ค๋ฅธ ์ญํ ์ ์ํํ์ง ์๋๋ค๋ฉด, ์ค๊ฐ์์ ๋จ์ํ ๋ฉ์๋ ์ ๋ฌ๋ง ํ๋ ๊ตฌ์กฐ๋ ๋ถํ์ํ ์ค๋ฒํค๋๋ฅผ ๋ง๋ค ์ ์์ด์. ์... |
@@ -0,0 +1,28 @@
+package store.dto;
+
+import store.domain.Product;
+import store.domain.PurchaseItem;
+
+public record GivenItemDto(
+ String name,
+ int freeQuantity,
+ int price) {
+
+ public static GivenItemDto from(PurchaseItem purchaseItem) {
+ Product product = purchaseItem.getPro... | Java | DTO๋ฅผ ์ฌ์ฉํ์๋ ๋ฐฉ์์ด ๋๋ฌด ์ข๋ค์
์ ๋ ์ด๋ฐ์์ผ๋ก ๊ตฌํํ๋ค๋ฉด ํ๊ฒฐ ๊น๋ํ์ ๊ฒ ๊ฐ์์ |
@@ -0,0 +1,42 @@
+package store.domain;
+
+public record Product(
+ String name,
+ int price,
+ Stock stock,
+ Promotion promotion) {
+
+ public int calculateTotalPrice(int quantity) {
+ return price * quantity;
+ }
+
+ public void updateStock(int purchasedQuantity) {
+ ... | Java | ๋ณ๋์ฑ์ด ํฐ ๊ฐ์ฒด์ธ๋ฐ ๋ ์ฝ๋๋ก ๊ตฌํํ์ ์ด์ ๊ฐ ๊ถ๊ธํฉ๋๋ค |
@@ -0,0 +1,64 @@
+package store.domain;
+
+import camp.nextstep.edu.missionutils.DateTimes;
+import java.time.LocalDate;
+import store.dto.PromotionDetailDto;
+
+public class Promotion {
+
+ private final String name;
+ private final int buy;
+ private final int get;
+ private final LocalDate startDate;
+ ... | Java | ์ด๋ถ๋ถ์ ์ ๋ ๋์ผํ๊ฒ ๊ตฌํํ์ง๋ง buy์ get์ ํฌ์ฅํ๊ณ startDate์ endDate๋ฅผ ํฌ์ฅํ์ฌ ํ๋ ์๋ฅผ ์ค์์ผ๋ฉด ์ด๋ ์์ง ๊ถ๊ธํ๋ค์ |
@@ -0,0 +1,34 @@
+package store.view;
+
+public enum Sentence {
+
+ PRODUCT_SELECT_STATEMENT("๊ตฌ๋งคํ์ค ์ํ๋ช
๊ณผ ์๋์ ์
๋ ฅํด ์ฃผ์ธ์. (์: [์ฌ์ด๋ค-2],[๊ฐ์์นฉ-1])"),
+ HELLO_STATEMENT("์๋
ํ์ธ์. Wํธ์์ ์
๋๋ค."),
+ CURRENT_PRODUCTS_STATEMENT("ํ์ฌ ๋ณด์ ํ๊ณ ์๋ ์ํ์
๋๋ค."),
+ NUMBER_FORMAT("#,###"),
+ PRODUCT_FORMAT("- %s %s์ "),
+ QUANTITY_FORM... | Java | ์ถ๋ ฅํ ๋ฌธ๊ตฌ๋ค์ enum์ผ๋ก ๋ง๋๋ ๊ฒ์ด ํ
์คํธํ ๋ ์ฉ์ดํ๋ค๊ณ ์๊ฐ๋ฉ๋๋ค!
์ด๋ฒ ํ
์คํธ ์ฝ๋์์๋ ๊ทธ๋ฐ ๋ถ๋ถ๋ค์ ํ
์คํธํ์ง ๋ชปํ์ง๋ง, ๊ฐ์ธ์ ์ผ๋ก ์ถ๋ ฅ ๋ฌธ๊ตฌ๋ค์ ๋ชจ์๋๋ ๊ฒ์ด ๊ตฌํ ์ ํธ๋ฆฌํ๋ค๊ณ ์๊ฐํฉ๋๋ค. |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.