code stringlengths 41 34.3k | lang stringclasses 8
values | review stringlengths 1 4.74k |
|---|---|---|
@@ -0,0 +1,34 @@
+export interface ProfileType {
+ login: string;
+ avatar_url: string;
+ bio: string;
+ followers: number;
+ following: number;
+}
+
+export interface followList {
+ id: number;
+ login: string;
+ avatar_url: string;
+ onClick?: () => void;
+}
+export interface FollowUserType {
+ avatar_url: ... | TypeScript | ๊ทธ๋ฆฌ๊ณ ์๋ฒ์์ ์ฌ์ฉ๋๋ ํ์
๊ณผ (api ํธ์ถ ๊ฒฐ๊ณผ ์๋ ค์ฃผ๋ ํ์
) ์ค์ ์ปดํฌ๋ํธ์์ ์ฌ์ฉํ๋ ํ์
์ ๊ตฌ๋ถ๋์์ผ๋ฉด ์ข๊ฒ ์ด์! (model.ts ๋ผ๋ ํ์์ผ๋ก ์ง๊ธฐ๋ ํ๋๋ฐ, api ํธ์ถ ๊ฒฐ๊ณผ ์๋ต์ผ๋ก ๋ฐ๋ ํ์
์ ์ ๋ ํ์ผ์ด์์.)
์ด๋ ๊ฒ onClick ์ด๋ผ๋ ์ปดํฌ๋ํธ์์ ์ ์ฉ๋๋ ๋
ผ๋ฆฌ์ ํ์
์ ๊ฐ์ง๊ณ ์์ ๊ฒฝ์ฐ api์ ํ์
์ด ๋ณ๊ฒฝ๋์ด ํด๋น ํ์
์ ๋ฐ๊ฟ์ฃผ์๋๋ฐ, ์ปดํฌ๋ํธ์์๊น์ง ์ํฅ์ ๋ฐ์ ์ ์์ด์!
๋ง์ฝ ์๋ฒ ํ์
์ ํ์ฅํด์ ์ฌ์ฉํ๊ณ ์ถ๋ค๋ฉด, ์ฌ์ฉ์ฒ(์ปดํฌ๋ํธ์ชฝ)์์ import ํ ๋ค ํ์ฅํด์ ์ฌ์ฉํ๋๊ฒ ๋ ์ข์ ๊ฒ ๊ฐ์์.
```tsx
//... |
@@ -0,0 +1,46 @@
+import { ProfileType, followList } from '@/types/types';
+import { atom } from 'recoil';
+import { recoilPersist } from 'recoil-persist';
+const { persistAtom } = recoilPersist();
+
+export const profileInfo = atom<ProfileType>({
+ key: 'profileInfo',
+ default: {
+ login: '',
+ avatar_url: ''... | TypeScript | ์ปดํฌ๋ํธ์ ์ฌ์ฉ์ฒ์์ ํ์ธํด๋ณด๋ `'follow' | 'not'` ๋ ๊ฐ์ง ๊ฒฝ์ฐ๋ก ์ฌ์ฉ๋๋ ๊ฒ ๊ฐ์๋ฐ์, ๊ทธ๋ ๋ค๋ฉด atom์ ํ์
์ string์ผ๋ก ์ ์ด์ฃผ๊ธฐ ๋ณด๋ค๋ ์๋์ฒ๋ผ ๋ํ๋ด๋๊ฒ ๋ ์ข์ ๊ฒ ๊ฐ์์.(string literal type, enum ํ์
์ด๋ผ๊ณ ๋ ๋ถ๋ฌ์) ์ค์ IDE์์ ํ์
์ถ๋ก ์ ํด์ฃผ์ด ํด๋จผ์๋ฌ๋ฅผ ๋ฐฉ์งํด์ฃผ๊ธฐ ์ํจ์ด์์.
๊ทธ๋ฆฌ๊ณ follow, not ์ ๋ ๊ฐ์ง ๋
ผ๋ฆฌ๋ง ์กด์ฌํ๋ค๋ฉด `boolean` ํ์
์ผ๋ก ๋์ด๋ ๊ด์ฐฎ์ ๊ฒ ๊ฐ์ต๋๋ค!
```suggestion
export const followState = atom<'follow' ... |
@@ -0,0 +1,46 @@
+import { ProfileType, followList } from '@/types/types';
+import { atom } from 'recoil';
+import { recoilPersist } from 'recoil-persist';
+const { persistAtom } = recoilPersist();
+
+export const profileInfo = atom<ProfileType>({
+ key: 'profileInfo',
+ default: {
+ login: '',
+ avatar_url: ''... | TypeScript | ํด๋น ๋ณ์๋ค์ด ๊ฐ ์ปดํฌ๋ํธ์ import ๋์ด ์ฌ์ฌ์ฉ๋๋ค ๋ณด๋ ์ํฐ์ ๋ํ๋ด๋๊ฑด์ง ํ๋์ ์ด๋ฆ์ผ๋ก๋ ์ ์ ์๊ฒ `~State`๋ `~Atom`๋ฑ์ ์ ๋ฏธ์ฌ๋ฅผ ๋ถ์ฌ์ ์ด๋ฆ์ด ๊ตฌ๋ถ๋์ด๋ ์ข์ ๊ฒ ๊ฐ์ต๋๋ท
(์๋์ followState์ ๊ฐ์ด์!) |
@@ -0,0 +1,46 @@
+import { ProfileType, followList } from '@/types/types';
+import { atom } from 'recoil';
+import { recoilPersist } from 'recoil-persist';
+const { persistAtom } = recoilPersist();
+
+export const profileInfo = atom<ProfileType>({
+ key: 'profileInfo',
+ default: {
+ login: '',
+ avatar_url: ''... | TypeScript | ์๊ฒ ์ ํํ ์ด๋ค๊ฑธ ์ํด ์ฌ์ฉ๋๋ atom์ธ์ง๊ฐ ์ด๋ฆ์ด๋ default ๊ฐ๋ง ๋ณด๊ณ ๋ ์กฐ๊ธ ํ์
ํ๊ธฐ๊ฐ ์ด๋ ค์ด ๊ฒ ๊ฐ์์ ใ
ใ
๊ทธ๋ฆฌ๊ณ ๊ธฐ๋ณธ๊ฐ์ด ๊ทธ๋ฅ ๋ค๋ฅธ ๊ฐ์ฒ๋ผ ๋น ์คํธ๋ง์ด ์๋๋ผ `' '` ์ธ ์ด์ ๋ ํน์ ์์๊น์?!
์ํฐ์ ์ฌ์ฉํ ๋, ์ด๋์ ์ด๋ค ๋ชฉ์ ์ผ๋ก ์ฌ์ฉ๋๋์ง๋ฅผ ์ด๋ฆ์ ๋ ๋ํ๋ด๊ณ , ๊ธฐ๋ณธ๊ฐ์ ์ ์ค์ ํด์ ์ด๋ค ์ฉ๋๋ก ์ด๋ป๊ฒ ์ฌ์ฉํ๋์ง ์ข ๋ ์ ๋๋ฌ๋ด๊ณ , ๊ถ๊ทน์ ์ผ๋ก๋ ์ํฐ์ ๊ผญ ์ฌ์ฉํด์ผ ํ๋์ง ํ๋ฒ ๋ ๊ณ ๋ฏผ์ ํด๋ณด๋ ๊ฒ๋ ์ข์ ๊ณ ๋ฏผ์ด ๋ ๊ฒ ๊ฐ์์! |
@@ -0,0 +1,47 @@
+import { FollowUserType, followList } from '@/types/types';
+import axios from 'axios';
+import { SetterOrUpdater } from 'recoil';
+
+const PER_PAGE = 100;
+export const getFollowingList = async (setFollowings: SetterOrUpdater<followList[]>, tokenValue: string) => {
+ try {
+ const followingData =... | TypeScript | ์ฌ๊ธฐ์ ์๋ฒ์์ ๋ด๋ ค์ฃผ๋ ๊ฐ๋ค ์ค ํด๋ผ์ด์ธํธ์์ ํ์ํ ํ์
๋ค๋ง ์์ ๋ฝ์๋ด์ฃผ๋ ๊ณผ์ ์ด ์ด๋ค์ง๋ค๊ณ ์๊ฐํ๋๋ฐ์!
ํด๋ผ์ด์ธํธ์์ camelCase๋ฅผ ์ฌ์ฉํ๊ณ ์์ผ๋, ๋๊ฒจ์ฃผ๋ ๊น์ camelCase๋ก ๋ณ๊ฒฝํด์ฃผ๋ ์์
์ ์ฌ๊ธฐ์ ์งํํด๋ ์ข์ ๊ฒ ๊ฐ๋ค์! ์ง์ ๋ฐ๊ฟ์ฃผ์ด๋ ๊ด์ฐฎ๊ณ , ์๋ฐ ์ญํ ์ ํด์ฃผ๋ ๋ผ์ด๋ธ๋ฌ๋ฆฌ๋ ์์ผ๋ ([์์](https://www.npmjs.com/package/camelcase-keys)) ์ฐธ๊ณ ํด๋ณด๋ฉด ์ข์ ๊ฒ ๊ฐ์์. |
@@ -0,0 +1,35 @@
+'use client';
+
+import FollowList from '@/components/checkfollow/FollowList';
+import { useRecoilValue, useSetRecoilState } from 'recoil';
+import FollowOrNotBtn from '../../components/checkfollow/FollowOrNotBtn';
+import Profile from '../../components/checkfollow/Profile';
+import { putFollowList } ... | Unknown | ์๊ฑฐ๋,,, ์ฌ์ค put ์ดํ์ ํ๋ฉด์ ๋ฐ๋ก ๋ณด์ฌ์ง๊ฒ ํ๋๋ก ํ๊ณ ์ถ์ด์,,,, ์๋ก๊ณ ์นจ์ ์๋ํ์์ต๋๋คใ
ใ
! |
@@ -0,0 +1,14 @@
+import { useRouter } from 'next/navigation';
+
+export default function ConfirmFollowButton() {
+ const router = useRouter();
+
+ const handleOnclick = () => {
+ router.push('/checkfollow');
+ };
+ return (
+ <div className="commonFlex followBackButton hover:bg-grey02" onClick={handleOnclic... | Unknown | ํ ๊ฐ์ฌํฉ๋๋ค!!!!! |
@@ -0,0 +1,49 @@
+package lotto.domain;
+
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.List;
+
+public class LottoGame {
+ private static final int TICKET_PRICE = 1000;
+
+ List<LottoTicket> lottoTickets;
+ LottoMatch lottoMatch;
+
+ public LottoGame() {
+ this.lottoTicke... | Java | ์ ๊ทผ ์ ํ์๋ฅผ ๋ถ์ด๋๊ฒ ์ข์ ๊ฒ ๊ฐ๋ค์. |
@@ -0,0 +1,28 @@
+package lotto.domain;
+
+import stringcalculator.Operation;
+
+public enum LottoMatchNumber {
+ MATCH3(3, 5000) {int totalPrizeMoney(int count) {return prizeMoney * count;}},
+ MATCH4(4, 50000) {int totalPrizeMoney(int count) {return prizeMoney * count;}},
+ MATCH5(5, 1500000) {int totalPrize... | Java | enum๋ ๋น์ฆ๋์ค ๋ก์ง์ ์ผ๋ถ์ด๋ฏ๋ก view ๋ถ๋ถ์ ๊ตฌํ์ enum์ ๋๋๊ฑด ์ข์ง ์์ ๊ฒ ๊ฐ์์. |
@@ -0,0 +1,28 @@
+package lotto.domain;
+
+import stringcalculator.Operation;
+
+public enum LottoMatchNumber {
+ MATCH3(3, 5000) {int totalPrizeMoney(int count) {return prizeMoney * count;}},
+ MATCH4(4, 50000) {int totalPrizeMoney(int count) {return prizeMoney * count;}},
+ MATCH5(5, 1500000) {int totalPrize... | Java | ๋ฑ์๋ณ๋ก ๋ชจ๋ ๋์ผํ ๊ตฌํ์ฒด๋ฅผ ๊ฐ์ง ๊ฒ ๊ฐ์๋ฐ์. ์ถ์ ๋ฉ์๋๋ก ์ ์๋ ํ์๊ฐ ์๋์ง ๊ณ ๋ฏผ์ด ํ์ํด๋ณด์ฌ์.
๊ทธ๋ฆฌ๊ณ ํ์ฌ ๋ก๋ ๋๋ฉ์ธ์์ enum์ด ๋ก๋์ ๋ฑ์๋ณ ๊ฐ์ ๋ฐ ๋น์ฒจ ๊ธ์ก์ ๋ํ๋ด๋ ์ญํ ์ ํ๊ณ ์์ต๋๋ค. ๊ณ ์ ๋ ์์๋ค๋ง ๊ฐ์ง๋๊ฒ ์๋๋ผ ๋ฐ์ ๊ฐ์๋งํผ ๊ณฑํด์ ๊ณ์ฐํด์ฃผ๋ ์ญํ ์ ๊ฐ์ง๋๊ฒ ์ ์ ํ ์ง๋ ๊ณ ๋ฏผํด๋ณด์๋ฉด ์ข๊ฒ ๋ค์. |
@@ -0,0 +1,49 @@
+package lotto.domain;
+
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.List;
+
+public class LottoGame {
+ private static final int TICKET_PRICE = 1000;
+
+ List<LottoTicket> lottoTickets;
+ LottoMatch lottoMatch;
+
+ public LottoGame() {
+ this.lottoTicke... | Java | ์ค์ํ ๋ถ๋ถ์ ์๋์ง๋ง Stream.generate๋ฅผ ํตํด ๋ถ๋ณ ํํ๋ก ํํํ ์ ์์ ๊ฒ ๊ฐ๋ค์. ๊ฐ๋ณ๋ณด๋ค๋ ๋ถ๋ณ ํํ๋ก ํํํ๋๊ฒ ์ฌ์ด๋ ์ดํํธ๋ ์ ๊ณ ๊ฐ๋
์ฑ ์ธก๋ฉด์์๋ ์ข์ ๊ฒ ๊ฐ์์. |
@@ -0,0 +1,49 @@
+package lotto.domain;
+
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.List;
+
+public class LottoGame {
+ private static final int TICKET_PRICE = 1000;
+
+ List<LottoTicket> lottoTickets;
+ LottoMatch lottoMatch;
+
+ public LottoGame() {
+ this.lottoTicke... | Java | ์ผ๋ฐ์ ์ผ๋ก ๋ฉ์๋ ๋ฆฌํด ํ์
์ด๋ ํ๋ผ๋ฏธํฐ ๋ฑ์ ๋คํ์ฑ ์ธก๋ฉด์์ ์ด์ ์ด ์๊ธฐ ๋๋ฌธ์ ๊ตฌ์ฒด ํ์
(HashMap)์ ์ฌ์ฉํ์ง ์์ต๋๋ค. ์ด์ ๊ฐ ์๋๊ฒ ์๋๋ผ๋ฉด ์ธํฐํ์ด์ค์ธ Map์ ๋ฆฌํด ํ์
์ผ๋ก ์ฐ์๋๊ฒ ์ด๋จ๊น์? |
@@ -0,0 +1,49 @@
+package lotto.domain;
+
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.List;
+
+public class LottoGame {
+ private static final int TICKET_PRICE = 1000;
+
+ List<LottoTicket> lottoTickets;
+ LottoMatch lottoMatch;
+
+ public LottoGame() {
+ this.lottoTicke... | Java | ์ด๋ฐ ํํ๋ก ์ฌ์ฉํ ๊ฑฐ๋ฉด ์ธ์คํด์ค ๋ณ์ ์์ด ๋ฐ๋ก ๋ฆฌํดํ๋ ํํ๋ก ์ฌ์ฉํ๋ฉด ์ด๋จ๊น์? |
@@ -0,0 +1,47 @@
+package lotto.domain;
+
+
+import java.util.*;
+
+public class LottoMatch {
+
+ List<Integer> targetNumbers;
+
+
+ public LottoMatch(String input) {
+ targetNumbers = new ArrayList<>();
+ String[] inputs = input.split(", ");
+
+ for (int i = 0; i < inputs.length; i++) {
+ ... | Java | Stream์ groupingBy๋ Function.identity๋ฅผ ํ์ฉํด๋ณด์๋ ์ข์ ๊ฒ ๊ฐ๋ค์. |
@@ -0,0 +1,47 @@
+package lotto.domain;
+
+
+import java.util.*;
+
+public class LottoMatch {
+
+ List<Integer> targetNumbers;
+
+
+ public LottoMatch(String input) {
+ targetNumbers = new ArrayList<>();
+ String[] inputs = input.split(", ");
+
+ for (int i = 0; i < inputs.length; i++) {
+ ... | Java | ์์ฑ์๋ ์ด๋ฏธ ์์ฑ์ด๋ ์ฑ
์์ ๊ฐ์ง๊ณ ์๋๋ฐ ์์ฑ์ ๋ด๋ถ์์ split์ ํตํ ํ์ฑ ๋ฐ ์ฌ๋ฌ ์ฑ
์์ด ํฌํจ๋์ด ์๋ค์.
์์ฑ์์ ๋ก์ง์ ๋ฃ๊ณ ์ถ๋ค๋ฉด ์ ์ ํฉํฐ๋ฆฌ๋ก ๋ถ๋ฆฌํ๊ณ ์ ์ ํฉํฐ๋ฆฌ์ ๋ก์ง์ ์ถ๊ฐํ ๋ค ๊ฑฐ๊ธฐ์ ์์ฑ์๋ฅผ ํธ์ถํ๊ฑฐ๋ ํ๋ ํํ๋ก ๊ตฌํํ๋๊ฑด ์ด๋จ๊น์? |
@@ -0,0 +1,65 @@
+package lotto.domain;
+
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.List;
+
+public class LottoTicket {
+
+ private static final int PICK_NUMBERS = 6;
+
+ List<Integer> lottoNumbers;
+
+ public LottoTicket() {
+ this.lottoNumbers = new ArrayList<>();
+... | Java | ์ ์ฝ ์กฐ๊ฑด ๊ฒ์ฆ์ด ์ ํ ํฌํจ๋์ด ์์ง ์๋ค์. ๋๋ฉ์ธ์ ํน์ฑ์ ์ ๋ํ๋ด์ง ๋ชปํ๋ ๊ฒ ๊ฐ์ต๋๋ค.
1. 1 - 45๊น์ง์ ์ซ์๋ง ์กด์ฌํด์ผ ํจ
2. 6๊ฐ์ ์ค๋ณต๋์ง ์์ ์ซ์๋ก ์ด๋ฃจ์ด์ ธ์ผ ํจ
์์ ๊ฐ์ด ๋ก๋ ๋๋ฉ์ธ์ ํน์ฑ์ด ํด๋์ค์ ๋ฐ์๋๋๋ก ์ค๊ณํด๋ณด์๋ฉด ์ข๊ฒ ์ต๋๋ค. |
@@ -0,0 +1,65 @@
+package oncall.domain.date;
+
+import java.util.ArrayList;
+import java.util.List;
+import java.util.stream.Collectors;
+
+public class Day {
+ private static final String WEEK_HOLIDAY_MESSAGE = "(ํด์ผ) ";
+
+ private final Month month;
+ private final Date date;
+ private final DayOfWeek da... | Java | ์ ๋ ๋์น ๋ถ๋ถ์ด๊ธด ํ๋ฐ, "(ํด์ผ)"์ ๋ถ์ด๋ ๊ฒฝ์ฐ๊ฐ ๋ฌด์กฐ๊ฑด ๊ณตํด์ผ์ธ ๊ฒฝ์ฐ์ ๋ถ์ด๋ ๊ฒ์ด ์๋๋ผ ์ฃผ๋ง์ด ์๋ ๊ณตํด์ผ์๋ง ๋ถ์ด๋ ์กฐ๊ฑด์ด๋๋ผ๊ตฌ์..! |
@@ -0,0 +1,54 @@
+package oncall.domain.employee;
+
+import java.util.List;
+import oncall.util.exception.ErrorMessage;
+import oncall.util.exception.MyIllegalArgumentException;
+
+public class EmployeeRepository {
+ private static final int MIN_EMPLOYEES_NUMBER = 5;
+ private static final int MAX_EMPLOYEES_NUMBE... | Java | ์ค๋ณตํ์ธ ๋ก์ง์ ๋ฉ์๋๋ก ๋ถ๋ฆฌํ ๊ฒ ์ฒ๋ผ ๊ธธ์ด ๊ฒ์ฆ๋ ๋ฉ์๋๋ก ๋ถ๋ฆฌํ๋ฉด ์ข์ ๊ฑฐ ๊ฐ๋ค์! |
@@ -0,0 +1,33 @@
+package oncall.domain.schedule;
+
+import java.util.List;
+import oncall.domain.date.Day;
+import oncall.domain.employee.Employee;
+
+public class DaySchedule {
+ private final Day day;
+ private final Employee employee;
+
+ public DaySchedule(Day day, Employee employee) {
+ this.day =... | Java | ์ด๋ถ๋ถ ์๋ฐ ์ปจ๋ฒค์
์ ๋ฐ๋ผ ์นด๋ฉ์ผ์ด์ค๋ฅผ ์ฌ์ฉํ๋๊ฒ ์ข์ ๊ฑฐ ๊ฐ๊ตฐ์! ์๋๋ฉด ํน์ ์ด๋ถ๋ถ๋ง ์ค๋ค์ดํฌ์ผ์ด์ค๋ฅผ ์ฌ์ฉํ์ ์ด์ ๊ฐ ์์ผ์ ๊ฑธ๊น์? |
@@ -0,0 +1,33 @@
+package oncall.domain.schedule;
+
+import java.util.List;
+import oncall.domain.date.Day;
+import oncall.domain.employee.Employee;
+
+public class DaySchedule {
+ private final Day day;
+ private final Employee employee;
+
+ public DaySchedule(Day day, Employee employee) {
+ this.day =... | Java | @Override ์ ๋
ธํ
์ด์
์ ๋ถ์ฌ์ฃผ๋ ๊ฒ์ด ์ข์ ๊ฑฐ ๊ฐ์์ |
@@ -0,0 +1,24 @@
+package oncall.util.exception;
+
+public enum ErrorMessage {
+ WRONG_DELIMITER ("[ERROR]", "๊ตฌ๋ถ์๋ฅผ ์๋ชป ์
๋ ฅํ์
จ์ต๋๋ค. ์ฝค๋ง(,) ๋ฅผ ์ฌ์ฉํด์ฃผ์ธ์."),
+ NOT_NUMBER ("[ERROR]", "์์๋ ์ซ์๋ฅผ ์
๋ ฅํด ์ฃผ์ธ์."),
+ NOT_DAY_OF_WEEK ("[ERROR]", "์๋ชป๋ ์์ผ์ ์
๋ ฅํ์ต๋๋ค."),
+ WRONG_MONTH_VALUE("[ERROR]", "์์๋ 0~12์ ์ซ์๋ฅผ ์
๋ ฅํด ์ฃผ์ธ์."),
+ WRO... | Java | ์์๋ 1~12์ ์ซ์๋ฅผ ์
๋ ฅํด๋ฌ๋ผ๋ ๋ฉ์ธ์ง๊ฐ ๋ง์ง ์๋์? |
@@ -0,0 +1,60 @@
+package oncall.view;
+
+
+import camp.nextstep.edu.missionutils.Console;
+import java.util.List;
+import oncall.util.converter.ViewConverter;
+import oncall.util.exception.ErrorMessage;
+import oncall.util.exception.MyIllegalArgumentException;
+import oncall.view.dto.InputMonthAndDayDto;
+
+public cla... | Java | ์ฌ์ํ๊ธด ํ์ง๋ง ์์ ์
๋ ฅ ํํ๋ณด๋ฉด "๋น์ ๊ทผ๋ฌด๋ฅผ ๋ฐฐ์ ํ ์๊ณผ ์์ ์์ผ์ ์
๋ ฅํ์ธ์> " ๋ฉ์์ง ๋ฐ๋ก ์์์๋ถํฐ ์
๋ ฅํ ์ ์๋ ํํ์
๋๋ค!
System.out.println(...) ๋์ System.out.print() ๋ฅผ ์ฌ์ฉํ๋ฉด ์์ฒ๋ผ ํ์ค ๋ฐ์ด์ ์
๋ ฅ๋ฐ๋๊ฒ ์๋๋ผ ์ถ๋ ฅํ๊ณ ๋ฐ๋ก ๋ค์ ์
๋ ฅ๋ฐ์ ์ ์์ต๋๋ค |
@@ -0,0 +1,78 @@
+package oncall.domain.schedule;
+
+import java.util.ArrayList;
+import java.util.List;
+import java.util.stream.Collectors;
+import oncall.domain.date.Month;
+
+public class MonthSchedule {
+ private final Month month;
+ private final List<DaySchedule> daySchedules;
+
+ public MonthSchedule(M... | Java | ์ด ๋ถ๋ถ์์ ์ฌ๊ท๋ฅผ ํ์ถํ์ง ๋ชปํด ์คํ์ค๋ฒํ๋ก์ฐ๊ฐ ๋ฐ์ํ๊ณ ์์ด์..! |
@@ -0,0 +1,31 @@
+package oncall.service;
+
+import java.util.ArrayList;
+import java.util.List;
+import oncall.domain.date.Day;
+import oncall.domain.employee.Employee;
+import oncall.domain.employee.EmployeeProvider;
+import oncall.domain.schedule.DaySchedule;
+import oncall.domain.schedule.MonthSchedule;
+
+public c... | Java | ์ ๋ฒํผ๋ ์ด๋ค ์ญํ ์ ํ๋์? |
@@ -0,0 +1,24 @@
+package oncall.util.exception;
+
+public enum ErrorMessage {
+ WRONG_DELIMITER ("[ERROR]", "๊ตฌ๋ถ์๋ฅผ ์๋ชป ์
๋ ฅํ์
จ์ต๋๋ค. ์ฝค๋ง(,) ๋ฅผ ์ฌ์ฉํด์ฃผ์ธ์."),
+ NOT_NUMBER ("[ERROR]", "์์๋ ์ซ์๋ฅผ ์
๋ ฅํด ์ฃผ์ธ์."),
+ NOT_DAY_OF_WEEK ("[ERROR]", "์๋ชป๋ ์์ผ์ ์
๋ ฅํ์ต๋๋ค."),
+ WRONG_MONTH_VALUE("[ERROR]", "์์๋ 0~12์ ์ซ์๋ฅผ ์
๋ ฅํด ์ฃผ์ธ์."),
+ WRO... | Java | ```suggestion
private static final String prefix = "[ERROR] ";
```
ํญ์ `prefix` ๋ถ๋ถ์ ์ค๋ณต๋๊ธฐ์ ํด๋น ๋ถ๋ถ์ ์์๋ก ์ถ์ถํ๋ ๊ฒ๋ ๊ด์ฐฎ์ ๊ฒ ๊ฐ๋ค๊ณ ์๊ฐํด์. |
@@ -0,0 +1,43 @@
+package oncall.domain.date;
+
+import java.util.Arrays;
+import oncall.util.exception.ErrorMessage;
+import oncall.util.exception.MyIllegalArgumentException;
+
+public enum Month {
+ JAN(1, 31),
+ FEB(2, 28),
+ MAR(3, 31),
+ APR(4, 30),
+ MAY(5,31),
+ JUN(6, 30),
+ JUL(7, 31),
+ ... | Java | ํด๋น ํด๋์ค๋ `java.time.Month` enum์ผ๋ก ์๋ฒฝํ ๋์ฒด ๊ฐ๋ฅํ ๊ฒ ๊ฐ์ต๋๋ค!
(๋ฌผ๋ก ์ ๋ ์ด ์ฌ์ค์ ์ํ์ด ๋๋ ํ ๊นจ๋ฌ์์ต๋๋ค...ใ
ใ
) |
@@ -0,0 +1,43 @@
+package oncall.domain.date;
+
+import java.util.Arrays;
+import java.util.Objects;
+import oncall.util.exception.ErrorMessage;
+import oncall.util.exception.MyIllegalArgumentException;
+
+public enum DayOfWeek {
+ SUN(0, "์ผ"), MON(1, "์"), TUE(2, "ํ"), WED(3, "์"),
+ THU(4, "๋ชฉ"), FRI(5, "๊ธ"), SA... | Java | `code`๋ฅผ ๊ธฐ์ค์ผ๋ก ์ ๋ ฌ๋ ๋ฐฐ์ด, ๋๋ ๋ฆฌ์คํธ๋ฅผ ๋ฏธ๋ฆฌ ์บ์ฑํด ๋๋ค๋ฉด ๋ฐ๋ณต์ ์ธ `getNextDayOfWeek()` ํธ์ถ ์ํฉ์์ ๋งค๋ฒ `Stream` ๊ฐ์ฒด๋ฅผ ์์ฑํ์ง ์์๋ ๋๋ฉฐ `code`๋ฅผ ์ฌ์ฉํด ์ธ๋ฑ์ค๋ก ์ ๊ทผ๋ง ํ๋ฉด ๋๊ธฐ์ ์ฑ๋ฅ์ด ํจ์ฌ ์ข์์ง ๊ฒ ๊ฐ์ต๋๋ค! |
@@ -0,0 +1,32 @@
+package oncall.domain.employee;
+
+import java.util.Objects;
+import oncall.util.exception.ErrorMessage;
+import oncall.util.exception.MyIllegalArgumentException;
+
+public class Employee {
+ private final String name;
+
+ public Employee(String name) {
+ validateEmployeeName(name);
+ ... | Java | ์์ ์ถ์ถ์ด ๊ฐ๋ฅํ ๊ฒ ๊ฐ์ต๋๋ค! |
@@ -0,0 +1,17 @@
+package oncall.domain.employee;
+
+import java.util.List;
+
+public class EmployeeGenerator {
+ public static List<WeekWorkEmployee> generateWeekWorkEmployees(List<String> input) {
+ return input.stream()
+ .map(WeekWorkEmployee::new)
+ .toList();
+ }
+
+ ... | Java | ์ดํ๋ฆฌ์ผ์ด์
์์ ๋ ๊ฐ์ ์๋ก ๋ค๋ฅธ ํด๋์ค๋ก ๊ตฌ๋ถ๋๋ `WeekWorkEmployee`์ `WeekendWorkEmployee`๊ฐ ๊ธฐ๋ฅ์ ์ธ ์ฐจ์ด๊ฐ ์์ด ๋ณด์ด๋๋ฐ์.
๋์ผํ `Employee`๋ฅผ ๋ณ์ ๋ช
์ผ๋ก ๊ตฌ๋ถํด ์ฃผ๋ ๋์ ๋ณ๋์ ํด๋์ค๋ก ๊ตฌํํ์ ์ด์ ๊ฐ ์์๊น์? |
@@ -0,0 +1,54 @@
+package oncall.domain.employee;
+
+import java.util.List;
+import oncall.util.exception.ErrorMessage;
+import oncall.util.exception.MyIllegalArgumentException;
+
+public class EmployeeRepository {
+ private static final int MIN_EMPLOYEES_NUMBER = 5;
+ private static final int MAX_EMPLOYEES_NUMBE... | Java | getter๋ฅผ ํตํด ์ธ๋ถ์ ์ปฌ๋ ์
์ ํฌ๊ธฐ๋ฅผ ๋
ธ์ถ์ํค๋ ๋์ , `getXXXEmployees(int index)` ๋ฉ์๋์์ % ๋๋จธ์ง ์ฐ์ฐ์ ํจ๊ป ์ํํด ์ฃผ๋ ๊ฒ์ ์ด๋จ๊น์?
์ธ๋ถ์์๋ ์ด ํด๋์ค๋ฅผ ์ด์ฉํ ๋ ๋ด๋ถ์์ ์ด๋ค ์์ผ๋ก ์์๋ฅผ ์ ์ง์ํจ ์ฑ ๋ฐ๋ณต์ ์ผ๋ก ๋ฉค๋ฒ๋ฅผ ํ์ํ๋์ง์ ๊ตฌํ์ ์ ๊ฒฝ์ฐ์ง ์๊ณ "`index` ๋ฒ์งธ์ ๊ทผ๋ฌด์"๋ฅผ ๊ตฌํ ์ ์์ ๊ฒ ๊ฐ์์!
์ด๋ ๊ฒ ๋๋ฉด ์ธ์ ๊ฐ ๋ด๋ถ ์๋ฃ๊ตฌ์กฐ๊ฐ `List<>`์์ ๋ฐฐ์ด๋ก ๋ณ๊ฒฝ๋๋ ๋ฑ์ ๋ณํ๊ฐ ์๋๋ผ๋ ์ธ๋ถ ์ฝ๋๊ฐ ๋ณ๊ฒฝ๋์ง ์์ ๊ฒ ๊ฐ์ต๋๋ค! |
@@ -0,0 +1,11 @@
+package oncall.domain.date;
+
+public class DayGenerator {
+ public static Day generateFirstDay(Month month, DayOfWeek firstDayOfWeek) {
+ return new Day(month, new Date(1), firstDayOfWeek);
+ }
+
+ public static Day generateDay(Day day) {
+ return day.makeNextDay();
+ }
+} | Java | ๋ ์ง๋ฅผ ์์ฑํด ์ฃผ๋ ์ญํ ์ ์ํํ๋ ์ ์ ์ ํธ ํด๋์ค์ฒ๋ผ ๋ณด์ด๋๋ฐ์.
์ ๋ "๋ ์ง ๊ฐ์ฒด ์์ฑ" ์ญ์ ๋ ์ง ๊ฐ์ฒด ์ค์ค๋ก์ ์ฑ
์์ด๋ผ๊ณ ์๊ฐํด์.
๋๋ฌธ์ `generateFirstDay()` ๋ฉ์๋๋ ๋จ์ํ `Day.of(Month, DayOfWeek)`์ ํํ๋ฅผ ๊ฐ์ง๋ ์ ์ ํฉํ ๋ฆฌ ๋ฉ์๋๋ก๋ง ๊ตฌํํด๋ ๊ด์ฐฎ์ง ์์์๊น ์๊ฐํฉ๋๋ค.
์ด๋ ๊ฒ ๊ตฌํํด ์ค๋ค๋ฉด `DayGenerator` ํด๋์ค๋ฅผ `Day` ํด๋์ค์ ๋ณํฉํด ์ค ์ ์์ ๊ฒ ๊ฐ์์. |
@@ -0,0 +1,106 @@
+package chess.database.dao;
+
+import chess.dto.game.ChessGameLoadDto;
+import chess.dto.game.ChessGameSaveDto;
+
+import java.sql.*;
+import java.util.ArrayList;
+import java.util.List;
+
+public final class DbChessGameDao implements ChessDao {
+
+ private final String url;
+ private final Str... | Java | Jdbc Connection ๊ด๋ฆฌ๋ฅผ Dao์์ ํด์ฃผ๊ณ ๊ณ์๋ค์! ๊ทธ๋ฐ๋ฐ ๊ด๋ฆฌํด์ผ ํ ํ
์ด๋ธ์ด ๋์ด๋์ ์ฌ๋ฌ Dao ๊ฐ์ฒด๊ฐ ์๊ฒจ๋๊ฒ ๋๋ฉด ์ค๋ณต๋๋ ์ฝ๋์ธ ์ธ์คํด์ค ๋ณ์๋ค์ด ๋ฐ์ํ๊ฒ ๋ ๊ฒ ๊ฐ์์.
์ ๋ ์ฒด์ค๋ฏธ์
์ ์งํํ๋ฉฐ ๋ฆฌ๋ทฐ์ด๋ถ๊ป ๋ฆฌ๋ทฐ๋ฐ์ ์ฌํญ์ธ๋ฐ DB Connection๊ณผ ๊ฐ์ resource ๊ด๋ฆฌ ์ฝ๋๋ฅผ Util ํด๋์ค ๋ฑ์ผ๋ก ๊ตฌ๋ถํด์ ๊ด๋ฆฌํด๋ณด์๋ ๊ฑด ์ด๋จ์ง ์ ์๋๋ ค๋ด
๋๋ค! |
@@ -0,0 +1,106 @@
+package chess.database.dao;
+
+import chess.dto.game.ChessGameLoadDto;
+import chess.dto.game.ChessGameSaveDto;
+
+import java.sql.*;
+import java.util.ArrayList;
+import java.util.List;
+
+public final class DbChessGameDao implements ChessDao {
+
+ private final String url;
+ private final Str... | Java | Dao์์ NullPointerException์ ๋ฌด์ํ๋ ๊ฒ์ ๋ฆฌ๋ทฐ์ด๋ฅผ ์ํ ๋ฐฐ๋ ค์ผ๊น์? ใ
ใ
๊ทธ๊ฒ ์๋๋ผ๋ฉด ์ด๋ค ์๋๋ก ์์ธ๋ฅผ ๋ฌด์์ฒ๋ฆฌํด์ฃผ์ ๊ฑด์ง ๊ถ๊ธํฉ๋๋ค~ |
@@ -1,7 +1,97 @@
-# java-chess
+## ์ ์ฒด ์๋๋ฆฌ์ค
-์ฒด์ค ๋ฏธ์
์ ์ฅ์
+1. start๋ฅผ ์
๋ ฅ ๋ฐ์ผ๋ฉด ๊ฒ์์ ์์ํ๋ค.
+ - [์์ธ] ๊ฒ์์ด ์์ํ์ง ์์๋๋ฐ move๋ฅผ ์
๋ ฅํ๋ฉด ์์ธ๊ฐ ๋ฐ์ํ๋ค.
+2. move sourcePosition targetPosition์ ์
๋ ฅ ๋ฐ์ ๊ธฐ๋ฌผ์ ์์ง์ธ๋ค.
+ - [์์ธ] ๊ฒ์ ์งํ ์ค์ start๋ฅผ ์
๋ ฅํ๋ฉด ์์ธ๊ฐ ๋ฐ์ํ๋ค.
+3. status๋ฅผ ์
๋ ฅ ๋ฐ์ ๊ฐ ์ง์์ score๋ฅผ ์ถ๋ ฅํ๊ณ ์นํจ๋ฅผ ์ถ๋ ฅํ๋ค.
+4. ํน์ด ๋จผ์ ์กํ๋ ์ง์์ด ํจํ๊ณ , ์ฆ์ ๊ฒ์์ ์ข
๋ฃํ๋ค.
+5. end๋ฅผ... | Unknown | DDL ๋ช
์ ์ข์์~
์ ๋ ๋ฆฌ๋ทฐ์ด ๋ถ๊ป ๋ฆฌ๋ทฐ๋ฐ์ ์ฌํญ ์ค ํ๋๋ฅผ ๋ง์๋๋ฆฌ๋ฉด ํ์ฌ chess_game ํ
์ด๋ธ์์ ๊ด๋ฆฌ๋๋ ๋ฐ์ดํฐ๋ค์ ๋ณด๋ฉด ํ
์ด๋ธ ๋ช
์ด chess_game์ด ์๋๋ผ piece๊ฐ ๋์ด์ผ ํ์ง ์์๊น ํ๋ ๊ฒ์
๋๋ค. |
@@ -43,7 +43,7 @@ set JAVA_EXE=java.exe
if "%ERRORLEVEL%" == "0" goto execute
echo.
-echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
+echo ERROR: JAVA_HOME is not set and no 'java' gameCommand could be found in your PATH.
echo.
echo Please set the JAVA_HOME variable in yo... | Unknown | ์...? ์ด ํ์ผ์ command ๋ผ๋ ๋จ์ด๋ฅผ ์ ์ฒด ์นํํ๋ค๊ฐ ๊ฐ์ด ์์ ๋์ด ๋ฒ๋ฆฐ ๊ฒ ๊ฐ์ ๋ณด์ฌ์~ |
@@ -0,0 +1,12 @@
+package chess.database;
+
+public final class DbInfo {
+
+ public static String service_url = "jdbc:mysql://127.0.0.1:13306/chess?useSSL=false&serverTimezone=UTC";
+ public static String service_user = "root";
+ public static String service_password = "root";
+
+ public static String test_... | Java | ์ด ํด๋์ค์์ connection์ ๋ง๋ค์ด์ ๋์ ธ์ฃผ๋ ๊ฑด ์ด๋จ๊น์? |
@@ -0,0 +1,21 @@
+package chess;
+
+import chess.controller.ChessController;
+import chess.view.IOViewResolver;
+import chess.view.InputView;
+import chess.view.OutputView;
+
+import java.util.Scanner;
+
+public final class MainApp {
+
+ public static void main(String[] args) {
+ try (Scanner scanner = new Sc... | Java | ์์๊ด๋ฆฌ ์ฟ ์ธ ๐ |
@@ -0,0 +1,70 @@
+package chess.controller;
+
+import chess.domain.game.File;
+import chess.domain.game.Position;
+import chess.domain.game.Rank;
+
+import java.util.Arrays;
+import java.util.List;
+
+public enum GameCommand {
+ INIT,
+ START,
+ FIRST_MOVE,
+ MOVE,
+ STATUS,
+ END;
+
+ public stati... | Java | ์ฒ์ GameCommand ํด๋์ค๋ฅผ ๋ณด๋๋ฐ Position์ ๊ตฌํ๋ ์ฝ๋๋ค์ด ์ ์ฌ๊ธฐ์ ๋ค์ด๊ฐ ์์๊น๊ฐ ์ข ๊ถ๊ธํ์์ต๋๋ค. ์๋ง ํํฌ๊ฐ input์ผ๋ก ๋ค์ด์จ command๋ฅผ ๊ฐ์ง๊ณ position์ ๊ตฌํ๋ ๊ธฐ๋ฅ์ด๋ผ๊ณ ์๊ฐํด์ GameCommand๋ก ๋ถ๋ฆฌํ์ ๊ฒ ๊ฐ์์.
์ ๋ผ๋ฉด ํด๋น ๊ธฐ๋ฅ๋ค์ file, rank, Position Enum์์ ์ฑ
์์ ์ง๋๋ก ํ์ ๊ฒ ๊ฐ์๋ฐ ํํฌ ์๊ฒฌ์ ์ด๋ ์ ์ง ๊ถ๊ธํด์~ |
@@ -0,0 +1,113 @@
+package chess.domain.game;
+
+import chess.domain.piece.Empty;
+import chess.domain.piece.Piece;
+import chess.domain.piece.PieceType;
+import chess.domain.piece.Team;
+import chess.domain.piece.pawn.BlackPawn;
+import chess.domain.piece.pawn.WhitePawn;
+import chess.dto.mapper.ParseToDto;
+import ch... | Java | pawn์ ๋ํ ์ฒ๋ฆฌ ๋ก์ง์ ํฌํจํด์ ๊ธฐ๋ฌผ ์ด๋ ๋ก์ง์ด ์ ๋ง ๊น๋ํ๋ค์! ๐ฏ |
@@ -0,0 +1,31 @@
+//
+// SceneDelegate.swift
+// DrawingApp
+//
+// Created by ๊นํ๋ฆผ on 2023/03/28.
+//
+
+import UIKit
+
+class SceneDelegate: UIResponder, UIWindowSceneDelegate {
+
+ var window: UIWindow?
+
+
+ func scene(_ scene: UIScene, willConnectTo session: UISceneSession, options connectionOptions: UISce... | Swift | ํ์์๊ฑฐ๋ ์ฌ์ฉํ์ง ์๋ ๋ฉ์๋๋ ํ๋จํ์ฌ ์ญ์ ํ๋๊ฒ๋ ์ข์ ๊ฑฐ ๊ฐ์ต๋๋ค |
@@ -0,0 +1,91 @@
+//
+// ViewController.swift
+// DrawingApp
+//
+// Created by ๊นํ๋ฆผ on 2023/03/28.
+//
+
+import UIKit
+import OSLog
+
+class ViewController: UIViewController {
+
+ override func viewDidLoad() {
+ super.viewDidLoad()
+
+ let rect1 = RectangleFactory.createRectangle()
+ os... | Swift | ์ขํ ์์ ํ ๊ฐ๋ฅ์ฑ์ด ์๋ค๋ฉด ์์๋ก ์ ์ธํ๋ ๊ฒ๋ ์ข์๋ณด์
๋๋ค |
@@ -0,0 +1,91 @@
+//
+// ViewController.swift
+// DrawingApp
+//
+// Created by ๊นํ๋ฆผ on 2023/03/28.
+//
+
+import UIKit
+import OSLog
+
+class ViewController: UIViewController {
+
+ override func viewDidLoad() {
+ super.viewDidLoad()
+
+ let rect1 = RectangleFactory.createRectangle()
+ os... | Swift | ๊ฐ์ธ์ ์ผ๋ก ํ์ ๊ฐ์ฒด๋ ํ๋กํ ์ฝ๋ค์ ๋ค๋ฅธ ํ์ผ๋ก ๋ถ๋ฆฌํ๋ ๊ฒ๋ ์ข์ ๊ฒ ๊ฐ์ต๋๋ค
์ ๋ ๋ถ๋ฆฌํ์ ๋ ์ถํ์ ์ฝ๋ ์์ ์ ์ฐพ์๊ฐ๊ธฐ ์ฌ์์ ์ข์์ต๋๋ค |
@@ -0,0 +1,91 @@
+//
+// ViewController.swift
+// DrawingApp
+//
+// Created by ๊นํ๋ฆผ on 2023/03/28.
+//
+
+import UIKit
+import OSLog
+
+class ViewController: UIViewController {
+
+ override func viewDidLoad() {
+ super.viewDidLoad()
+
+ let rect1 = RectangleFactory.createRectangle()
+ os... | Swift | ํ๋ผ๋ฏธํฐ๋ฅผ ์ค๋ก ๋๋ ์ฃผ์ ๋ฐฉ์ ์ฝ๊ธฐ ํธํ๊ณ ๊น ๊ด๋ฆฌํ๊ธฐ ์์ํ๋ค์
์ ๋ ์นดํผ์นดํผ ํด๋๋ ๊น์? |
@@ -0,0 +1,32 @@
+//
+// Rectangle.swift
+// DrawingApp
+//
+// Created by ๊นํ๋ฆผ on 2023/03/30.
+//
+
+import Foundation
+
+class Rectangle : RectangleComponent {
+ let id:String
+ let size:RectangleSize
+ let position:RectanglePosition
+ let backGroundColor:(red:Int, green:Int, blue:Int)
+ let alpha:In... | Swift | Color ํํํ์์ผ๋ก ํ๋ฒ์ ์ฌ๋ฌ๊ฐ์ ํ๋ผ๋ฏธํฐ๋ฅผ ๋ฐ์ ์ ์๋์ง ๋ชฐ๋๋ค์
ํ ์ ๋ฐฐ์๊ฐ์ |
@@ -0,0 +1,91 @@
+//
+// ViewController.swift
+// DrawingApp
+//
+// Created by ๊นํ๋ฆผ on 2023/03/28.
+//
+
+import UIKit
+import OSLog
+
+class ViewController: UIViewController {
+
+ override func viewDidLoad() {
+ super.viewDidLoad()
+
+ let rect1 = RectangleFactory.createRectangle()
+ os... | Swift | ๋ชจ๋ธ ํ์ ํ์
์ ํด๋์ค๋ก ํ์
จ๋๋ฐ ์ ํํ์ ๊ธฐ์ค์ด ์๋์ง ๊ถ๊ธํด์ |
@@ -0,0 +1,91 @@
+//
+// ViewController.swift
+// DrawingApp
+//
+// Created by ๊นํ๋ฆผ on 2023/03/28.
+//
+
+import UIKit
+import OSLog
+
+class ViewController: UIViewController {
+
+ override func viewDidLoad() {
+ super.viewDidLoad()
+
+ let rect1 = RectangleFactory.createRectangle()
+ os... | Swift | ๋ง์ฝ ์ธ๋ถ์์ ๋ฐ๋์ ์ ๊ทผํด์ผ๋ง ํ๋ค๋ฉด private์ ๋นผ๋๊ฒ๋ ์ข์๋ณด์
๋๋ค |
@@ -0,0 +1,91 @@
+//
+// ViewController.swift
+// DrawingApp
+//
+// Created by ๊นํ๋ฆผ on 2023/03/28.
+//
+
+import UIKit
+import OSLog
+
+class ViewController: UIViewController {
+
+ override func viewDidLoad() {
+ super.viewDidLoad()
+
+ let rect1 = RectangleFactory.createRectangle()
+ os... | Swift | class func ๋์ static func์ ์ฐ์ ์ด์ ๋ ์ค๋ฒ๋ผ์ด๋ฉ์ด ๋ถ๊ฐ๋ฅํ๋๋ก ์๋ํ์ ๊ฑฐ ๋ง์๊น์?๐๐ป |
@@ -0,0 +1,91 @@
+//
+// ViewController.swift
+// DrawingApp
+//
+// Created by ๊นํ๋ฆผ on 2023/03/28.
+//
+
+import UIKit
+import OSLog
+
+class ViewController: UIViewController {
+
+ override func viewDidLoad() {
+ super.viewDidLoad()
+
+ let rect1 = RectangleFactory.createRectangle()
+ os... | Swift | [UIScreen.main ๊ณต์๋ฌธ์](https://developer.apple.com/documentation/uikit/uiscreen/1617815-main)
์ฐ์ฐํ Apple Documentation์์ ๋ฐ๊ฒฌํ๋๋ฐ, main์ Deprecated ๋์๋๋ผ๊ณ ์
์๋จ ๊ณต์๋ฌธ์ ๋ด์ฉ์์ ์ถ์ฒํ๋ ๋ค๋ฅธ๋ฐฉ๋ฒ์ ์ฌ์ฉํด๋ณด์๋ ๊ฒ๋ ์ข์๊ฑฐ๊ฐ์์ |
@@ -0,0 +1,91 @@
+//
+// ViewController.swift
+// DrawingApp
+//
+// Created by ๊นํ๋ฆผ on 2023/03/28.
+//
+
+import UIKit
+import OSLog
+
+class ViewController: UIViewController {
+
+ override func viewDidLoad() {
+ super.viewDidLoad()
+
+ let rect1 = RectangleFactory.createRectangle()
+ os... | Swift | ํ์ต ๊ฐ์ด๋์์ ์ฐธ๊ณ ํ๋๋ฐ,
๋ฉ์๋ ๋ค์ด๋ฐ์ ํจ์๋ก ์์ฑํ๋๊ฒ ์ข๋ค๊ณ ๋์ด์์ด ์ฐธ๊ณ ํ์๋ฉด ์ข์ ๋ณด์
๋๋ค |
@@ -0,0 +1,91 @@
+//
+// ViewController.swift
+// DrawingApp
+//
+// Created by ๊นํ๋ฆผ on 2023/03/28.
+//
+
+import UIKit
+import OSLog
+
+class ViewController: UIViewController {
+
+ override func viewDidLoad() {
+ super.viewDidLoad()
+
+ let rect1 = RectangleFactory.createRectangle()
+ os... | Swift | uuid ์์ด ๋ง๋๋ ๋ฐฉ์์ด ์๋์ง๋ ๋ชฐ๋๋๋ฐ, ์ ์ ํ๊ณ ๋ ๊น๋ํ ๋ฐฉ์์ด๋ค์๐๐ป |
@@ -0,0 +1,91 @@
+//
+// ViewController.swift
+// DrawingApp
+//
+// Created by ๊นํ๋ฆผ on 2023/03/28.
+//
+
+import UIKit
+import OSLog
+
+class ViewController: UIViewController {
+
+ override func viewDidLoad() {
+ super.viewDidLoad()
+
+ let rect1 = RectangleFactory.createRectangle()
+ os... | Swift | ํ๋กํ ์ฝ์ ์ ์ธ๋ ํ๋กํผํฐ๋ค์ ์ฑํํ์ ๋ private ์ ๊ทผ์ ์ด์๋ฅผ ์ฌ์ฉํ์ง ๋ชปํ๋ ๊ฑธ๋ก ์๊ณ ์์ต๋๋ค.
์ ๊ทผ์ ์ด์๊ฐ ํ์ํ ์์๋ค๋ง ํ๋กํ ์ฝ์ ์ถ๊ฐํ๋ ๊ฒ๋ ์ข์ ๋ณด์
๋๋ค. |
@@ -0,0 +1,30 @@
+package store.contant;
+
+public enum Constant {
+ PRODUCTS_FILE_PATH("./src/main/resources/products.md"),
+ PROMOTIONS_FILE_PATH("./src/main/resources/promotions.md"),
+
+ Y("Y"),
+ N("N"),
+
+ YEAR("year"),
+ MONTH("month"),
+ DAY("day"),
+
+ DEFAULT_DELIMITER("-... | Java | ์ ๋ ๋ชฐ๋๋ ์ ๊ทํํ์ ๋ฌธ๋ฒ์ด๋ผ ์ฐพ์๋ณด๋๊น named capturing group ์ด๋ผ๊ณ ํ๋๊ตฐ์.. ์๋ก์ด๊ฑฐ ๋ฐฐ์๊ฐ๋๋ค! |
@@ -0,0 +1,126 @@
+package store.view;
+
+import java.text.NumberFormat;
+import store.domain.Product;
+import store.domain.Products;
+import store.dto.PurchaseDTO;
+import store.dto.ReceiptDTO;
+
+public class OutputView {
+ private static final NumberFormat format = NumberFormat.getNumberInstance();
+
+... | Java | ์ด๋ฐ ๋ถ๋ถ์๋ DTO๋ฅผ ๋ฐ์์ ์ฒ๋ฆฌํ๋๊ฑด ์ด๋ป๊ฒ ์๊ฐํ์๋์? |
@@ -0,0 +1,14 @@
+package store.exception;
+
+public class CustomException extends IllegalArgumentException {
+ private final String errorMessage;
+
+ public CustomException(String errorMessage) {
+ super(errorMessage);
+ this.errorMessage = errorMessage;
+ }
+
+ public String getErr... | Java | CustomException ํด๋์ค๋ฅผ ๋ฐ๋ก ๋ง๋์ ์ด์ ๊ฐ ๊ถ๊ธํฉ๋๋ค (์ด ๋ถ๋ถ์ ์ ๋ชฐ๋ผ์). |
@@ -0,0 +1,57 @@
+package store.view;
+
+import java.time.LocalDate;
+import java.time.LocalDateTime;
+import java.util.List;
+import java.util.regex.Matcher;
+import java.util.regex.Pattern;
+import store.contant.Constant;
+import store.dto.BuyDTO;
+import store.exception.CustomException;
+import store.excep... | Java | Matcher.results()๋ก ๋๋๋๊ฑด ๊น๋ํ์ง๋ง ํ๋ชฉ์ ๋๋๋ ๊ตฌ๋ถ์๋ก ์ผํ๊ฐ ์๋์ด๋ ์๋ํด์, ์๊ตฌ์ฌํญ์ ๋ง์ถ๋ ค๋ฉด ์์ ํด์ผ ํ ๊ฒ ๊ฐ์์. |
@@ -0,0 +1,83 @@
+package store.view;
+
+import camp.nextstep.edu.missionutils.Console;
+import java.util.List;
+import store.contant.Constant;
+import store.dto.BuyDTO;
+import store.exception.CustomException;
+import store.exception.ErrorMessage;
+
+public class InputView {
+ public static List<BuyDTO> r... | Java | validate() ๋ค์ด๋ฐ์ด ์กฐ๊ธ ๋ ๊ตฌ์ฒด์ ์ด๋ฉด ์ข์ ๊ฒ ๊ฐ์ต๋๋ค. |
@@ -0,0 +1,108 @@
+package store.controller;
+
+import java.io.IOException;
+import java.nio.file.Files;
+import java.nio.file.Paths;
+import java.time.LocalDateTime;
+import java.util.List;
+import org.junit.platform.commons.logging.Logger;
+import org.junit.platform.commons.logging.LoggerFactory;
+import sto... | Java | ์ปจํธ๋กค๋ฌ์ ์์ฑ์๋ run ๋ถ๋ถ์ด ์ ๋ง ๊น๋ํ๊ณ ์ข์ ๊ฒ ๊ฐ์์! |
@@ -0,0 +1,206 @@
+package store.domain;
+
+import camp.nextstep.edu.missionutils.DateTimes;
+import java.util.ArrayList;
+import java.util.List;
+import java.util.Map;
+import java.util.Set;
+import store.contant.Constant;
+import store.dto.BuyDTO;
+import store.dto.ProductsDTO;
+import store.dto.PurchaseDTO... | Java | InputView๋ฅผ ํธ์ถํ๋ ๋ถ๋ถ์ ์ปจํธ๋กค๋ฌ๋ฅผ ๊ฑฐ์น๋๊ฒ ์ข์ง ์์๊น ์๊ฐํฉ๋๋ค. |
@@ -0,0 +1,35 @@
+package store.dto;
+
+import java.util.List;
+
+public record ReceiptDTO(
+ List<PurchaseDTO> cart,
+ List<PurchaseDTO> free
+) {
+ public int getTotalQuantity() {
+ return cart.stream()
+ .mapToInt(PurchaseDTO::quantity)
+ .sum();
+ ... | Java | 0.3์ ์ค์ํ ์ซ์๋ผ ์์๋ก ๋ฐ๊พธ๋ฉด ์ข์ ๊ฒ ๊ฐ์ต๋๋ค! |
@@ -0,0 +1,126 @@
+package store.view;
+
+import java.text.NumberFormat;
+import store.domain.Product;
+import store.domain.Products;
+import store.dto.PurchaseDTO;
+import store.dto.ReceiptDTO;
+
+public class OutputView {
+ private static final NumberFormat format = NumberFormat.getNumberInstance();
+
+... | Java | ๊ฐ์๊ฐ 0์ด์ด๋ ์ถ๋ ฅ์ด ๋๋๋ฐ, 0์ผ๋ ์ถ๋ ฅ์์ ์ ์ธ์ํค๋ ๊ฒ๋ ์ข์ ๊ฒ ๊ฐ์ต๋๋ค. |
@@ -0,0 +1,108 @@
+package store.controller;
+
+import java.io.IOException;
+import java.nio.file.Files;
+import java.nio.file.Paths;
+import java.time.LocalDateTime;
+import java.util.List;
+import org.junit.platform.commons.logging.Logger;
+import org.junit.platform.commons.logging.LoggerFactory;
+import sto... | Java | ์ด๋ ๊ฒ ๋๋ฉด ํ๋ก๋ชจ์
๊ธฐ๊ฐ์ ์ข
๋ฃ๋ ์ง๊ฐ ์ฌ์ค ํฌํจ์ด ์๋์ด์ (์ข
๋ฃ๋ ์ง๋ก ๋์ด๊ฐ๋ 00์ 00๋ถ 00์ด ๊น์ง๋ง ํฌํจ๋๋๋ผ๊ตฌ์),
endDate.plusDays(1) ์ .atStartOfDay() ๋ฅผ ์ฌ์ฉํ๋๊ฒ ๋ ๋ง๋ค๊ณ ์๊ฐํฉ๋๋ค. |
@@ -0,0 +1,83 @@
+package christmas.service;
+
+import christmas.constant.Constant;
+import christmas.domain.Badge;
+import christmas.domain.Benefit;
+import christmas.domain.Event;
+import christmas.domain.OrderMenu;
+import christmas.view.input.template.InputCallback;
+import christmas.view.input.template.InputTempla... | Java | ์์์ inputView์ ๋ฉ์๋๋ฅผ ๋๊ฒจ๋ฐ๊ณ ์คํํ๋ ๋ชจ์ต์ด๋๋ฐ, ๊ทธ๋ฅ ChristmasController์์ ์งํํ๋ ๊ฒ ์ข์์ ๊ฒ ๊ฐ์์. ๊ตณ์ด ์๋น์ค๊น์ง ๊ฑธ์น ํ์๊ฐ ์์์ ๊ฒ ๊ฐ์์.
์๋น์ค ๊ฐ์ฒด ๋ด์์ ํด๋น ๋ฉ์๋๊ฐ ์ฐ์ธ ๊ฒ๋ ์๋๊ณ , ์ค๋ก์ง ์ปจํธ๋กค๋ฌ์์๋ง ์ด ๋ฉ์๋๊ฐ ํธ์ถ๋๊ณ ์์ด์. |
@@ -0,0 +1,72 @@
+package christmas.domain;
+
+import christmas.constant.Constant;
+import java.util.EnumMap;
+import java.util.Map;
+import java.util.Map.Entry;
+
+public class Benefit {
+
+ private final Map<Event, Integer> details;
+
+ public Benefit() {
+ this.details = new EnumMap<>(Event.class);
+ ... | Java | add ๋ฉ์๋๋ฅผ ๊ตฌํํ๋ ๊ฒ๋ณด๋ค๋ ์์ฑ์์์ ์์ฑ๋ EnumMap์ ๋ฐ๋ ๊ฒ ์ข์ ๊ฒ ๊ฐ์์.
add ๋ฉ์๋๋ฅผ ์ด์ฉํด์ EnumMap์ ๋ง๋๋ ์ฑ
์์ BenefitBuilder ๊ฐ์ฒด๋ฅผ ์๋ก ๋ง๋ค์ด์ ๋งก๊ธฐ๋ ๊ฒ ์ข์์. |
@@ -0,0 +1,83 @@
+package christmas.service;
+
+import christmas.constant.Constant;
+import christmas.domain.Badge;
+import christmas.domain.Benefit;
+import christmas.domain.Event;
+import christmas.domain.OrderMenu;
+import christmas.view.input.template.InputCallback;
+import christmas.view.input.template.InputTempla... | Java | benefit init์ ํด์ผ ํ๋ค๋ฉด, ์ธ๋ถ์์ ๋ฐ์์ค๋ ๊ฒ๋ณด๋ค๋ ๋ด๋ถ์์ benefit๋ฅผ ์์ฑํ๊ณ ๋ฐํํ๊ฒ ํ๋ ๊ฒ ์ข์์. ์ธ๋ถ์์ ๋ฐ์์จ benefit์ ๋ํด ์์
์ ์งํํ๋ฉด side effect๊ฐ ๋ฐ์ํ ์ฌ์ง๊ฐ ๋์์.
ํด๋น ์ฝ๋๋ ๋ฉ์๋๋ก ๋ถ๋ฆฌํ์ง ์๋ ๊ฒ ์ข์์ ๊ฒ ๊ฐ์์.
๋น๋๋ฅผ ํ์ฉํ๋ฉด ๋ ์ข์ต๋๋ค :DD |
@@ -0,0 +1,83 @@
+package christmas.service;
+
+import christmas.constant.Constant;
+import christmas.domain.Badge;
+import christmas.domain.Benefit;
+import christmas.domain.Event;
+import christmas.domain.OrderMenu;
+import christmas.view.input.template.InputCallback;
+import christmas.view.input.template.InputTempla... | Java | ํ ์ธ์ก์ ๊ณ์ฐํ๋ ๋ก์ง์ด ์ธ๋ถ๋ก ๋
ธ์ถ๋์ด ์์ด์.
enum์ ํ์ฉํ์
จ์ผ๋ ์ ๋ค๋ฌ์ผ๋ฉด ์ด๋ ๊ฒ ๋ฐ๊ฟ ์ ์์ด์.
```suggestion
private int calculateDiscount(OrderMenu orderMenu, Event event, int day) {
return event.calculateDiscount(orderMenu, day);
}
```
์ด๋ฌ๋ฉด ๋ฉ์๋๋ก ๋ถ๋ฆฌํ ํ์๋ ์์ด์ง๊ณ ์ข์์.
์ด๋ฒคํธ enum๋ง๋ค ๋๋ค์์ ์์ฑํด์ ํํ์ก์ ๊ณ์ฐํด๋ณด์ธ์. |
@@ -0,0 +1,83 @@
+package christmas.service;
+
+import christmas.constant.Constant;
+import christmas.domain.Badge;
+import christmas.domain.Benefit;
+import christmas.domain.Event;
+import christmas.domain.OrderMenu;
+import christmas.view.input.template.InputCallback;
+import christmas.view.input.template.InputTempla... | Java | ์ด๋ฐ ์๋ช
ํ ์ฝ๋๋ค์ ๋ฉ์๋๋ก ๋ถ๋ฆฌํ ํ์๊ฐ ์์ด์. ์๋น์ค ๊ฐ์ฒด๊น์ง ์ด์ฉํ ํ์๋ ๋๋์ฑ ์์ด์. |
@@ -0,0 +1,58 @@
+package christmas.constant;
+
+import christmas.constant.MenuConstant.MenuType;
+import christmas.domain.Menu;
+import java.util.List;
+
+public class EventConstant {
+ public static class Condition {
+
+ public static final int CASE_A = 10000;
+ public static final int CASE_B = 12000... | Java | ์ด๊ฒ ๋ฌด์จ ์์์ธ์ง ์ ์๊ฐ ์์ด์. ์ด๋ฆ์ ๋ช
ํํ ์ง์ด์ฃผ์ธ์.
์์ด๊ฐ ์๋ง์ด๋๋ผ๋ EventAvailablePrice ๊ฐ์ ์์ผ๋ก ์ ์ด์ฃผ์ธ์. |
@@ -0,0 +1,72 @@
+package christmas.domain;
+
+import christmas.constant.Constant;
+import java.util.EnumMap;
+import java.util.Map;
+import java.util.Map.Entry;
+
+public class Benefit {
+
+ private final Map<Event, Integer> details;
+
+ public Benefit() {
+ this.details = new EnumMap<>(Event.class);
+ ... | Java | StringBuilder๋ฅผ ์ธ๋ถ์์ ๋ฐ์์์ผ ํ๋ ์ด์ ๊ฐ ์์์๊น์?
์๋๋ผ๋ฉด ๋ด๋ถ์์ StringBuilder๋ฅผ ์์ฑํด์ ์ฌ์ฉํ์ธ์.
๊ผญ ์ธ๋ถ์์ StringBuilder๋ฅผ ๋ฐ์์์ผ๋ง ํ๋ ๊ฒฝ์ฐ๋ผ๋ฉด, ์ค๊ณ๊ฐ ์๋ชป๋ ๊ฑฐ์์. |
@@ -0,0 +1,106 @@
+package christmas.domain;
+
+
+import christmas.constant.Constant;
+import christmas.constant.ErrorMessage;
+import christmas.constant.MenuConstant.MenuType;
+import java.util.EnumMap;
+import java.util.List;
+import java.util.Map;
+import java.util.Map.Entry;
+
+public class OrderMenu {
+
+ priva... | Java | ๋ฑํ ์ค์ํ ๋ถ๋ถ์ ์๋๋ฐ, ์๋ก ์ฐ๊ด๋ ๋ฉ์๋๋ผ๋ฆฌ ๊ฐ๊น์ด ๋ถ์ด ์๋๋ก ์ฝ๋๋ฅผ ์ ๋ฆฌํด์ฃผ๋ ๊ฒ ์ข์์.
๋ฉ์๋ ์์๊ฐ ๊ผฌ์ฌ ์์ผ๋ฉด ๋ฆฌ๋ทฐํ๋ ์
์ฅ์์ ๊ฝค ํ๋ค์ด์. |
@@ -0,0 +1,14 @@
+package christmas.constant;
+
+public class MenuConstant {
+
+ public static class MenuType {
+
+ public static final String APPETIZER = "appetizer";
+ public static final String MAIN = "main";
+ public static final String DESSERT = "dessert";
+ public static final Strin... | Java | enum์ APPETIZER, MAIN, DESSERT, DRINK๋ง ์ ์ผ์
๋ ๋์ ๊ฒ ๊ฐ์์. string ์์๊ฐ ์ด์ฉ๋๋ ๊ฑธ ๋ณด์ง ๋ชปํ์ด์. |
@@ -0,0 +1,103 @@
+package christmas.domain;
+
+import christmas.constant.EventConstant.Condition;
+import christmas.constant.EventConstant.Days;
+import christmas.constant.EventConstant.Discount;
+import christmas.constant.EventConstant.Message;
+import christmas.constant.EventConstant.Target;
+import christmas.consta... | Java | ๋ด๋ถ ๊ฐ๊ณผ ๊ตฌํ์ด ๋ฟ๋ฟ์ด ํฉ์ด์ ธ ์๋ค์...
๋ณต์กํ์ง ์๋ค๋ฉด, enum ํ๋์ ์ ๋ถ ๋ฃ์ด์ฃผ์ธ์. ์ด๋ ๊ฒ ๋ง๋ค๋ฉด ์ ์ง๋ณด์๊ฐ ๋ ํ๋ค์ด์ ธ์. |
@@ -0,0 +1,65 @@
+package christmas.domain;
+
+import christmas.constant.MenuConstant.MenuType;
+import java.util.Arrays;
+
+public enum Menu {
+
+ //์ ํผํ์ด์
+ MUSHROOM_SOUP(MenuType.APPETIZER, "์์ก์ด์ํ", 6_000),
+ TAPAS(MenuType.APPETIZER, "ํํ์ค", 5_500),
+ CAESAR_SALAD(MenuType.APPETIZER, "์์ ์๋ฌ๋", 8_000),
+
+ ... | Java | ์ด ์ฝ๋๋ ๊น๋ํ๊ฒ ์ ์์ฑํ์
จ๋ค์. ๐ |
@@ -0,0 +1,30 @@
+package christmas.domain;
+
+import static org.assertj.core.api.Assertions.assertThat;
+import static org.junit.jupiter.api.Assertions.assertAll;
+
+import java.util.List;
+import org.junit.jupiter.api.DisplayName;
+import org.junit.jupiter.api.Test;
+
+class EventTest {
+
+ @DisplayName("๋ ์ง์ ํด๋นํ๋ ... | Java | ํ
์คํธ ์ฝ๋๋ผ ํด๋ ๋งค์ง ๋๋ฒ๋ฅผ ์ ๊ฑฐํด์ฃผ๋ฉด ์ข์์ ๊ฒ ๊ฐ์์. |
@@ -0,0 +1,83 @@
+package christmas.service;
+
+import christmas.constant.Constant;
+import christmas.domain.Badge;
+import christmas.domain.Benefit;
+import christmas.domain.Event;
+import christmas.domain.OrderMenu;
+import christmas.view.input.template.InputCallback;
+import christmas.view.input.template.InputTempla... | Java | > ์์์ inputView์ ๋ฉ์๋๋ฅผ ๋๊ฒจ๋ฐ๊ณ ์คํํ๋ ๋ชจ์ต์ด๋๋ฐ, ๊ทธ๋ฅ ChristmasController์์ ์งํํ๋ ๊ฒ ์ข์์ ๊ฒ ๊ฐ์์. ๊ตณ์ด ์๋น์ค๊น์ง ๊ฑธ์น ํ์๊ฐ ์์์ ๊ฒ ๊ฐ์์. ์๋น์ค ๊ฐ์ฒด ๋ด์์ ํด๋น ๋ฉ์๋๊ฐ ์ฐ์ธ ๊ฒ๋ ์๋๊ณ , ์ค๋ก์ง ์ปจํธ๋กค๋ฌ์์๋ง ์ด ๋ฉ์๋๊ฐ ํธ์ถ๋๊ณ ์์ด์.
์ ๋ฉ์๋๋ ๋ง์ํ์ ๋๋ก Controller์ ์์ด๋ ๋ฌด๋ฐฉํ๊ธด ํฉ๋๋ค :)
ํ์ง๋ง Controller๊ฐ View, Service์ธ์ ๋ค๋ฅธ ๊ฐ์ฒด์ ์์กดํ์ง ์๊ฒ๋ InputTemplate๋ฅผ Service์ ๋๊ฑฐ์์ต๋๋ค! |
@@ -0,0 +1,72 @@
+package christmas.domain;
+
+import christmas.constant.Constant;
+import java.util.EnumMap;
+import java.util.Map;
+import java.util.Map.Entry;
+
+public class Benefit {
+
+ private final Map<Event, Integer> details;
+
+ public Benefit() {
+ this.details = new EnumMap<>(Event.class);
+ ... | Java | > add ๋ฉ์๋๋ฅผ ๊ตฌํํ๋ ๊ฒ๋ณด๋ค๋ ์์ฑ์์์ ์์ฑ๋ EnumMap์ ๋ฐ๋ ๊ฒ ์ข์ ๊ฒ ๊ฐ์์. add ๋ฉ์๋๋ฅผ ์ด์ฉํด์ EnumMap์ ๋ง๋๋ ์ฑ
์์ BenefitBuilder ๊ฐ์ฒด๋ฅผ ์๋ก ๋ง๋ค์ด์ ๋งก๊ธฐ๋ ๊ฒ ์ข์์.
๊ทธ๋ ๊ฒ ๋ค์! ๋น๋๋ฅผ ์ฌ์ฉํ๋ฉด ์ถํ ์๋ชป๋ Benfit ๊ฒฐ๊ณผ๊ฐ ๋์์๋ ํฌ๋ก์ค์ฒดํฌํ๊ธฐ๋ ์ฉ์ดํ๊ฒ ๋ค์ ! ์ข์ ํผ๋๋ฐฑ ๊ฐ์ฌํฉ๋๋ค ใ
ใ
|
@@ -0,0 +1,83 @@
+package christmas.service;
+
+import christmas.constant.Constant;
+import christmas.domain.Badge;
+import christmas.domain.Benefit;
+import christmas.domain.Event;
+import christmas.domain.OrderMenu;
+import christmas.view.input.template.InputCallback;
+import christmas.view.input.template.InputTempla... | Java | > benefit init์ ํด์ผ ํ๋ค๋ฉด, ์ธ๋ถ์์ ๋ฐ์์ค๋ ๊ฒ๋ณด๋ค๋ ๋ด๋ถ์์ benefit๋ฅผ ์์ฑํ๊ณ ๋ฐํํ๊ฒ ํ๋ ๊ฒ ์ข์์. ์ธ๋ถ์์ ๋ฐ์์จ benefit์ ๋ํด ์์
์ ์งํํ๋ฉด side effect๊ฐ ๋ฐ์ํ ์ฌ์ง๊ฐ ๋์์. ํด๋น ์ฝ๋๋ ๋ฉ์๋๋ก ๋ถ๋ฆฌํ์ง ์๋ ๊ฒ ์ข์์ ๊ฒ ๊ฐ์์.
>
> ๋น๋๋ฅผ ํ์ฉํ๋ฉด ๋ ์ข์ต๋๋ค :DD
์ benefit์ ๋ฐํํ๋ค๋๊ฒ ํ๋์ ์๋ ๋ณ์๋ฅผ ๊ทธ๋๋ก ๋ฐํํด์ผํ๋ค๋ ๋ง์์ผ๊น์??! |
@@ -0,0 +1,83 @@
+package christmas.service;
+
+import christmas.constant.Constant;
+import christmas.domain.Badge;
+import christmas.domain.Benefit;
+import christmas.domain.Event;
+import christmas.domain.OrderMenu;
+import christmas.view.input.template.InputCallback;
+import christmas.view.input.template.InputTempla... | Java | > ํ ์ธ์ก์ ๊ณ์ฐํ๋ ๋ก์ง์ด ์ธ๋ถ๋ก ๋
ธ์ถ๋์ด ์์ด์. enum์ ํ์ฉํ์
จ์ผ๋ ์ ๋ค๋ฌ์ผ๋ฉด ์ด๋ ๊ฒ ๋ฐ๊ฟ ์ ์์ด์.
>
> ์ด๋ฌ๋ฉด ๋ฉ์๋๋ก ๋ถ๋ฆฌํ ํ์๋ ์์ด์ง๊ณ ์ข์์. ์ด๋ฒคํธ enum๋ง๋ค ๋๋ค์์ ์์ฑํด์ ํํ์ก์ ๊ณ์ฐํด๋ณด์ธ์.
enum์ ๋๋ค์์ด ์์๋ก ๋ค์ด๊ฐ ์ ์๋ค๋๊ฑธ ํด๋ผ์ฐ๋๋ ์ฝ๋ ๋ณด๊ณ ์์์ต๋๋ค! ๋ง์ฝ enum ์์๋ค์ด ํ ์ธ๊ธ์ก์ ๊ณ์ฐํ ์ ์๋ ๋๋ค์์ ๊ฐ๊ณ ์์ผ๋ฉด if๋ฅผ ๋๋ฒ ์ฌ์ฉํ ์ผ๋ ์๊ฒ ๋ค์! ๋ง์ํด์ฃผ์ ํํธ๋ก ๋ฆฌํฉํ ๋ง ํ ๋ฒ ์งํํด๋ณผ๊ฒ์! ๊ฐ์ฌํฉ๋๋ค ใ
ใ
|
@@ -0,0 +1,83 @@
+package christmas.service;
+
+import christmas.constant.Constant;
+import christmas.domain.Badge;
+import christmas.domain.Benefit;
+import christmas.domain.Event;
+import christmas.domain.OrderMenu;
+import christmas.view.input.template.InputCallback;
+import christmas.view.input.template.InputTempla... | Java | > ์ด๋ฐ ์๋ช
ํ ์ฝ๋๋ค์ ๋ฉ์๋๋ก ๋ถ๋ฆฌํ ํ์๊ฐ ์์ด์. ์๋น์ค ๊ฐ์ฒด๊น์ง ์ด์ฉํ ํ์๋ ๋๋์ฑ ์์ด์.
์ด ๋ถ๋ถ๋ Controller์์ ๋ฐ๋ก ํธ์ถํ ์ง ๊ณ ๋ฏผํ๋ ๋ถ๋ถ์
๋๋ค. Controller์ Model(๋๋ฉ์ธ)์ ๊ด๋ จ๋ ์ฝ๋๊ฐ ์์ด๋ ๋๊ธดํ์ง๋ง Service๋ง ์์กดํ๊ฒ๋ ํ๊ณ ์ถ์๊ฑฐ๋ ์! ๊ทผ๋ฐ ๋ง์ํ์ ๋๋ก ์ด๋ฐ ์๋ช
ํ ์ฝ๋๋ค์ ๋ถํ์ํ๊ธด ํ๋ค์.. ๊ณ ๋ฏผ์ ํ๋ฒ ํด๋ด์ผ๊ฒ ์ต๋๋ค ใ
|
@@ -0,0 +1,14 @@
+package christmas.constant;
+
+public class MenuConstant {
+
+ public static class MenuType {
+
+ public static final String APPETIZER = "appetizer";
+ public static final String MAIN = "main";
+ public static final String DESSERT = "dessert";
+ public static final Strin... | Java | > enum์ APPETIZER, MAIN, DESSERT, DRINK๋ง ์ ์ผ์
๋ ๋์ ๊ฒ ๊ฐ์์. string ์์๊ฐ ์ด์ฉ๋๋ ๊ฑธ ๋ณด์ง ๋ชปํ์ด์.
Event์๋ ์ฌ์ฉ๋๋ ์์๋ค์ด๊ธฐ ๋๋ฌธ์ ์์ํ๋ฅผ ์งํํ๊ฑฐ์์ต๋๋ค! WEEKDAY, WEEKEND์ผ๋ ๊ฐ๊ฐ dessert์ main์ ํ ์ธ ๋ฐ๊ธฐ ๋๋ฌธ์ ํด๋น string์ ์ฌ์ฌ์ฉ์ฑ์ํด ๋ฐ๋ก ์์ํ๋ฅผ ํ์ต๋๋ค! |
@@ -0,0 +1,103 @@
+package christmas.domain;
+
+import christmas.constant.EventConstant.Condition;
+import christmas.constant.EventConstant.Days;
+import christmas.constant.EventConstant.Discount;
+import christmas.constant.EventConstant.Message;
+import christmas.constant.EventConstant.Target;
+import christmas.consta... | Java | > ๋ด๋ถ ๊ฐ๊ณผ ๊ตฌํ์ด ๋ฟ๋ฟ์ด ํฉ์ด์ ธ ์๋ค์... ๋ณต์กํ์ง ์๋ค๋ฉด, enum ํ๋์ ์ ๋ถ ๋ฃ์ด์ฃผ์ธ์. ์ด๋ ๊ฒ ๋ง๋ค๋ฉด ์ ์ง๋ณด์๊ฐ ๋ ํ๋ค์ด์ ธ์.
์ ๋ ์์๋ค์ด ๋ง์์ ๋ณต์กํ๋ค๊ณ ์๊ฐํ์ต๋๋ค. ๊ทธ๋์ ๊ฐ๋
์ฑ๋ ๋์ผ๊ฒธ ๋ด๋ถ ๊ฐ์ ๋ฐ๋ก ๋ถ๋ฆฌํ์์ต๋๋ค! ๊ทธ๋ฆฌ๊ณ ์ ์ง๋ณด์์์๋ ํด๋น ๊ฐ๋ค์ด ๋ชจ์ฌ์๋ ํ์ผ๋ง ๋ณด๋ฉด ๋๋๋ก ์๋ํ๊ฑฐ์์ต๋๋ค! |
@@ -0,0 +1,65 @@
+package christmas.domain;
+
+import christmas.constant.MenuConstant.MenuType;
+import java.util.Arrays;
+
+public enum Menu {
+
+ //์ ํผํ์ด์
+ MUSHROOM_SOUP(MenuType.APPETIZER, "์์ก์ด์ํ", 6_000),
+ TAPAS(MenuType.APPETIZER, "ํํ์ค", 5_500),
+ CAESAR_SALAD(MenuType.APPETIZER, "์์ ์๋ฌ๋", 8_000),
+
+ ... | Java | > ์ด ์ฝ๋๋ ๊น๋ํ๊ฒ ์ ์์ฑํ์
จ๋ค์. ๐
๊ฐ์ฌํฉ๋๋ค ใ
ใ
! |
@@ -0,0 +1,30 @@
+package christmas.domain;
+
+import static org.assertj.core.api.Assertions.assertThat;
+import static org.junit.jupiter.api.Assertions.assertAll;
+
+import java.util.List;
+import org.junit.jupiter.api.DisplayName;
+import org.junit.jupiter.api.Test;
+
+class EventTest {
+
+ @DisplayName("๋ ์ง์ ํด๋นํ๋ ... | Java | > ํ
์คํธ ์ฝ๋๋ผ ํด๋ ๋งค์ง ๋๋ฒ๋ฅผ ์ ๊ฑฐํด์ฃผ๋ฉด ์ข์์ ๊ฒ ๊ฐ์์.
๋์ํฉ๋๋ค! ์๊ทธ๋๋ ์ ๋ฐ ๋งค์ง๋๋ฒ๋ฅผ ๋ฐ๋ก enum์ผ๋ก ์ฒ๋ฆฌํด์ ํ
์คํธํ๋ ๋ฐฉ๋ฒ์ด ์๋๋ผ๊ตฌ์ ใ
ใ
ํ๋ฒ ๊ฐ์ ํด๋ณด๊ฒ ์ต๋๋ค! |
@@ -0,0 +1,83 @@
+package christmas.service;
+
+import christmas.constant.Constant;
+import christmas.domain.Badge;
+import christmas.domain.Benefit;
+import christmas.domain.Event;
+import christmas.domain.OrderMenu;
+import christmas.view.input.template.InputCallback;
+import christmas.view.input.template.InputTempla... | Java | ์ธ๋ถ์์ benefit์ ๋ฐ์์ค์ง ๋ง๊ณ , ๋ด๋ถ์์ ์์ฑํ๊ณ ๋ฐํํ๋ ๊ฒ ์ข๋ค๋ ๋ป์ด์์ด์.
```suggestion
private Benefit addDiscountIntoBenefitDetails(OrderMenu orderMenu, int day) {
Benefit benefit = new Benefit();
Event.findAllByDay(day)
.stream()
.filter(event -> orderMenu.calculateTotalPrice() > e... |
@@ -0,0 +1,164 @@
+# ๐ํฌ๋ฆฌ์ค๋ง์ค ํ๋ก๋ชจ์
App๐
+
+๋ณธ ์ดํ๋ฆฌ์ผ์ด์
์ ์ฐํ
์ฝ ์๋น์์ ์ฃผ๋ฌธ ๋ฉ๋ด์ ๋ฐ๋ผ ๋ฐ๊ฒ ๋๋ 2023๋
12์ ํํ๋ค์ ๋ฏธ๋ฆฌ๋ณผ ์ ์๋ ๊ธฐ๋ฅ์ ์ ๊ณตํฉ๋๋ค.
+
+## ๐ ์งํ๊ณผ์
+
+1. ๋ฐฉ๋ฌธ์ ํฌ๋งํ์๋ ๋ ์ง๋ฅผ ์
๋ ฅํด์ฃผ์ธ์
+
+- ๋ ์ง๋ ์ซ์๋ง ์
๋ ฅํด์ฃผ์ธ์ (๊ณต๋ฐฑ์ ํฌํจ ๋์ด๋ ๊ด์ฐฎ์ต๋๋ค.)
+
+```
+์๋
ํ์ธ์! ์ฐํ
์ฝ ์๋น 12์ ์ด๋ฒคํธ ํ๋๋์
๋๋ค.
+12์ ์ค ์๋น ์์ ๋ฐฉ๋ฌธ ๋ ์ง๋ ์ธ์ ์ธ๊ฐ์? (์ซ์๋ง ์
๋ ฅํด ์ฃผ์ธ์!)
+3
+```
+
+2. ์ฃผ๋ฌธํ ๋ฉ๋ด๋ฅผ ๊ฐฏ์์ ํจ๊ป ์
๋ ฅํด์ฃผ์ธ์
+
+- `๋ฉ๋ด์ด๋ฆ... | Unknown | ๋ฌธ์ ๊ผผ๊ผผํ๊ฒ ์ฝ์ด๋ดค์ต๋๋ค! ํ์คํ ์ด๋ฏธ์ง๋ก ๋ฐ์ดํฐ ์ฒ๋ฆฌ์ ์์๋๋ฅผ ํ์ธํ๋๊น ๊ฐ์์ฑ์ด ์ข๋ค์:) |
@@ -0,0 +1,16 @@
+package christmas.constant;
+
+import java.util.regex.Pattern;
+
+public class Constant {
+
+ public static final String DELIMITER_COMMA = ",";
+ public static final String DELIMITER_HYPHEN = "-";
+ public static final String SPACE = " ";
+ public static final String MENU_UNIT = "%d๊ฐ";
+ ... | Java | ์ ๊ท ํํ์๊น์ง ํ์ฉํด์ ์์ ๊ด๋ฆฌํ๋ ๋ถ๋ถ์์ ์ต๋ํ ๋จ์ผ ํด๋์ค ํ์ private ํ๋ ์์๋ฅผ ์ค์ด๋ ค๊ณ ํ์ ๋
ธ๋ ฅ์ด ๋ณด์
๋๋ค. ์์ฃผ ์ข๋ค์! |
@@ -0,0 +1,58 @@
+package christmas.constant;
+
+import christmas.constant.MenuConstant.MenuType;
+import christmas.domain.Menu;
+import java.util.List;
+
+public class EventConstant {
+ public static class Condition {
+
+ public static final int CASE_A = 10000;
+ public static final int CASE_B = 12000... | Java | ๋ฐฑ์ ์๋ฆฌ๋ฅผ ๊ธฐ์ค์ผ๋ก ๊ตฌ๋ถ์ "_"๋ฅผ ๋ฃ์ด์ฃผ์๋ฉด ๊ฐ๋
์ฑ์ด ์ฆ์ง๋ ๊ฒ ๊ฐ์ต๋๋ค:) |
@@ -0,0 +1,58 @@
+package christmas.constant;
+
+import christmas.constant.MenuConstant.MenuType;
+import christmas.domain.Menu;
+import java.util.List;
+
+public class EventConstant {
+ public static class Condition {
+
+ public static final int CASE_A = 10000;
+ public static final int CASE_B = 12000... | Java | ์ ์ ์ค์ฒฉ ํด๋์ค๋ฅผ ํ์ฉํด์ ์ธ์คํด์คํ๋ฅผ ๋ฐฉ์งํ ์ ์๋ค์...! ์ถ๊ฐ๋ก ๊ฐ ํด๋์ค ๋ณ๋ก ๊ณต๋ฐฑ ์ค๋ฐ๊ฟ์ ํ์ฉํด์ ๊ฐ๋
์ฑ์ ๋์ด์ ๊ฒ ์์ฃผ ์ข์ ๊ฒ ๊ฐ์ต๋๋ค:) |
@@ -0,0 +1,87 @@
+package christmas.controller;
+
+import christmas.domain.Benefit;
+import christmas.domain.OrderMenu;
+import christmas.service.ChristmasService;
+import christmas.view.input.InputView;
+import christmas.view.output.OutputView;
+
+public class ChristmasController {
+
+ private final InputView input... | Java | ์์ฒญ๊ฐ๋ค์ ์ ๋ถ ๋ฐ์์ ์ํ๋ ๋ฆฌํด๊ฐ์ ๋ด๋๋ ๋ฉ์๋ ๊ฐ์๋ฐ ๋ช
๋ช
์ด ์กฐ๊ธ ์์ฌ์ด ๊ฒ ๊ฐ์ต๋๋ค! ๋ ์ข์ ๋ฉ์๋ ๋ช
๋ช
์ด ์์ง ์์์๊น ์ถ์ด์:) |
@@ -0,0 +1,72 @@
+package christmas.domain;
+
+import christmas.constant.Constant;
+import java.util.EnumMap;
+import java.util.Map;
+import java.util.Map.Entry;
+
+public class Benefit {
+
+ private final Map<Event, Integer> details;
+
+ public Benefit() {
+ this.details = new EnumMap<>(Event.class);
+ ... | Java | ์ดํํ๊ฐ์ด 0์ธ์ง ์๋์ง๋ฅผ ๋ถ๊ธฐ์ ์ผ๋ก ๋ฌ์ ์ถ๋ ฅ ์ฌ๋ถ๋ฅผ ๊ฒฐ์ ์ผ ํ๋ค์! ์๋ฌ๋ ๋ก์ง์ ๋ณด๋๊น ๊ตณ์ด ๊ฐ์ ๋ฐ๋ก๋ฐ๋ก ์๊ฐํ ํ์๊ฐ ์์์ ๊ฒ ๊ฐ๋ค์. ์ข์ ์์ด๋์ด ๊ฐ์ต๋๋ค:) |
@@ -1,8 +1,8 @@
'use client';
import { ReactNode } from 'react';
-import { useInView } from 'react-intersection-observer';
+import { keyframes } from '@emotion/react';
import { Box, Card, CardMedia, SxProps, Typography } from '@mui/material';
import { Theme } from '@mui/system';
@@ -14,40 +14,49 @@ interface ... | Unknown | ์ธ์ฌ์ดํธ์ ์ฑ๋ด์ ํฌํจํ ๋ชจ๋ ๋งํ์ ์นด๋์ ๋ง์ฐ์ค๋ฅผ ํธ๋ฒํ๋ฉด ์ปค์ง๋ ํจ๊ณผ๊ฐ ๋ํ๋์ ์กฐ๊ฑด์ ์ฃผ์
์ผ ํ ๊ฒ ๊ฐ์์~!
์ง๊ธ ๋น์ฅ ์ฐ์ด๋ ๊ณณ์ด ์ด๊ฒ๋ฐ์ ์์ผ๋ `isFixed`๋ก ํ๊ฑฐ๋ ๋ค๋ฅธ ์์ฑ ํ๋ ์ถ๊ฐํด์ฃผ์
๋ ๋๊ณ ๋ง์๋๋ก ํ์์ง์ฉ~! |
@@ -0,0 +1,82 @@
+package study;
+
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.List;
+
+public class Equation {
+
+ private final String equation;
+
+ private static final String INVALID_CALCULATION_FORMAT = "์๋ชป๋ ๊ณ์ฐ์์
๋๋ค.";
+ private static final String DELIMITER = " ";
+
+ public Equation(S... | Java | ํด๋์ค์ ๊ตฌํ ์ปจ๋ฒค์
์ ๋ง์ถฐ์ ๊ตฌํํ๊ฒ๋๋ฉด ์ผ๊ด๋ ์ฝ๋๋ฅผ ์์ฑํ ์ ์์ต๋๋ค :)
```
class A {
์์(static final) ๋๋ ํด๋์ค ๋ณ์
์ธ์คํด์ค ๋ณ์
์์ฑ์
ํฉํ ๋ฆฌ ๋ฉ์๋
๋ฉ์๋
๊ธฐ๋ณธ ๋ฉ์๋ (equals, hashCode, toString)
}
``` |
@@ -0,0 +1,16 @@
+package study;
+
+import java.util.Scanner;
+
+public class InputView {
+
+ private Scanner scanner;
+
+ public InputView(Scanner scanner) {
+ this.scanner = scanner;
+ }
+
+ public String readEquation() {
+ return scanner.nextLine();
+ }
+} | Java | InputView์์ ์์ฑ์์ ํ๋ผ๋ฏธํฐ๋ก Scanner๋ฅผ ์ค์ ํด์ฃผ์ ์ด์ ๊ฐ ์์๊น์?
์์ฑ์๋ฅผ ํตํ ์์กด์ฑ ์ฃผ์
์ ํตํด ์ป๊ฒ๋๋ ์ฅ์ ์ด ์์ด๋ณด์ด๋ ๊ฒ ๊ฐ์์ ๐ค |
@@ -0,0 +1,13 @@
+package study;
+
+public class ResultView {
+
+ public void initStart() {
+ System.out.println("๊ณ์ฐ์์ ์
๋ ฅํ์ธ์.");
+ }
+
+ public void viewResult(SimpleCalculator simpleCalculator) {
+ int result = simpleCalculator.calEquation();
+ System.out.println("๊ณ์ฐ ๊ฒฐ๊ณผ = " + result);
+ }
+} | Java | ๊ณ์ฐ์์ ์
๋ ฅํ๋ผ๊ณ ์ฝ์์ ์ถ๋ ฅ๋๋ ๋ด์ฉ์ InputView์ ์ข ๋ ์ ํฉํด๋ณด์ด๊ธฐ๋ ํ๋ค์.
InputView์ ResultView๋ฅผ ๊ตฌ๋ถํ๋ ์ด์ ๋ ์์ฒญ๊ณผ ๊ฒฐ๊ณผ๋ฅผ ๊ตฌ๋ถํ๊ธฐ ์ํ ๋ถ๋ถ์ด๊ธฐ ๋๋ฌธ์ ResultView์์๋ง ์ถ๋ ฅ์ ํด์ผํ๋ ๊ฒ์ ์๋๋๋ค :) |
@@ -0,0 +1,13 @@
+package study;
+
+public class ResultView {
+
+ public void initStart() {
+ System.out.println("๊ณ์ฐ์์ ์
๋ ฅํ์ธ์.");
+ }
+
+ public void viewResult(SimpleCalculator simpleCalculator) {
+ int result = simpleCalculator.calEquation();
+ System.out.println("๊ณ์ฐ ๊ฒฐ๊ณผ = " + result);
+ }
+} | Java | ๊ณ์ฐ๊ธฐ ๊ฐ์ฒด๋ฅผ viewResult()์ ์ธ์๋ก ๋๊ธฐ๋ ๊ฒ ๋ณด๋ค๋ ๊ฒฐ๊ณผ ๊ฐ์ ๋๊ฒจ์ฃผ๋ ๊ฒ์ ์ด๋จ๊น์?
๊ณ์ฐ๊ธฐ ๊ฐ์ฒด์ View ๊ฐ์ฒด๋ฅผ ๋ถ๋ฆฌํ๋ ์ด์ ๋ ์๋ก์ ์์กด์ฑ์ ๋์ด๋ด๊ณ ๋ณ๊ฒฝ์ ์ํฅ์ ์ต์ํํ๊ธฐ ์ํจ์
๋๋ค.
๋ง์ฝ ๊ณ์ฐ๊ธฐ ๊ฐ์ฒด์ calEquation() ๋ฉ์๋์ ๋ค์ด๋ฐ์ด ๋ฐ๋๊ฒ ๋๋ค๋ฉด ResultView ์๋ ๋ณ๊ฒฝ์ด ์๊ธฐ์ง ์์๊น์?
```suggestion
public void viewResult(int result) {
System.out.println("๊ณ์ฐ ๊ฒฐ๊ณผ = " + result);
}
``` |
@@ -0,0 +1,75 @@
+package study;
+
+import static org.assertj.core.api.Assertions.assertThat;
+
+import org.junit.jupiter.api.Test;
+
+public class SimpleCalculatorTest {
+
+ @Test
+ void plusTest() {
+ //given
+ String input = "10 + 5";
+ Equation equation = new Equation(input);
+ SimpleCalculator calculator = new... | Java | ๊ณ์ฐ๊ธฐ ํ
์คํธ์๋ @DisplayNameย ์ด๋
ธํ
์ด์
์ ํ์ฉํ๋ฉด ๋ ๊ฐ๋
์ฑ ์๋ ํ
์คํธ ์ฝ๋๋ฅผ ์์ฑ ํ ์ ์์ ๊ฒ ๊ฐ์ต๋๋ค :) |
@@ -0,0 +1,82 @@
+package study;
+
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.List;
+
+public class Equation {
+
+ private final String equation;
+
+ private static final String INVALID_CALCULATION_FORMAT = "์๋ชป๋ ๊ณ์ฐ์์
๋๋ค.";
+ private static final String DELIMITER = " ";
+
+ public Equation(S... | Java | ์์์ ์ซ์๋ฅผ ์ฌ์ฉํ๋ ๋งค์ง ๋๋ฒ๋ ์์ค ์ฝ๋๋ฅผ ์ฝ๊ธฐ ์ด๋ ต๊ฒ ๋ง๋๋๋ฐ์ !
์ซ์ 2๋ ์ด๋ค ์๋ฏธ์ผ๊น์? |
@@ -0,0 +1,20 @@
+package study;
+
+import java.util.Scanner;
+
+public class Main {
+
+ public static void main(String[] args) {
+ ResultView resultView = new ResultView();
+
+ resultView.initStart();
+ Scanner scanner = new Scanner(System.in);
+ InputView inputView = new InputView(scanner);
+
+ Equation equation... | Java | ํ์ผ ๋ง์ง๋ง์ ์ํฐ(๊ฐํ๋ฌธ์)๋ฅผ ๋ฃ์ด์ฃผ์ธ์ :)
์ด์ ๋ ๋ฆฌ๋ทฐ๋ฅผ ์งํํ ๋ ๊นํ๋ธ์์ ๊ฒฝ๊ณ ๋ฉ์์ง๋ฅผ ์ง์ฐ๊ณ ํน์ ๋ชจ๋ฅด๋ ํ์ผ ์ฝ๊ธฐ ์ค๋ฅ์ ๋๋นํ๊ธฐ ์ํจ์
๋๋ค.
์ข ๋ ์๊ณ ์ถ์ผ์๋ฉด ์ฐธ๊ณ ๋งํฌ๋ฅผ ๋ณด์
๋ ์ฌ๋ฐ์ ๊ฒ ๊ฐ๋ค์ :)
Intellij ๋ฅผ ์ฌ์ฉํ์ค ๊ฒฝ์ฐ์Preferences -> Editor -> General -> Ensure line feed at file end on save ๋ฅผ ์ฒดํฌํด์ฃผ์๋ฉดํ์ผ ์ ์ฅ ์ ๋ง์ง๋ง์ ๊ฐํ๋ฌธ์๋ฅผ ์๋์ผ๋ก ๋ฃ์ด์ค๋๋ค!
https://minz.dev/19https://stackoverflow.com/questions/... |
@@ -0,0 +1,52 @@
+package study;
+
+public class SimpleCalculator {
+
+ private final Equation equation;
+
+ private static final String NO_DIVIDE_BY_ZERO = "0์ผ๋ก ๋๋ ์ ์์ต๋๋ค.";
+
+ public SimpleCalculator(Equation equation) {
+ this.equation = equation;
+ }
+
+ public int cal(String symbol, Integer num1, Integer num2) {... | Java | `๊ณ์ฐ๊ธฐ`๊ฐ ํ๋์ `๋ฐฉ์ ์`์ ์ํ๋ก ๊ฐ์ง๋๋ก ๊ตฌํํ์
จ๋ค์ !
๊ณ์ฐ๊ธฐ๊ฐ ๋ ๋ค๋ฅธ ๋ฐฉ์ ์์ ๋ํ ๊ฐ์ ์ด๋ป๊ฒ ๊ตฌํ ์ ์์๊น์?
ํ์ฌ ์ํ์์๋ ํ๋์ ๊ณ์ฐ๊ธฐ ๊ฐ์ฒด๊ฐ ํ๋์ ๋ฐฉ์ ์๋ง์ ๊ณ์ฐํ ์ ์๋๋ฐ์. ์ฌ๋ฌ ๊ฐ์ ๋ฐฉ์ ์์ ๋ํด ๊ณ์ฐํ ์ ์๋๋ก ๊ฐ์ ํด๋ณด๋ฉด ์ข์ ๊ฒ ๊ฐ์ต๋๋ค :) |
@@ -0,0 +1,52 @@
+package study;
+
+public class SimpleCalculator {
+
+ private final Equation equation;
+
+ private static final String NO_DIVIDE_BY_ZERO = "0์ผ๋ก ๋๋ ์ ์์ต๋๋ค.";
+
+ public SimpleCalculator(Equation equation) {
+ this.equation = equation;
+ }
+
+ public int cal(String symbol, Integer num1, Integer num2) {... | Java | ๋ฉ์๋๋ ๋ณ์๋ช
์ ์ฝ์ด๋ฅผ ์ฌ์ฉํ๋ ๊ฒ์ ์ง์ํด์ฃผ์ธ์.
์ฝ์ด๋ ๋ณ๋์ ๊ท์ฝ์ผ๋ก ์ ํด์ง์ง ์์ผ๋ฉด ์์ค์ฝ๋์ ๊ฐ๋
์ฑ์ ์ด๋ ต๊ฒ ๋ง๋ญ๋๋ค :)
```suggestion
public int calculate(String symbol, Integer num1, Integer num2) {
``` |
@@ -0,0 +1,52 @@
+package study;
+
+public class SimpleCalculator {
+
+ private final Equation equation;
+
+ private static final String NO_DIVIDE_BY_ZERO = "0์ผ๋ก ๋๋ ์ ์์ต๋๋ค.";
+
+ public SimpleCalculator(Equation equation) {
+ this.equation = equation;
+ }
+
+ public int cal(String symbol, Integer num1, Integer num2) {... | Java | SymbolStatus enum ํด๋์ค๋ฅผ ๋ง๋ค์ด์ฃผ์
จ๋ค์ ๐
SymbolStatus๋ฅผ ํตํด ์ฐ์ฐ๊ธฐํธ์ `์ํ`๋ฅผ ํ ๊ณณ์์ ๊ด๋ฆฌํ๊ฒ ํด์ฃผ์
จ์ผ๋ ๊ณ์ฐ์ ํ๋ `ํ์`๋ ํจ๊ป enum์ ๊ตฌํํด๋ณด๋ฉด ์ด๋จ๊น์?
https://techblog.woowahan.com/2527/ |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.