code stringlengths 41 34.3k | lang stringclasses 8
values | review stringlengths 1 4.74k |
|---|---|---|
@@ -0,0 +1,21 @@
+/* eslint-disable max-lines-per-function */
+import { OUTPUT_MSG } from '../../src/domain/constants/PlannerMsg.js';
+
+describe('๋ฐฐ์ง ํ
์คํธ', () => {
+ const testCases = [
+ { amount: 1000, expected: '์์' },
+ { amount: 4900, expected: '์์' },
+ { amount: 5000, expected: '๋ณ' },
+ { amount: 99... | JavaScript | ์ด๋ ๊ฒ ์ฒ๋ฆฌํ ์ ์๊ตฐ์! |
@@ -0,0 +1,37 @@
+/**
+ *
+<์ ํผํ์ด์ >
+์์ก์ด์ํ(6,000), ํํ์ค(5,500), ์์ ์๋ฌ๋(8,000)
+
+<๋ฉ์ธ>
+ํฐ๋ณธ์คํ
์ดํฌ(55,000), ๋ฐ๋นํ๋ฆฝ(54,000), ํด์ฐ๋ฌผํ์คํ(35,000), ํฌ๋ฆฌ์ค๋ง์คํ์คํ(25,000)
+
+<๋์ ํธ>
+์ด์ฝ์ผ์ดํฌ(15,000), ์์ด์คํฌ๋ฆผ(5,000)
+
+<์๋ฃ>
+์ ๋ก์ฝ๋ผ(3,000), ๋ ๋์์ธ(60,000), ์ดํ์ธ(25,000)
+ */
+
+export const FOOD_MENU = {
+ appetizer: {
+ soup: ['์์ก์ด์ํ', 6000],
+ ta... | JavaScript | FOOD_MENU ๊ฐ์ฒด๋ฅผ ๊น์ ๋๊ฒฐํ๋ ๊ฑด ์ด๋ ์ ๊ฐ์? |
@@ -0,0 +1,37 @@
+/**
+ *
+<์ ํผํ์ด์ >
+์์ก์ด์ํ(6,000), ํํ์ค(5,500), ์์ ์๋ฌ๋(8,000)
+
+<๋ฉ์ธ>
+ํฐ๋ณธ์คํ
์ดํฌ(55,000), ๋ฐ๋นํ๋ฆฝ(54,000), ํด์ฐ๋ฌผํ์คํ(35,000), ํฌ๋ฆฌ์ค๋ง์คํ์คํ(25,000)
+
+<๋์ ํธ>
+์ด์ฝ์ผ์ดํฌ(15,000), ์์ด์คํฌ๋ฆผ(5,000)
+
+<์๋ฃ>
+์ ๋ก์ฝ๋ผ(3,000), ๋ ๋์์ธ(60,000), ์ดํ์ธ(25,000)
+ */
+
+export const FOOD_MENU = {
+ appetizer: {
+ soup: ['์์ก์ด์ํ', 6000],
+ ta... | JavaScript | ์ข์ ๋ฆฌ๋ทฐ ๊ฐ์ฌํฉ๋๋ค! @joywhy pr ๋งํฌ ๋จ๊ฒจ์ฃผ์๋ฉด ๋ง๋ฆฌ๋ทฐ ๊ฐ๊ฒ์!! |
@@ -0,0 +1,8 @@
+public class Car {
+ public String name;
+ public int position;
+
+ public int run() {
+ return this.position++;
+ }
+}
\ No newline at end of file | Java | addPosition ๋ ๋ฐ์ดํฐ ๋ณ๊ฒฝ์ ๋ํ ์ค๋ช
์ด ๋๋ ๊ฒ ๊ฐ์ง๋ง,
run ์ด๋ผ๋ ํ์๋ฅผ ํํํ๋ ๋จ์ด๋ก ๋ฉ์๋๋ช
์ ์ง์ด๋ณด๋ฉด ์ด๋จ๊น์?
์ถํ์ ์๋์ฐจ ๊ธฐ๋ณธ ์ด๋ ์กฐ๊ฑด์ด +2 ๋ก ๋ฐ๋๋ค๊ณ ๊ฐ์ ํ์ ๋
addPosition ์ด๋ฉด ํด๋น ๋ฉ์๋๋ฅผ ์ฌ์ฉํ๋ ์
์ฅ์์ position+1 ์ผ ๊ฒ ๊ฐ๋ค๋ ์๊ฐ์ด ๋๋๋ฐ
run ์ผ๋ก ์ถ์ํ ๋์ด์์ผ๋ฉด +2 ๋ฅผ ํ๋ +1 ์ ํ๋ ์๋์ฐจ๊ฐ ์ด๋ํ๋ค๋ ํ์๋ฅผ ๋ํ๋ด์ ํผ๋์ด ์์ ๊ฒ ๊ฐ์ต๋๋ค ~ |
@@ -0,0 +1,8 @@
+public class Car {
+ public String name;
+ public int position;
+
+ public int run() {
+ return this.position++;
+ }
+}
\ No newline at end of file | Java | ๊ฒฐ๊ณผ๋ฅผ ๋ณด์ฌ์ฃผ๋ View ์ ์ญํ ์ ResultView ์ ์์ํ๋ฉด ์ด๋จ๊น์? |
@@ -0,0 +1,8 @@
+public class Car {
+ public String name;
+ public int position;
+
+ public int run() {
+ return this.position++;
+ }
+}
\ No newline at end of file | Java | ์ถํ์ ์ฝ์์ด ์๋ GUI ํ๋ก๊ทธ๋จ์ผ๋ก ํ์ฅ๋๋ค๊ณ ํ์ ๋ Car ์ด๋ผ๋ pure ํด์ผํ๋ ๋ชจ๋ธ ํด๋์ค๊ฐ ๋๋ฝํ์ง์ง ์์๊น์~? |
@@ -0,0 +1,22 @@
+import java.util.ArrayList;
+import java.util.List;
+
+public class GameWinner {
+ public List<String> findWinner(List<Car> cars) {
+ int max = cars.get(0).position;
+ for (int i = 1; i < cars.size(); i++) {
+ max = Math.max(max, cars.get(i).position);
+ }
+ L... | Java | ์กฐ์์ ๋ธ๋กํฌ์ effective java ์๋ '๊ฐ์ฒด๋ ์ธํฐํ์ด์ค๋ฅผ ์ฌ์ฉํด ์ฐธ์กฐํ๋ผ.'
๋ผ๋ ๋ถ๋ถ์ด ์์ต๋๋ค.
ํ๋ฒ ์ฝ์ด๋ณด์๊ณ ๊ฐ์ ํด๋ณด์๋ฉด ์ข์ ๊ฒ ๊ฐ์์ ~
jaehun2841.github.io/2019/03/01/effective-java-item64/#%EC%9C%A0%EC%97%B0%ED%95%9C-%ED%94%84%EB%A1%9C%EA%B7%B8%EB%9E%A8%EC%9D%84-%EC%83%9D%EC%84%B1%ED%95%98%EB%8A%94-%EC%9D%B8%ED%84%B0%ED%8E%98%EC%9D%B4%EC%8A%A4-%ED%83%80%EC%9E... |
@@ -0,0 +1,22 @@
+import java.util.ArrayList;
+import java.util.List;
+
+public class GameWinner {
+ public List<String> findWinner(List<Car> cars) {
+ int max = cars.get(0).position;
+ for (int i = 1; i < cars.size(); i++) {
+ max = Math.max(max, cars.get(i).position);
+ }
+ L... | Java | ๋ฐฐ์ด ์ฌ์ฉ์ ์ง์ํ๊ณ List ๋ก ์ต๋ํ ๋๊ฒจ๋ฐ์ผ๋ฉด ์ด๋จ๊น์? |
@@ -0,0 +1,18 @@
+import java.util.List;
+
+public class Main {
+ public static void main(String[] args) {
+ InputView inputView = new InputView();
+ RacingGame racingGame = new RacingGame();
+ GameWinner gameWinner = new GameWinner();
+ ResultView resultView = new ResultView();
+
+ ... | Java | Main ์ ์ฝ์ ์ถ๋ ฅํ๋ ์ฝ๋๋ฅผ ์์ ๋ณด๋ฉด ์ด๋จ๊น์~? |
@@ -0,0 +1,29 @@
+import java.util.Random;
+import java.util.List;
+
+public class RacingGame {
+ private static final int RANDOM_RANGE = 10;
+ private static final int MIN_MOVE_STANDARD = 4;
+
+ public void raceByTime(List<Car> cars) {
+ for (Car car : cars) {
+ int randomValue = giveRandomV... | Java | ์ ๊ทผ์ ์ด์๋ฅผ ์๋ตํ์ ์ด์ ๊ฐ ์์๊น์? ์๋ตํ๋ฉด ์ด๋ค ์ ๊ทผ์ ์ด์๊ฐ ๋ถ์๊น์? |
@@ -0,0 +1,8 @@
+public class Car {
+ public String name;
+ public int position;
+
+ public int run() {
+ return this.position++;
+ }
+}
\ No newline at end of file | Java | ๋ฉ์๋๋ช
์ ์ง์ ๋ ์กฐ๊ฑด ๋ณ๊ฒฝ์ ๊ฐ๋ฅ์ฑ์ ๊ผญ ๊ณ ๋ คํ๋๋ก ํ๊ฒ ์ต๋๋ค! ๋จ๋ฒ์ ์ดํด๋๋ ์ข์ ์์ ์ ์ํด์ฃผ์
์ ๊ฐ์ฌํฉ๋๋ค. |
@@ -0,0 +1,8 @@
+public class Car {
+ public String name;
+ public int position;
+
+ public int run() {
+ return this.position++;
+ }
+}
\ No newline at end of file | Java | GUI ํ๋ก๊ทธ๋จ์ผ๋ก ํ์ฅ๋ ๊ฒฝ์ฐ๋ ๊ณ ๋ คํด์ผ ํ๋ค๋ ์ ๋ช
์ฌํ๊ฒ ์ต๋๋ค! |
@@ -0,0 +1,29 @@
+import java.util.Random;
+import java.util.List;
+
+public class RacingGame {
+ private static final int RANDOM_RANGE = 10;
+ private static final int MIN_MOVE_STANDARD = 4;
+
+ public void raceByTime(List<Car> cars) {
+ for (Car car : cars) {
+ int randomValue = giveRandomV... | Java | ๋ฉ์๋์ ์ ๊ทผ์ ์ด์์ ๋ชฐ๋ํ ๋๋จธ์ง ๋ณ์์ ์ ๊ทผ์ ์ด์๋ ๋ฏธ์ฒ ๊ณ ๋ คํ์ง ๋ชปํ๋ ๊ฒ ๊ฐ์ต๋๋ค. ์๋ตํ ๊ฒฝ์ฐ default ์ ๊ทผ์ ์ด์๊ฐ ๋์ด ํด๋น **ํจํค์ง** ๋ด์์ ์ ๊ทผ๊ฐ๋ฅํ๊ฒ ํฉ๋๋ค. ์ฌ๊ธฐ์์๋ ํด๋น ํด๋์ค ๋ด์์๋ง์ ์ ๊ทผ์ด ํ์ํ๋ฏ๋ก private๋ฅผ ๋ถ์ฌ ์์ ํ๊ฒ ์ต๋๋ค. |
@@ -0,0 +1,22 @@
+import java.util.ArrayList;
+import java.util.List;
+
+public class GameWinner {
+ public List<String> findWinner(List<Car> cars) {
+ int max = cars.get(0).position;
+ for (int i = 1; i < cars.size(); i++) {
+ max = Math.max(max, cars.get(i).position);
+ }
+ L... | Java | ์๋ฃ ๊ฐ์ฌํฉ๋๋ค๐ List์ธํฐํ์ด์ค ๊ตฌํํด๋ณด๋๋ก ํ๊ฒ ์ต๋๋ค. |
@@ -0,0 +1,8 @@
+public class Car {
+ public String name;
+ public int position;
+
+ public int run() {
+ return this.position++;
+ }
+}
\ No newline at end of file | Java | car ์ ์ํ๊ฐ ์ธ๋ถ์์ ์ ๊ทผ๊ฐ๋ฅํ public ์ธ๋ฐ์~
private ์ผ๋ก ๋ณ๊ฒฝํด์ฃผ์
์ผํ ๊ฒ ๊ฐ์ต๋๋ค ! |
@@ -0,0 +1,22 @@
+import java.util.ArrayList;
+import java.util.List;
+
+public class GameWinner {
+ public List<String> findWinner(List<Car> cars) {
+ int max = cars.get(0).position;
+ for (int i = 1; i < cars.size(); i++) {
+ max = Math.max(max, cars.get(i).position);
+ }
+ L... | Java | Winner ๊ฐ์ฒด์์ ๋ค๊ณ ์์ผ๋ฉด ์ข์๋งํ ์ํ(ํ๋ ๋ณ์)๋ค์ ์ ์ํ๊ณ ์ฑ
์์ ๋ถ์ฌํด๋ณด๋ฉด ์ด๋จ๊น์? |
@@ -0,0 +1,22 @@
+import java.util.ArrayList;
+import java.util.List;
+
+public class GameWinner {
+ public List<String> findWinner(List<Car> cars) {
+ int max = cars.get(0).position;
+ for (int i = 1; i < cars.size(); i++) {
+ max = Math.max(max, cars.get(i).position);
+ }
+ L... | Java | ๊ฐ์ฒด์งํฅ์์๋ ๊ฐ์ฒด์ ์ํ์ ์ง์ ์ ๊ทผํด์๋ ์๋ฉ๋๋ค.
private ์ผ๋ก ๋ณ๊ฒฝํ์๋ฉด getter ๋ก ๋ณ๊ฒฝํ์
์ผํ ๊ฒ ๊ฐ์์~ |
@@ -0,0 +1,22 @@
+import java.util.ArrayList;
+import java.util.List;
+
+public class GameWinner {
+ public List<String> findWinner(List<Car> cars) {
+ int max = cars.get(0).position;
+ for (int i = 1; i < cars.size(); i++) {
+ max = Math.max(max, cars.get(i).position);
+ }
+ L... | Java | java8 ์ stream api ๋ฅผ ์ ์ฉํด๋ณด๋ฉด ์ด๋จ๊น์~? |
@@ -0,0 +1,50 @@
+import java.util.Scanner;
+import java.util.List;
+import java.util.ArrayList;
+
+public class InputView {
+ private static final int INITIAL_POSITION = 0;
+ private static final int MIN_NAME_LENGTH = 1;
+ private static final int MAX_NAME_LENGTH = 5;
+
+ public String inputCarName() {
+ ... | Java | InputView ์๋ ์ํ๊ฐ์ด ์๋๋ฐ์,
util ํด๋์ค๋ก ํ์ฉ๋ ์ ์์ ๊ฒ ๊ฐ์์ ๋ชจ๋ ๋ฉ์๋๋ค์ static ์ ํ์ฉํด๋ณด์๋ฉด ์ด๋จ๊น์? |
@@ -0,0 +1,29 @@
+import java.util.Random;
+import java.util.List;
+
+public class RacingGame {
+ private static final int RANDOM_RANGE = 10;
+ private static final int MIN_MOVE_STANDARD = 4;
+
+ public void raceByTime(List<Car> cars) {
+ for (Car car : cars) {
+ int randomValue = giveRandomV... | Java | random ์ผ๋ก ์ธํด ๊ฒ์์ ํต์ฌ pulbic ๋ฉ์๋๊ฐ ํ
์คํธ ๋ถ๊ฐ๋ฅํด์ก๋๋ฐ
์ด๋ป๊ฒ ๊ฐ์ ํด ๋ณผ ์ ์์๊น์? |
@@ -0,0 +1,21 @@
+public class Car {
+ private String name;
+ private int position;
+
+ Car(String name) {
+ this.name = name;
+ this.position = 0;
+ }
+
+ public String getName() {
+ return name;
+ }
+
+ public int getPosition() {
+ return position;
+ }
+
+ public... | Java | ๊ท์น : setter ๋ฅผ ์ฌ์ฉํ์ง ์๋๋ค (getter ์ฌ์ฉ์ ์ง์ํ๋ค)
๊ฐ์ฒด์งํฅ ํ๋ก๊ทธ๋๋ฐ์์ setter ์ getter ์ฌ์ฉ์ ๋๋๋ก ์ง์ํ๋ผ๊ณ ํ๋ ์ด์ ๊ฐ ๋ฌด์์ผ๊น์? |
@@ -0,0 +1,21 @@
+public class Car {
+ private String name;
+ private int position;
+
+ Car(String name) {
+ this.name = name;
+ this.position = 0;
+ }
+
+ public String getName() {
+ return name;
+ }
+
+ public int getPosition() {
+ return position;
+ }
+
+ public... | Java | ๋๋ค์ ํตํด ํน์ ์กฐ๊ฑด์์ ์ ์งํ๋ ๊ฒ์์ ๋ฃฐ์ ์๋์ฐจ๋ผ๋ ๋ชจ๋ธ ํด๋์ค๊ฐ ์๊ณ ์์ ํ์๊ฐ ์์๊น์?
์๋ฅผ ๋ค์ด ๊ฒ์์ ๋ชจ๋๊ฐ ์ถ๊ฐ๋์ด์ ๋๋ค ๋ฃฐ์ด ์๋ ๋ค๋ฅธ ๊ฒ์ ๋ฃฐ์ด ์๊ธด๋ค๊ณ ํ์ ๋,
๋ชจ๋ธ์ด ๊ฒ์์ ๋ฃฐ์ ๊ด๊ณ์์ด pure ํ๊ฒ ์ง์ฌ์ ธ ์์ผ๋ฉด ๋ชจ๋ธ์ ์์ ํ์ง ์์๋ ๋์ง ์์๊น์?
moveForward ๊ฐ ๋จ์ํ car ์ position ์ ++ ํ๋ ๋ก์ง๋ง ๊ฐ์ง๊ณ ์์ผ๋ฉด ์ด๋ค์ง ์๊ฒฌ๋๋ ค๋ด
๋๋ค ~ |
@@ -0,0 +1,21 @@
+public class Car {
+ private String name;
+ private int position;
+
+ Car(String name) {
+ this.name = name;
+ this.position = 0;
+ }
+
+ public String getName() {
+ return name;
+ }
+
+ public int getPosition() {
+ return position;
+ }
+
+ public... | Java | ๋ค์์๋ code formatting ์ ํ ๋ค์ ์ ์ถํ๋ ์ต๊ด์ ๋ค์ด์๋ฉด ์ข์ ๊ฒ ๊ฐ์์ ~ :) |
@@ -0,0 +1,21 @@
+public class Car {
+ private String name;
+ private int position;
+
+ Car(String name) {
+ this.name = name;
+ this.position = 0;
+ }
+
+ public String getName() {
+ return name;
+ }
+
+ public int getPosition() {
+ return position;
+ }
+
+ public... | Java | 10, 4 ๊ฐ ์ด๋ค ์๋ฏธ๋ฅผ ์ง๋๊ณ ์๋์ง 2๋
๋ค์ ์ด ์ฝ๋๋ฅผ ๋ณด๊ฑฐ๋ ํ์ธ์ด ๋ณด๋ฉด ์ดํด๊ฐ ์ ์๋ ์ ์์ ๊ฒ ๊ฐ์์.
์ด๋ฐ magic number ๋ฅผ ์์๋ก ์ถ์ถํด๋ณด๋๊ฒ ์ด๋จ๊น์? |
@@ -0,0 +1,68 @@
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.List;
+import java.util.Scanner;
+import java.util.stream.Stream;
+
+public class InputView {
+ private static final int MAX_LENGTH = 6;
+ private static final Scanner scanner = new Scanner(System.in);
+
+ public static L... | Java | primitive type ์ด ์๋๋ผ wrapper type ์ผ๋ก ์ ์ธํ์ ์ด์ ๊ฐ ์์๊น์? |
@@ -0,0 +1,68 @@
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.List;
+import java.util.Scanner;
+import java.util.stream.Stream;
+
+public class InputView {
+ private static final int MAX_LENGTH = 6;
+ private static final Scanner scanner = new Scanner(System.in);
+
+ public static L... | Java | ์ ๊ทผ์ ์ด์๊ฐ ๋น ์ง ์ด์ ๊ฐ ์์๊น์?
์ ๊ทผ์ ์ด์๋ฅผ ์๋ตํ๋ฉด ์ด๋ค ์ ๊ทผ์ ์ด์๊ฐ ์ ์ฉ๋ ๊น์? |
@@ -0,0 +1,68 @@
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.List;
+import java.util.Scanner;
+import java.util.stream.Stream;
+
+public class InputView {
+ private static final int MAX_LENGTH = 6;
+ private static final Scanner scanner = new Scanner(System.in);
+
+ public static L... | Java | InputView ๊ฐ์ฒด๋ ์ํ๋ฅผ ๊ฐ์ง์ง ์๋ util ํด๋์ค์ฒ๋ผ ๋น์ถฐ์ง๋๋ฐ
static ๋ฉ์๋๋ค๋ก ๊ตฌ์ฑํ์ฌ ๊ฐ์ฒด ์์ฑ ๋น์ฉ์ ์ ๊ฐ์์ผ๋ณด๋๊ฑด ์ด๋ค๊ฐ์? |
@@ -0,0 +1,68 @@
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.List;
+import java.util.Scanner;
+import java.util.stream.Stream;
+
+public class InputView {
+ private static final int MAX_LENGTH = 6;
+ private static final Scanner scanner = new Scanner(System.in);
+
+ public static L... | Java | ์ฌ์ฉํ์ง ์๋ ์ฝ๋๋ ๊ณผ๊ฐํ ์ญ์ ํ์๋๊ฒ ์ข์ ๊ฒ ๊ฐ์ต๋๋ค |
@@ -0,0 +1,68 @@
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.List;
+import java.util.Scanner;
+import java.util.stream.Stream;
+
+public class InputView {
+ private static final int MAX_LENGTH = 6;
+ private static final Scanner scanner = new Scanner(System.in);
+
+ public static L... | Java | ์ค๋ฐ๊ฟ, ์คํ์ด์ค๋ ์ปจ๋ฒค์
์
๋๋ค.
๋ฌธ๋งฅ์ด ๋ฌ๋ผ์ง๋ค๋๊ฐ, ํ๋์ ๋ฉ์๋ ์ฌ์ด ๋ฑ์ ํ๋ฒ์ ์ค๋ฐ๊ฟ์ผ๋ก ๊ตฌ๋ถ ์ง์ด์ ๊ฐ๋
์ฑ์ ๋์ฌ๋ณด๋ฉด ์ด๋จ๊น์? |
@@ -0,0 +1,68 @@
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.List;
+import java.util.Scanner;
+import java.util.stream.Stream;
+
+public class InputView {
+ private static final int MAX_LENGTH = 6;
+ private static final Scanner scanner = new Scanner(System.in);
+
+ public static L... | Java | ์ด ๋ถ๋ถ์ java 8 ์ stream api ๋ฅผ ์ฌ์ฉํด๋ณด๋ฉด ์ด๋จ๊น์? |
@@ -0,0 +1,68 @@
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.List;
+import java.util.Scanner;
+import java.util.stream.Stream;
+
+public class InputView {
+ private static final int MAX_LENGTH = 6;
+ private static final Scanner scanner = new Scanner(System.in);
+
+ public static L... | Java | ์ ์ธ๊ณผ ํ ๋น์ด ๋ถ๋ฆฌ๋ ์ด์ ๊ฐ ์์๊น์? |
@@ -0,0 +1,27 @@
+import java.util.List;
+
+public class OutputView {
+ private static final String DRIVE = "-";
+
+ public void resultMessage() {
+ System.out.println("\n์คํ ๊ฒฐ๊ณผ");
+ }
+
+ public void oneTrialMessage(List<Car> cars) {
+ for(Car car: cars) {
+ System.out.println(car.g... | Java | ๊ฒ์ ์์์ ์ํ input ๊ณผ ๊ด๋ จ๋ print ๋ inputview ์ ์๋๊ฒ ์ด๋จ๊น์? |
@@ -0,0 +1,27 @@
+import java.util.List;
+
+public class OutputView {
+ private static final String DRIVE = "-";
+
+ public void resultMessage() {
+ System.out.println("\n์คํ ๊ฒฐ๊ณผ");
+ }
+
+ public void oneTrialMessage(List<Car> cars) {
+ for(Car car: cars) {
+ System.out.println(car.g... | Java | ๋ฉ์๋ ์ด๋ฆ์ด ๋๋ฌธ์๋ก ์์ํ๊ณ ๋ช
์ฌ๋ค์ ~ |
@@ -0,0 +1,68 @@
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.List;
+import java.util.Scanner;
+import java.util.stream.Stream;
+
+public class InputView {
+ private static final int MAX_LENGTH = 6;
+ private static final Scanner scanner = new Scanner(System.in);
+
+ public static L... | Java | ๋ฆฌํด์ ์ด๋ ๊ฒ ์ ์ผ์ ์ด์ ๊ฐ ์์๊น์? |
@@ -0,0 +1,68 @@
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.List;
+import java.util.Scanner;
+import java.util.stream.Stream;
+
+public class InputView {
+ private static final int MAX_LENGTH = 6;
+ private static final Scanner scanner = new Scanner(System.in);
+
+ public static L... | Java | trim ๊ณผ checkNameLength ๋๊ฐ์ ์ญํ ์ ์ํํ๋ ๋ฉ์๋๋ค์
๋ฉ์๋๋ค์ ์ฌ์ฌ์ฉํ ์ ์๊ฒ ๋ค์ด๋ฐ ๋ณ๊ฒฝ, ๋จ์ผ์ฑ
์์์น์ ์ง์ผ์ ๋ฆฌํฉํ ๋ง ํด๋ณด๋ฉด ์ด๋จ๊น์? |
@@ -0,0 +1,68 @@
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.List;
+import java.util.Scanner;
+import java.util.stream.Stream;
+
+public class InputView {
+ private static final int MAX_LENGTH = 6;
+ private static final Scanner scanner = new Scanner(System.in);
+
+ public static L... | Java | return scanner.nextInt(); ๋ก ์ถฉ๋ถํ ๊ฒ ๊ฐ์ต๋๋ค ~
๊ทธ๋ฆฌ๊ณ input() ๋ฉ์๋๊ฐ inputCount() ๋ฉ์๋๋ฅผ ํฌํจํ๋ ๋ฏํ ๋ค์ด๋ฐ์ธ ๊ฒ ๊ฐ์ต๋๋ค
๋์ ๊ตฌ๋ถ์ ์ํด ๋ฉ์๋ ์ด๋ฆ์ ์ข ๋ณ๊ฒฝํด๋ณด์๋ฉด ์ด๋จ๊น์?
(Count ๋ผ๋ ๋ค์ด๋ฐ์ ๋๋ฌด ๊ด๋ฒ์ํ ๋จ์ด์ธ ๊ฒ ๊ฐ์ต๋๋ค. ์๋ ํ์๋ฅผ ๋ํ๋ด๋ ๋ ๊ด์ฐฎ์ ๋ค์ด๋ฐ์ ์์๊น์?) |
@@ -0,0 +1,27 @@
+import java.util.List;
+
+public class OutputView {
+ private static final String DRIVE = "-";
+
+ public void resultMessage() {
+ System.out.println("\n์คํ ๊ฒฐ๊ณผ");
+ }
+
+ public void oneTrialMessage(List<Car> cars) {
+ for(Car car: cars) {
+ System.out.println(car.g... | Java | ์ฌ๊ธฐ์๋ StringBuilder ๋ก ๋ฐ๋ ์ด์ ๊ฐ ์์๊น์? |
@@ -0,0 +1,39 @@
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.List;
+import java.util.stream.Collectors;
+
+public class RacingGame {
+ private List<String> winnernames = new ArrayList<>();
+
+ public void race(List<Car> cars) {
+ for(Car car: cars) {
+ goOrStay(... | Java | ์ ์ฒด์ ์ผ๋ก ํ
์คํธ ์ฝ๋๊ฐ ์์ด์ ์์ฝ๋ค์ ใ
ใ
|
@@ -0,0 +1,21 @@
+public class Car {
+ private String name;
+ private int position;
+
+ Car(String name) {
+ this.name = name;
+ this.position = 0;
+ }
+
+ public String getName() {
+ return name;
+ }
+
+ public int getPosition() {
+ return position;
+ }
+
+ public... | Java | ๋ถํ์ํ setter/getter๋ ๊ฐ์ฒด์ ์์ฑ์ ์ธ์ ๋ ๋ณ๊ฒฝํ ์ ์๋ ์ํ๊ฐ ๋๊ธฐ ๋๋ฌธ์ ์ง์ํ๋๋ก ํ๋ ๊ฒ ๊ฐ์ต๋๋ค! ๊ตณ์ด ์ฌ์ฉํ์ง ์์๋ ๋๋ค๋ฉด ๋ฐ์ํด๋ณด๋๋ก ํ๊ฒ ์ต๋๋ค! |
@@ -0,0 +1,21 @@
+public class Car {
+ private String name;
+ private int position;
+
+ Car(String name) {
+ this.name = name;
+ this.position = 0;
+ }
+
+ public String getName() {
+ return name;
+ }
+
+ public int getPosition() {
+ return position;
+ }
+
+ public... | Java | ๊ฒ์์ ๋ฃฐ์ ์๋์ฐจ ๋ชจ๋ธ ํด๋์ค๊ฐ ๊ฐ์ง๊ณ ์์ ํ์๋ ์๋ค๊ณ ์๊ฐํ๋๋ฐ ๋ณด๋ค ๋ ์ข์ ๋ฐฉ๋ฒ์ ์์ง ์๊ฐํด๋ณด์ง ๋ชปํ ๊ฒ ๊ฐ์ต๋๋ค. ์๋๋ Rule ํด๋์ค๋ฅผ ๋ฐ๋ก ๋ง๋ค์ด ๊ตฌํํ๋ ค๊ณ ํ์ผ๋ ์์ง ๋ฐฉ๋ฒ์ ๊ณ ๋ฏผ ์ค์ ์์ต๋๋ค! ๊ณ ๋ฏผํด์ ๋ฐ์ํ ์ ์๋๋ก ๋
ธ๋ ฅํด๋ณด๊ฒ ์ต๋๋ค |
@@ -0,0 +1,21 @@
+public class Car {
+ private String name;
+ private int position;
+
+ Car(String name) {
+ this.name = name;
+ this.position = 0;
+ }
+
+ public String getName() {
+ return name;
+ }
+
+ public int getPosition() {
+ return position;
+ }
+
+ public... | Java | ๋ต code formatting ํ๋ ์ต๊ด์ ๋ค์ด๊ฒ ์ต๋๋ค! |
@@ -0,0 +1,21 @@
+public class Car {
+ private String name;
+ private int position;
+
+ Car(String name) {
+ this.name = name;
+ this.position = 0;
+ }
+
+ public String getName() {
+ return name;
+ }
+
+ public int getPosition() {
+ return position;
+ }
+
+ public... | Java | magic number ์ญ์ ์ถํ์ ๋ดค์ ๋ ์ดํดํ ์ ์๋๋ก ์์๋ก ์ ์ธํ๋ ์ต๊ด์ ๋ค์ด๊ฒ ์ต๋๋ค! |
@@ -0,0 +1,68 @@
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.List;
+import java.util.Scanner;
+import java.util.stream.Stream;
+
+public class InputView {
+ private static final int MAX_LENGTH = 6;
+ private static final Scanner scanner = new Scanner(System.in);
+
+ public static L... | Java | ๋ฉ์๋ ์ฒด์ด๋์ ์ ์ฉํด์ Arrays.stream(trimmedInputCarName).forEach(~~)
๋ก ์ด์ด ๋ถ์ด์๋ฉด ์ด๋จ๊น์ |
@@ -0,0 +1,136 @@
+import java.util.Random;
+import java.util.ArrayList;
+
+public class RacingGame {
+ static final int MAX_LENGTH = 6;
+ static final int CAN_GO_NUMBER = 4;
+ static final int ORIGINAL_POSITION = 0;
+
+ public String[] nameSet(String inputNames) {
+ String[] names = inputNames.split... | Java | ๋ฉ์๋๋ค์ด static ์ธ ์ด์ ๊ฐ ์์๊น์? |
@@ -0,0 +1,136 @@
+import java.util.Random;
+import java.util.ArrayList;
+
+public class RacingGame {
+ static final int MAX_LENGTH = 6;
+ static final int CAN_GO_NUMBER = 4;
+ static final int ORIGINAL_POSITION = 0;
+
+ public String[] nameSet(String inputNames) {
+ String[] names = inputNames.split... | Java | ๋ชจ๋ ๋ฉ์๋๊ฐ public ์ผ๋ก ๊ณต๊ฐ๋์ด์๋ ์ด์ ๊ฐ ์์๊น์? |
@@ -0,0 +1,136 @@
+import java.util.Random;
+import java.util.ArrayList;
+
+public class RacingGame {
+ static final int MAX_LENGTH = 6;
+ static final int CAN_GO_NUMBER = 4;
+ static final int ORIGINAL_POSITION = 0;
+
+ public String[] nameSet(String inputNames) {
+ String[] names = inputNames.split... | Java | RacingGame ์์ Cars ์ ๋ํ ์ํ๋ฅผ ๋ค๊ณ ์์ผ๋ฉด ์ด๋จ๊น์? |
@@ -0,0 +1,12 @@
+import java.util.ArrayList;
+
+public class Main {
+ public static void main(String[] args) {
+ RacingGame racing = new RacingGame();
+ ArrayList<Car> cars = new ArrayList<>();
+ cars = racing.registerCarNames(cars, racing.nameSet(InputView.setNames()));
+ int number = I... | Java | ์กฐ์์ ๋ธ๋กํฌ์ effective java ์๋ '๊ฐ์ฒด๋ ์ธํฐํ์ด์ค๋ฅผ ์ฌ์ฉํด ์ฐธ์กฐํ๋ผ.'
๋ผ๋ ๋ถ๋ถ์ด ์์ต๋๋ค.
ํ๋ฒ ์ฝ์ด๋ณด์๊ณ ๊ฐ์ ํด๋ณด์๋ฉด ์ข์ ๊ฒ ๊ฐ์์ ~
jaehun2841.github.io/2019/03/01/effective-java-item64/#%EC%9C%A0%EC%97%B0%ED%95%9C-%ED%94%84%EB%A1%9C%EA%B7%B8%EB%9E%A8%EC%9D%84-%EC%83%9D%EC%84%B1%ED%95%98%EB%8A%94-%EC%9D%B8%ED%84%B0%ED%8E%98%EC%9D%B4%EC%8A%A4-%ED%83%80%EC%9E... |
@@ -0,0 +1,136 @@
+import java.util.Random;
+import java.util.ArrayList;
+
+public class RacingGame {
+ static final int MAX_LENGTH = 6;
+ static final int CAN_GO_NUMBER = 4;
+ static final int ORIGINAL_POSITION = 0;
+
+ public String[] nameSet(String inputNames) {
+ String[] names = inputNames.split... | Java | ๋ฉ์๋๋ช
์ด ๋๋ถ๋ถ ๋ช
์ฌ์ธ ๊ฒ ๊ฐ์๋ฐ ๋์ฌํ์ผ๋ก ๋ฐ๊ฟ๋ณด๋ฉด ์ด๋จ๊น์~
๊ทธ๋ฆฌ๊ณ cnt ๊ฐ์ ๊ฒฝ์ฐ์๋ ํ๋ค์์ผ๋ก ์ ์ด์ฃผ๋ฉด ์คํฐ๋ ๊ท์น์ ์ข์ ๊ฒ ๊ฐ์ต๋๋ค |
@@ -0,0 +1,136 @@
+import java.util.Random;
+import java.util.ArrayList;
+
+public class RacingGame {
+ static final int MAX_LENGTH = 6;
+ static final int CAN_GO_NUMBER = 4;
+ static final int ORIGINAL_POSITION = 0;
+
+ public String[] nameSet(String inputNames) {
+ String[] names = inputNames.split... | Java | ํ ํด๋์ค์์ ์ฑ
์์ ๋ง์ด ๋ค๊ณ ์๊ธฐ ๋๋ฌธ์ ํด๋์ค ๊ธธ์ด๊ฐ ๋์ด๋ ๊ฒ ๊ฐ์๋ฐ์,
winner ์ ๋ํ ๋ก์ง์ ๋ค๋ฅธ ํด๋์ค๋ฅผ ๋ง๋ค์ด ์์ํด๋ณด๋ฉด ์ด๋จ๊น์? |
@@ -0,0 +1,39 @@
+import org.junit.After;
+import org.junit.Before;
+import org.junit.Test;
+
+import static org.junit.jupiter.api.Assertions.assertEquals;
+
+import java.util.ArrayList;
+
+public class RacingGameTest {
+ RacingGame r;
+ ResultView v;
+
+ @Before
+ public void setUp() {
+ r = new Rac... | Java | ์คํฐ๋ ๊ท์น : ๋ณ์๋ช
์ ์ค์ฌ์ฐ์ง ์๋๋ค |
@@ -0,0 +1,40 @@
+import java.util.ArrayList;
+
+public class ResultView {
+ public static void resultRacing(int number, ArrayList<Car> cars) {
+ System.out.println("์คํ ๊ฒฐ๊ณผ");
+ for (int i = 0; i < number; i++) {
+ RacingGame.randomToNumber(cars);
+ resultRacing(cars);
+ ... | Java | ResultView ๋ ์ดํ๋ฆฌ์ผ์ด์
์ ํ๋ฆ์ด๋ ๋ก์ง์ ์ ํ์ ์์ด ๊ทธ๋ฅ ๋ค์ด์จ input ์ ๋ํด์ ์ถ๋ ฅ๋ง ํด์ฃผ๋ ์ ๋์ ์ญํ ์ ํ๋๋ก ๋ณ๊ฒฝํด๋ณด๋ฉด ์ด๋จ๊น์? |
@@ -0,0 +1,37 @@
+package christmas.service;
+
+import christmas.domain.Order;
+import christmas.domain.constant.Message;
+import christmas.domain.constant.dish.Appetizer;
+import christmas.domain.constant.dish.Beverage;
+import christmas.domain.constant.dish.Dessert;
+import christmas.domain.constant.dish.MainDish;
+i... | Java | ๋ฉ๋ด enum ํ์
์ด ์์์ผ๋ฉด ํ ๋ฒ์ ์ฐพ์ ์ ์์๊ฑฐ ๊ฐ์ต๋๋ค. |
@@ -0,0 +1,38 @@
+package christmas.domain.constant.dish;
+
+import java.util.Map;
+import java.util.stream.Collectors;
+import java.util.stream.Stream;
+
+public enum MainDish implements Orderable {
+ T_BONE_STEAK("ํฐ๋ณธ์คํ
์ดํฌ", 55000),
+ BARBEQUE_RIBS("๋ฐ๋นํ๋ฆฝ", 54000),
+ SEAFOOD_PASTA("ํด์ฐ๋ฌผํ์คํ", 35000),
+ CHRISTM... | Java | static์ผ๋ก Map์ ์์ฑํด๋ ๊ฑฐ ์ข์ ๊ฑฐ ๊ฐ์ต๋๋ค.
๊ทธ๋ฐ๋ฐ BY_LABEL ์ด๋ฆ์ ๋๋ฌธ์๋ก ํ๋ ๊ฒ์ด ์ปจ๋ฒค์
์ธ์ง ์ ๋ ์ ๋ชจ๋ฅด๊ฒ ๋๋ผ๊ณ ์.
์์๋ ์๋๋ฐ static final์ด๊ธฐ๋ ํ๊ณ ๋ญ๊ฐ ๋ง์๊น์? |
@@ -0,0 +1,31 @@
+package christmas.service;
+
+import christmas.domain.DecemberDate;
+import christmas.domain.constant.Discount;
+import christmas.domain.constant.dish.Orderable;
+import christmas.domain.dto.BenefitDto;
+import christmas.service.discountcalculator.SpecialDiscountCalculator;
+import christmas.service.d... | Java | menus๋ณด๋ค Order๋ฅผ ์ธ์๋ก ๋ฐ๋ ๊ฒ์ด ๋ ๊ฐ์ฒด์งํฅ์ ๋ง๋ค๊ณ ์๊ฐํฉ๋๋ค. ๊ทธ๋ฆฌ๊ณ Order ๋ด๋ถ์ getTotalCost ๋ฉ์๋๊ฐ ์๋ ๊ฒ์ด ์ด๋จ๊น์? ๊ทธ๋ฌ๋ฉด ์์ ์ ๋ฐ์ดํฐ๋ก ๊ฒฐ๊ณผ๋ฅผ ์ป์ ์ ์์ต๋๋ค. |
@@ -0,0 +1,21 @@
+package christmas.service;
+
+import christmas.domain.constant.Benefit;
+import christmas.domain.dto.BenefitDto;
+
+public class PresentationManager {
+ private static final int PRESENTATION_THRESHOLD = 120000;
+ private static final int PRESENTATION_PRICE = 25000;
+
+ private PresentationMan... | Java | 120_000 ์ฒ๋ผ _ ์ ๋ถ์ผ ์ ์์ต๋๋ค! |
@@ -0,0 +1,21 @@
+package christmas.service;
+
+import christmas.domain.constant.Benefit;
+import christmas.domain.dto.BenefitDto;
+
+public class PresentationManager {
+ private static final int PRESENTATION_THRESHOLD = 120000;
+ private static final int PRESENTATION_PRICE = 25000;
+
+ private PresentationMan... | Java | private์ผ๋ก ์์ฑ์ ๋ง์์ค๋ ๊ฒ ์ข์ต๋๋ค! ๋ค๋ง ๋ด์ฉ์ด ์์ผ๋ฉด ๋น์ค๋ ์๋ ๊ฒ์ด ์ข์ต๋๋ค. |
@@ -0,0 +1,24 @@
+package christmas.service.discountcalculator;
+
+import static christmas.domain.constant.Discount.DATE_OF_CHRISTMAS;
+import static christmas.domain.constant.Discount.ONE_WEEK;
+import static christmas.domain.constant.Discount.SPECIAL_DISCOUNT_AMOUNT;
+import static christmas.domain.constant.Discount.... | Java | ๊ธด ์กฐ๊ฑด์์ ๋ฉ์๋๋ก ๋ฝ๋ ๊ฒ์ด ๊ฐ๋
์ฑ์ ์ข์ต๋๋ค! |
@@ -0,0 +1,70 @@
+package christmas.service.discountcalculator;
+
+import static christmas.domain.constant.Discount.ONE;
+import static christmas.domain.constant.Discount.ONE_WEEK;
+import static christmas.domain.constant.Discount.TWO;
+import static christmas.domain.constant.Discount.WEEK_DISCOUNT_UNIT;
+import static... | Java | dto์ addํ๋ ๊ฒ๋ณด๋ค ๊ฒฐ๊ณผ๊ฐ์ ๋ฐํํ๋ฉด Dto์ ์์กด์ฑ์ ๋จ์ด๋จ๋ฆฌ๊ณ ๋ค๋ฅธ Dto์๋ ์ ๋ฌ ํ ์ ์์ต๋๋ค. |
@@ -0,0 +1,42 @@
+import Customer from '../src/models/Customer';
+import Order from '../src/models/Order';
+
+describe('Customer ํด๋์ค', () => {
+ let customer;
+
+ beforeEach(() => {
+ customer = new Customer();
+ });
+
+ test('์ฃผ๋ฌธ์ด ์์ ๋, ๋ฑ์ง ๊ณ์ฐ ๊ฒฐ๊ณผ๋ null์ด ๋๋ค.', () => {
+ customer.calculateBadge();
+ expect(cu... | JavaScript | ์ง๊ธ์ `ํธ๋ฆฌ`์ ๋ํ ํ
์คํธ ์ผ์ด์ค๋ง ์๋๋ฐ, `๋ณ`๊ณผ `์ฐํ` ํ
์คํธ ์ผ์ด์ค๊น์ง ๋ชจ๋ ํฌํจํ๋ฉด ํ
์คํธ ์ ๋ขฐ๋๊ฐ ๋์์ง ๊ฒ ๊ฐ์์! |
@@ -0,0 +1,48 @@
+import Menu from '../src/models/Menu';
+import { MenuConstants } from '../src/constants/MenuConstants';
+
+describe('Menu ํด๋์ค', () => {
+ let menu;
+
+ beforeEach(() => {
+ menu = new Menu();
+ });
+
+ test('๋ฉ๋ด ํญ๋ชฉ์ด ์ฌ๋ฐ๋ฅด๊ฒ ์ด๊ธฐํ๋์ด์ผ ํ๋ค.', () => {
+ expect(menu.getItem('ํฐ๋ณธ์คํ
์ดํฌ')).toEqual({
+ n... | JavaScript | ์ฌ๊ธฐ ๋ ํ
์คํธ ๋ชจ๋ ์ฌ๋ฌ ๊ฐ์ `expect()`๋ฅผ ๊ฐ์ง๊ณ ์๋๋ฐ์. `expect()`ํ๋ ๋ถ๋ถ์ ๊ตฌ์กฐ๊ฐ ๋น์ทํ๋๊น "๋ฉ๋ด ํญ๋ชฉ ์ด๊ธฐํ ํ
์คํธ"์ "์กด์ฌํ์ง ์๋ ๋ฉ๋ด ํญ๋ชฉ ํ
์คํธ"๋ฅผ `test.each()`๋ก ๋ณ๊ฒฝํ๋ ๊ฑด ์ด๋จ๊น์?. ํ๋ก๋์
์ฝ๋๋ฅผ ์์ฑํ ๋ ์ค๋ณต๋๋ ๋ถ๋ถ์ ์ ๊ฑฐํ๋ ๊ฒ์ฒ๋ผ, ํ
์คํธ ์ฝ๋๋ ๋ง์ฐฌ๊ฐ์ง๋ก ์ค๋ณต์ ์ ๊ฑฐํ๋ ๋ฆฌํฉํฐ๋ง์ด ํ์ํ๋ค๊ณ ์๊ฐํฉ๋๋ค! |
@@ -0,0 +1,73 @@
+import OrderValidator from '../src/validators/OrderValidator';
+import Menu from '../src/models/Menu';
+import { ValidatorConstants } from '../src/validators/constants/ValidatorConstants';
+
+describe('OrderValidator ํด๋์ค', () => {
+ let mockMenu;
+
+ beforeEach(() => {
+ mockMenu = new Menu();
+ ... | JavaScript | `Validator` ํ
์คํธ ํ์ผ์์๋ ์์ธ๊ฐ ๋ฐ์ํ์ ๋ ์๋ฌ์ ์ ํ๊ณผ ๋ฉ์์ง ํฌํจ ์ฌ๋ถ๋ฅผ ๊ฒ์ฌํ๊ณ ์๋๋ฐ์. ๋ค๋ฅธ ๊ณณ์ ์์ธ ํ
์คํธ์์๋ ๋ฉ์์ง ๊ฒ์ฌ ์์ด ์์ธ๊ฐ ๋ฐ์ํ๋์ง๋ง(`toThrow()`) ๊ฒ์ฌํ๋ ์ด์ ๊ฐ ๊ถ๊ธํฉ๋๋ค. |
@@ -0,0 +1,56 @@
+import InputView from '../views/InputView';
+import OutputView from '../views/OutputView';
+import OrderService from '../services/OrderService';
+import DiscountService from '../services/DiscountService';
+import Customer from '../models/Customer';
+import { DateFormatter } from '../utils/DateFormatte... | JavaScript | ํจ์ ๋ผ์ธ ์๊ฐ ๋ฑ 15๋ผ์ธ์ธ ๊ฒ ๊ฐ๋ค์. ๋ง์ฝ ์ด๋ค ์ถ๋ ฅ์ด ํ๋ ์ถ๊ฐ๋๋ค๋ฉด ์ฌ๊ธฐ์ ์ถ๊ฐํด์ผ ํ ํ
๋ฐ, ๊ทธ๋ฌ๋ฉด ํจ์ ๋ผ์ธ ์๊ฐ 15๋ผ์ธ์ ๋๊ธธ ์๋ ์์ ๊ฒ ๊ฐ์์.
ํจ์ ๋ผ์ธ ์ ์ ํ์ด ์๋ ๊ฒ์ 15๋ผ์ธ์ด๋ผ๋ ๊ฒ ์ค์ํด์๋ผ๊ธฐ๋ณด๋ค ๊ทธ๋งํผ **ํจ์๋ฅผ ์ ๋ถ๋ฆฌํ์** ๋ ์๋ฏธ์ธ ๊ฒ ๊ฐ์ต๋๋ค. ๊ทธ๋์ ํจ์์ ๋ผ์ธ ์๊ฐ ๊ฐ๋น๊ฐ๋นํ๋ค๋ ๊ฒ์, ๋ฆฌํฉํฐ๋ง์ ์ ํธ๊ฐ ์๋๊น ์ถ์ด์๐ค
์ด ๋ฉ์๋๋ ๋์์ ์ฌ๋ฌ ๊ฐ์ง ์ผ์ ์ฒ๋ฆฌํ๊ณ ์๋ ๊ฒ์ฒ๋ผ ๋ณด์ด๋๋ฐ์(์
๋ ฅ ๋ฐ๊ธฐ, ์ฃผ๋ฌธ ์์ฑ, ๊ฐ์ข
ํ ์ธ ์ ์ฉ, ์ถ๋ ฅ, ์
๋ ฅ ์์ธ ์ฒ๋ฆฌ ๋ฐ ์ฌ์
๋ ฅ ๋ฐ๊ธฐ ๋ฑ). ๋ฉ์๋๊ฐ ํ๋์ ์ญํ ๋ง ์ํํ ์... |
@@ -0,0 +1,30 @@
+export default class Customer {
+ #orders;
+
+ #badge;
+
+ static BADGE_CRITERIA = [
+ { name: '์ฐํ', amount: 20000 },
+ { name: 'ํธ๋ฆฌ', amount: 10000 },
+ { name: '๋ณ', amount: 5000 },
+ ];
+
+ constructor() {
+ this.#orders = [];
+ this.#badge = null;
+ }
+
+ addOrder(order) {
+ ... | JavaScript | ์์๋ฅผ ํ์ผ๋ก ๋ง๋ ๋ค๋ฉด ์์ ์ด ํ์ํ ๋ ์ฐพ๊ธฐ๊ฐ ์์ํ๊ณ , ๋ฐฐ์ง ์ ๋ณด๊ฐ ๋์ด๋๊ฑฐ๋ ์ค์ด๋ค์ด๋ ๊ด๋ฆฌํ๊ธฐ ํธ๋ฆฌํ ๊ฒ ๊ฐ์๋ฐ์. ํ์ผ๋ก ๋ง๋ค์ง ์๊ณ ์ฌ๊ธฐ์ ์์ฑํ์ ์ด์ ๊ฐ ์๋์? |
@@ -0,0 +1,81 @@
+import { OrderConstants } from './constants/OrderConstants';
+
+export default class Order {
+ #menuItems;
+
+ #totalAmount;
+
+ #discountAmount;
+
+ #gift;
+
+ #discountDetails;
+
+ constructor() {
+ this.#menuItems = new Map();
+ this.#totalAmount = 0;
+ this.#discountAmount = 0;
+ ... | JavaScript | ์ ๋ `Model`์ ์ฆ์ ๋ฉ๋ด์ ๋ํ ์ ๋ณด(๋ฐ์ดํฐ)๋ง ์ ์ฅํ๊ณ , ๊ทธ ๋ฐ์ดํฐ๋ฅผ ๊ฐ์ง๊ณ '`์ฆ์ ๋ฉ๋ด` `๊ฐ์`๊ฐ'์ ๊ฐ์ด ํฌ๋งทํ
ํ๋ ๊ฒ์ `View`์ ์ญํ ์ด๋ผ๊ณ ์๊ฐํด์.
๋ง์ฝ ์ฆ์ ๋ฉ๋ด ๋ฐ์ดํฐ์ ๋ํด ๋ค๋ฅธ ํ์์ผ๋ก ์ถ๋ ฅํ๋ ๋ทฐ๊ฐ ์ฌ๋ฌ ๊ฐ ์๊ธด๋ค๊ณ ๊ฐ์ ํด ๋ด
์๋ค. ์ง๊ธ ์ฝ๋๋ฐฉ์๋๋ก๋ผ๋ฉด ๊ฐ ๋ทฐ์์ ๋ํ๋ผ ์ถ๋ ฅ ํ์์ `Model`์์ ์ํํด์ผ ํฉ๋๋ค. ํ์ง๋ง ์ด๊ฑด `Model`์ด `View`์ ์์กดํ๋ ๊ฒ๊ณผ ๊ฐ์ต๋๋ค. ์ถ๋ ฅ ํ์์ด ๋ณ๊ฒฝ๋์์ ๋ `Model`์ ๋ฉ์๋๋ฅผ ๋ณ๊ฒฝํ๊ฒ ๋ ํ
๋๊น์. ๋ `Model`์ ์ญํ ์ ๋ฒ์ด๋๋ ๊ฒ์ด๊ธฐ๋ ํฉ๋๋ค.
๊ทธ๋์ ์ ๋ ... |
@@ -0,0 +1,6 @@
+export const OrderConstants = {
+ GIFT_THRESHOLD_AMOUNT: 120000,
+ GIFT_EVENT_TITLE: '์ฆ์ ์ด๋ฒคํธ',
+ GIFT_NAME: '์ดํ์ธ',
+ GIFT_QUANTITY: 1,
+}; | JavaScript | ์ง๊ธ์ ์ฆ์ ์ด๋ฒคํธ๊ฐ ์ดํ์ธ 1๊ฐ๋ง ์ฃผ๊ณ ์๋๋ฐ์. ๋ง์ฝ ์ด ์ด๋ฒคํธ๊ฐ ํ์ฅ๋๋ค๋ฉด, ๋ฐฐ์ง ์ด๋ฒคํธ์ฒ๋ผ ๊ธ์ก์ ๋ฐ๋ผ ๋ค๋ฅธ ์ ๋ฌผ์ ์ฆ์ ํ๊ฒ ๋ ์๋ ์์ ๊ฒ ๊ฐ์์. Strategy ํจํด์ ์ ํํ์ ์ด์ ๋ ์ ์ง๋ณด์์ ๋ณ๊ฒฝ์ ์ฉ์ดํด์๋ผ๊ณ ์๊ฐ๋๋๋ฐ์. ๊ทธ๋งํผ ์์๋ฅผ ์ ์ธํ ๋์๋ ํ์ฅ์ฑ์ ์ฑ๊ธฐ๋ฉด ๋ ์ข์ง ์์์๊น ์๊ฐํด๋ด
๋๋ค! |
@@ -0,0 +1,46 @@
+import ChristmasDiscountStrategy from './strategies/ChristmasDiscountStrategy';
+import WeekdayDiscountStrategy from './strategies/WeekdayDiscountStrategy';
+import WeekendDiscountStrategy from './strategies/WeekendDiscountStrategy';
+import SpecialDiscountStrategy from './strategies/SpecialDiscountSt... | JavaScript | ์ด ๋ถ๋ถ์ ์ด๋ ๊ฒ ๋ฐ๊ฟ ์ ์์ ๊ฒ ๊ฐ์์!
```javascript
Object.values(this.#strategies).forEach((strategy) => {
const discountResult = strategy.applyDiscount(order, date);
// ...
});
``` |
@@ -0,0 +1,5 @@
+export default class IDiscountStrategy {
+ applyDiscount(order, date) {
+ throw new Error('[ERROR] ํ์ ํด๋์ค์์ applyDiscount ๋ฉ์๋๋ฅผ ๊ตฌํํด์ผ ํฉ๋๋ค.');
+ }
+} | JavaScript | ํ์ผ๋ช
๊ณผ ํด๋์ค๋ช
๋งจ ์์ `I`๊ฐ ๋ถ์ด ์๋๋ฐ, ํน์ ์๋ํ์ ๊ฑด๊ฐ์? ์๋ํ์ ๊ฑฐ๋ผ๋ฉด ์ด๋ค ์๋ฏธ์ธ์ง ๊ถ๊ธํฉ๋๋ค! |
@@ -0,0 +1,16 @@
+import IDiscountStrategy from './IDiscountStrategy';
+import { DiscountStrategyConstants } from './constants/DiscountStrategyConstants';
+
+export default class SpecialDiscountStrategy extends IDiscountStrategy {
+ applyDiscount(order, date) {
+ const dayOfWeek = date.getDay();
+ const isSunday... | JavaScript | ํน๋ณ ํ ์ธ์ด ๋ชจ๋ ์ผ์์ผ (+25์ผ)์ด๋ผ๋ ์ ์ ์ด์ฉํ์
จ๋ค์!
์ ๋ ๋ณ ํ์๊ฐ ๋ ๋ ์ง๋ฅผ ํ๋ํ๋ ์์ ๋ฐฐ์ด์ ๋ด์์ ๊ด๋ฆฌํ๋๋ฐ์. ์ฎ๊ฒจ ์ ์ ๋ ์คํ๋ผ๋ ๋๋ค๋ฉด ํฐ์ผ์ด์ง๋ง๐
, ์ด๋ ๊ฒ ํ ์ด์ ๋ ํน๋ณ ํ ์ธ ๋ ์ง๊ฐ ๋ณ๊ฒฝ๋ ์ ์์ ๊ฒ ๊ฐ๋ค๊ณ ์๊ฐํ๊ธฐ ๋๋ฌธ์
๋๋ค. ์๊ตฌ์ฌํญ์์ "ํน๋ณ ํ ์ธ"์ ์ค๋ช
ํ ๋, '๋ฌ๋ ฅ์ ๋ณ์ด ํ์๋ ๋ ์ง'๋ผ๊ณ ์ค๋ช
ํ๋๋ผ๊ตฌ์. ๋ง์ฝ '๋ชจ๋ ์ผ์์ผ๊ณผ ํฌ๋ฆฌ์ค๋ง์ค ๋น์ผ'์ฒ๋ผ ์ค๋ช
ํ๋ค๋ฉด ์ ๋ ์ด๋ฐ ์ฝ๋ ๋ฐฉ์์ผ๋ก ๊ตฌํํ์ ๊ฒ ๊ฐ๋ค์.
๊ตฌํ ๋ฐฉ์์ ์ ๋ต์ ์์ง๋ง ์ ์๊ฐ์ ํ ๋ฒ ๊ณต์ ๋๋ฆฌ๊ณ ์ถ์์ด์๐ |
@@ -0,0 +1,19 @@
+import IDiscountStrategy from './IDiscountStrategy';
+import { DiscountStrategyConstants } from './constants/DiscountStrategyConstants';
+
+export default class WeekdayDiscountStrategy extends IDiscountStrategy {
+ applyDiscount(order, date) {
+ const dayOfWeek = date.getDay();
+ const isWeekda... | JavaScript | `0`, `4`์ ๊ฐ์ ์ซ์๋ฅผ `SUNDAY`, `THURSDAY`์ฒ๋ผ ์์ํํด์ ์ฌ์ฉํ๋ฉด ์ฝ๋ ๊ฐ๋
์ฑ์ ๋ ์ฑ๊ธธ ์ ์์ ๊ฒ ๊ฐ์์! |
@@ -0,0 +1,36 @@
+import { ValidatorConstants } from './constants/ValidatorConstants';
+
+export const InputValidator = {
+ Day: {
+ validateDay(input) {
+ const dayPattern = /^\d+$/;
+ if (!dayPattern.test(input)) {
+ throw new Error(ValidatorConstants.INVALID_DATE_ERROR);
+ }
+ const da... | JavaScript | ๊ฐ๊ฐ์ validation(์ ๊ทํํ์ ํจํด & ๋ฒ์)์ ๋ ๊ฐ์ ํจ์๋ก ๋ถ๋ฆฌํด ์ ์ธํ๊ณ ํธ์ถํด์ ์ฌ์ฉํ๋ ๊ฑด ์ด๋จ๊น์? ์๋ํด์ ํ๊บผ๋ฒ์ ์์ฑํ์ ๊ฒ ๊ฐ์๋ฐ, ๋ง์ฝ ๋ง๋ค๋ฉด ์ด์ ๊ฐ ๊ถ๊ธํด์! |
@@ -0,0 +1,36 @@
+import { ValidatorConstants } from './constants/ValidatorConstants';
+
+export const InputValidator = {
+ Day: {
+ validateDay(input) {
+ const dayPattern = /^\d+$/;
+ if (!dayPattern.test(input)) {
+ throw new Error(ValidatorConstants.INVALID_DATE_ERROR);
+ }
+ const da... | JavaScript | ์ด ๋ก์ง์ด๋ผ๋ฉด ์ด๋ฐ ์
๋ ฅ์ ๋ฃ์ด๋ ์ ์์ ์ผ๋ก ์๋ํ ๊ฒ ๊ฐ์์. ํน์ ๋ค๋ฅธ ๋ถ๋ถ์์ ๊ฒ์ฌํ๊ณ ์๋๋ฐ ์ ๊ฐ ๋์น ๊ฒ์ผ๊น์?
```
๋ฐ๋นํ๋ฆฝ-1,,,,,,,ํํ์ค-2
๋ฐ๋นํ๋ฆฝ-1,,,ํํ์ค-2,,
``` |
@@ -5,6 +5,7 @@
import com.project.Project.domain.interaction.ReviewLike;
import com.project.Project.domain.member.Member;
import com.project.Project.domain.member.RecentMapLocation;
+import com.project.Project.domain.review.Review;
import java.util.List;
import java.util.Optional;
@@ -21,4 +22,9 @@ public inter... | Java | ์ด ๋ฉ์๋๋ฅผ ReviewService๋ก ์ฎ๊ธฐ๋ฉด ์ข์ ๊ฒ ๊ฐ์ต๋๋ค!
๊ฐ๋ง๋ณด๋ ์ด์ ์ ์์ฑํ๋ ์์ getReviewLikeList๋ ์๋ชป ์์นํด ์๋ ๊ฒ ๊ฐ๋ค์ |
@@ -7,6 +7,7 @@
import com.project.Project.domain.interaction.ReviewLike;
import com.project.Project.domain.member.Member;
import com.project.Project.domain.member.RecentMapLocation;
+import com.project.Project.domain.review.Review;
import com.project.Project.repository.interaction.FavoriteRepository;
import com.p... | Java | ๋ง์ฐฌ๊ฐ์ง๋ก ReviewServiceImpl์ชฝ์ผ๋ก ์ฎ๊ธฐ๋ฉด ์ข์ ๊ฒ ๊ฐ์ต๋๋ค! |
@@ -2,6 +2,7 @@
import com.project.Project.domain.member.Member;
import com.project.Project.domain.review.Review;
+import com.querydsl.core.types.dsl.BooleanExpression;
import org.springframework.data.domain.Pageable;
import org.springframework.data.jpa.repository.EntityGraph;
import org.springframework.data.jpa... | Java | ์ด ๋ฉ์๋๋ deleted ํ๋ ์ ์ธํ๋ ๊ฒ ๋ฐ์ํ์๋ฉด ๋ ๊ฒ ๊ฐ์ต๋๋ค! |
@@ -0,0 +1,61 @@
+import axiosInstance from "@/lib/axiosInstance";
+import { useInfiniteQuery } from "@tanstack/react-query";
+
+type Gathering = {
+ teamId: number;
+ id: number;
+ type: "OFFICE_STRETCHING" | "MINDFULNESS" | "WORKATION";
+ name: string;
+ dateTime: string;
+ location: string;
+ image: string;
+... | TypeScript | _:warning: Potential issue_
**์บ์ ํค์ userId๋ฅผ ํฌํจ์์ผ์ฃผ์ธ์.**
ํ์ฌ queryKey๊ฐ ์ฌ์ฉ์๋ณ๋ก ๊ตฌ๋ถ๋์ง ์์ ์บ์ ์ถฉ๋์ด ๋ฐ์ํ ์ ์์ต๋๋ค.
```diff
export const useGetMyReviews = (userId: number) => {
return useInfiniteQuery({
- queryKey: ["my-reviews"],
+ queryKey: ["my-reviews", userId],
queryFn: ({ pageParam }) => fetchMyReviews({ pageP... |
@@ -0,0 +1,83 @@
+import { useGetMyReviews } from "@/app/(common)/mypage/_hooks/useGetMyReviews";
+import ListItem from "@/components/ListItem";
+import Score from "@/components/Score";
+import Spinner from "@/components/Spinner";
+import { useInfiniteScroll } from "@/hooks/useInfiniteScroll";
+import { useUserStore } ... | Unknown | _:warning: Potential issue_
**๋น ์ํ ๋ฉ์์ง๊ฐ ๋ถ์ ํํฉ๋๋ค.**
ํ์ฌ ํ์ด์ง๋ "์์ฑํ ๋ฆฌ๋ทฐ"๋ฅผ ๋ณด์ฌ์ฃผ๋ ๊ณณ์ด๋ฏ๋ก, ๋ฉ์์ง๋ฅผ ๋งฅ๋ฝ์ ๋ง๊ฒ ์์ ํด์ฃผ์ธ์.
```diff
<div className="flex flex-1 items-center justify-center">
- <p>์์ง ์์ฑ ๊ฐ๋ฅํ ๋ฆฌ๋ทฐ๊ฐ ์์ด์</p>
+ <p>์์ง ์์ฑํ ๋ฆฌ๋ทฐ๊ฐ ์์ด์</p>
</div>
```
<!-- suggestion_start -->
<details>
<summary>๐ Committable suggestion</sum... |
@@ -0,0 +1,83 @@
+import { useGetMyReviews } from "@/app/(common)/mypage/_hooks/useGetMyReviews";
+import ListItem from "@/components/ListItem";
+import Score from "@/components/Score";
+import Spinner from "@/components/Spinner";
+import { useInfiniteScroll } from "@/hooks/useInfiniteScroll";
+import { useUserStore } ... | Unknown | _:hammer_and_wrench: Refactor suggestion_
**์ด๋ฏธ์ง์ ์ ๊ทผ์ฑ ์์ฑ์ ์ถ๊ฐํด์ฃผ์ธ์.**
์คํฌ๋ฆฐ ๋ฆฌ๋ ์ฌ์ฉ์๋ฅผ ์ํด ์ด๋ฏธ์ง์ ๋ ์์ธํ ๋์ฒด ํ
์คํธ๋ฅผ ์ ๊ณตํด์ฃผ์ธ์.
```diff
<Image
src={review.Gathering.image}
- alt="๋ชจ์ ์ด๋ฏธ์ง"
+ alt={`${GatheringType[review.Gathering.type]} - ${review.Gathering.name} ๋ชจ์ ์ด๋ฏธ์ง`}
width={280}
height={156}
className="... |
@@ -0,0 +1,83 @@
+import { useGetMyReviews } from "@/app/(common)/mypage/_hooks/useGetMyReviews";
+import ListItem from "@/components/ListItem";
+import Score from "@/components/Score";
+import Spinner from "@/components/Spinner";
+import { useInfiniteScroll } from "@/hooks/useInfiniteScroll";
+import { useUserStore } ... | Unknown | _:warning: Potential issue_
**๋ฉ์์ง๊ฐ ๋ถ์ ์ ํฉ๋๋ค.**
ํ์ฌ ๋ฉ์์ง๊ฐ "์์ฑ ๊ฐ๋ฅํ ๋ฆฌ๋ทฐ๊ฐ ์์ด์"๋ก ๋์ด ์๋๋ฐ, ์ด๋ "์์ฑํ ๋ฆฌ๋ทฐ" ํญ์ ์ปจํ
์คํธ์ ๋ง์ง ์์ต๋๋ค.
```diff
<div className="flex flex-1 items-center justify-center">
- <p>์์ง ์์ฑ ๊ฐ๋ฅํ ๋ฆฌ๋ทฐ๊ฐ ์์ด์</p>
+ <p>์์ง ์์ฑํ ๋ฆฌ๋ทฐ๊ฐ ์์ด์</p>
</div>
```
<!-- suggestion_start -->
<details>
<sum... |
@@ -0,0 +1,83 @@
+import { useGetMyReviews } from "@/app/(common)/mypage/_hooks/useGetMyReviews";
+import ListItem from "@/components/ListItem";
+import Score from "@/components/Score";
+import Spinner from "@/components/Spinner";
+import { useInfiniteScroll } from "@/hooks/useInfiniteScroll";
+import { useUserStore } ... | Unknown | _:hammer_and_wrench: Refactor suggestion_
**ํ์
๋จ์ธ ๋์ ํ์
๊ฐ๋๋ฅผ ์ฌ์ฉํ์ธ์.**
`as number` ํ์
๋จ์ธ ๋์ ํ์
๊ฐ๋๋ฅผ ์ฌ์ฉํ์ฌ ๋ ์์ ํ ํ์
์ฒดํฌ๋ฅผ ๊ตฌํํ์ธ์.
```diff
- const id = useUserStore((state) => state.user?.id) as number;
+ const user = useUserStore((state) => state.user);
+
+ if (!user?.id) {
+ return (
+ <div className="flex fl... |
@@ -27,7 +27,8 @@ import { useGetMyGatherings } from "@/app/(common)/mypage/_hooks/useGetMyGatheri
// isCompleted๊ฐ true, isReviewed๊ฐ true => ๋ฆฌ๋ทฐ ์์ฑ x
export default function MyGatherings() {
const { data, fetchNextPage, hasNextPage, isFetchingNextPage, isLoading, error } = useGetMyGatherings([
- "my-gatherings",... | Unknown | _:hammer_and_wrench: Refactor suggestion_
**์ฟผ๋ฆฌ ํค ๊ตฌ์กฐ์ ์ผ๊ด์ฑ์ด ํ์ํฉ๋๋ค.**
`useLeaveGathering` ํ
์ ์ฟผ๋ฆฌ ํค๊ฐ `["gatherings"]`๋ก ๋์ด์๋๋ฐ, ๋ค๋ฅธ ์ฟผ๋ฆฌ ํค๋ค๊ณผ ์ผ๊ด์ฑ์ ์ ์งํ๊ธฐ ์ํด `["mypage", "gatherings"]`๋ก ๋ณ๊ฒฝํ๋ ๊ฒ์ด ์ข๊ฒ ์ต๋๋ค.
```diff
-const mutation = useLeaveGathering(["gatherings"]);
+const mutation = useLeaveGathering(["mypage", "gatherings"]);
```
... |
@@ -0,0 +1,40 @@
+package com.mybox.domain.storage;
+
+import com.mybox.domain.common.BaseTimeEntity;
+import java.time.LocalDateTime;
+import javax.persistence.Entity;
+import javax.persistence.FetchType;
+import javax.persistence.GeneratedValue;
+import javax.persistence.GenerationType;
+import javax.persistence.Id;
... | Java | `@Enumerated` ๋ถ์ฌ์ฃผ์ค๊บผ์ฃ ? ๐ |
@@ -0,0 +1,40 @@
+package com.mybox.domain.storage;
+
+import com.mybox.domain.common.BaseTimeEntity;
+import java.time.LocalDateTime;
+import javax.persistence.Entity;
+import javax.persistence.FetchType;
+import javax.persistence.GeneratedValue;
+import javax.persistence.GenerationType;
+import javax.persistence.Id;
... | Java | ์ด๊ฑธ ๋์ณค๋ค์;;ใ
ใ
|
@@ -0,0 +1,40 @@
+package com.mybox.domain.storage;
+
+import com.mybox.domain.common.BaseTimeEntity;
+import java.time.LocalDateTime;
+import javax.persistence.Entity;
+import javax.persistence.FetchType;
+import javax.persistence.GeneratedValue;
+import javax.persistence.GenerationType;
+import javax.persistence.Id;
... | Java | ๊ฒจ์ฐ ํ๋ ์ฐพ์์ต๋๋ค๐ |
@@ -0,0 +1,40 @@
+package com.mybox.domain.storage;
+
+import com.mybox.domain.common.BaseTimeEntity;
+import java.time.LocalDateTime;
+import javax.persistence.Entity;
+import javax.persistence.FetchType;
+import javax.persistence.GeneratedValue;
+import javax.persistence.GenerationType;
+import javax.persistence.Id;
... | Java | extension์ ์ด๋ค ๋ณ์ ์ธ๊ฐ์..?! ์ ๋ ํด๋, ํ์ผ ๊ด๋ จ ์ํฐํฐ ์ค๊ณ ์ค์ธ๋ฐ ์นผ๋ผ ์ค์ ์ ์ ๋ง ์ํ์ ๊ฒ ๊ฐ์์ ๊ณ ์ํ์
จ์ต๋๋ค!! ๐ |
@@ -0,0 +1,40 @@
+package com.mybox.domain.storage;
+
+import com.mybox.domain.common.BaseTimeEntity;
+import java.time.LocalDateTime;
+import javax.persistence.Entity;
+import javax.persistence.FetchType;
+import javax.persistence.GeneratedValue;
+import javax.persistence.GenerationType;
+import javax.persistence.Id;
... | Java | ํ์ผ ํ์ฅ์์
๋๋ค! |
@@ -0,0 +1,43 @@
+import { MyGathering } from "@/app/(common)/mypage/types";
+import axiosInstance from "@/lib/axiosInstance";
+import { useInfiniteQuery } from "@tanstack/react-query";
+
+interface FetchMyGatheringsParams {
+ completed?: boolean;
+ reviewed?: boolean;
+}
+
+// ๊ณตํต ๋ฐ์ดํฐ ๊ฐ์ ธ์ค๊ธฐ ํจ์ (sortBy์ sortOrder๋ ๊ณ ์ )
... | TypeScript | _:hammer_and_wrench: Refactor suggestion_
**๋ถํ์ํ try-catch ๋ธ๋ก์ ์ ๊ฑฐํ์ธ์.**
ํ์ฌ try-catch ๋ธ๋ก์ด ์๋ฌ๋ฅผ ๋จ์ํ ๋ค์ throwํ๊ณ ์์ด ๋ถํ์ํฉ๋๋ค.
```diff
- try {
const response = await axiosInstance.get<MyGathering[]>("gatherings/joined", {
params: {
limit: 5,
offset: pageParam,
sortBy: "dateTime",
... |
@@ -0,0 +1,26 @@
+package christmas.config;
+
+import java.util.Arrays;
+
+public enum EventBadge {
+ SANTA("์ฐํ", 20000),
+ TREE("ํธ๋ฆฌ", 10000),
+ STAR("๋ณ", 5000),
+ NONE("์์", 0);
+
+ private final String name;
+ private final int limitPrice;
+
+ EventBadge(String name, int limitPrice) {
+ th... | Java | ์ด ๋ฉ์๋๋ EvenBadge์ ๋ฉค๋ฒ์ ์ ์ธ ์์์ ์์กด์ ์ธ ๊ฒ ๊ฐ์์. ๋ ์ข๊ฒ ๊ฐ์ ํ ๋ฐฉ๋ฒ์ ์์๊น์? |
@@ -0,0 +1,25 @@
+package christmas.config;
+
+public class Message {
+ public static final String INPUT_DATE = "12์ ์ค ์๋น ์์ ๋ฐฉ๋ฌธ ๋ ์ง๋ ์ธ์ ์ธ๊ฐ์? (์ซ์๋ง ์
๋ ฅํด ์ฃผ์ธ์!)";
+ public static final String INPUT_ORDER = "์ฃผ๋ฌธํ์ค ๋ฉ๋ด๋ฅผ ๋ฉ๋ด์ ๊ฐ์๋ฅผ ์๋ ค ์ฃผ์ธ์. (e.g. ํด์ฐ๋ฌผํ์คํ-2,๋ ๋์์ธ-1,์ด์ฝ์ผ์ดํฌ-1)";
+
+ public static final String OUTPUT_VISIT_DATE = "1... | Java | ํ๋ก๊ทธ๋จ ์ ์ญ์์ ์ฌ์ฉํ์ง ์๊ณ Output์์๋ง ์ฌ์ฉํ๋ ๋ณ์๋ ๋ฐ๋ก ํด๋์ค๋ก ๋ง๋ค์ง ์๊ณ Output๊ฐ์ฒด ์์ ์์ ํ๋๋ก ์ ์ธํด๋ ์ข์ ๊ฒ ๊ฐ์์:smile:
์ถ๊ฐ์ ์ผ๋ก Message ์์ ์๋ฌ๋ฉ์์ง์ Output์์ ์ฌ์ฉํ๋ ์์๊ฐ ํผํฉ๋์ด ์์ด์ ๋ถ๋ฆฌํ๋ฉด ๋ ์ข์ ๊ฒ ๊ฐ์๋ฐ ์ด๋ป๊ฒ ์๊ฐํ์๋์? |
@@ -0,0 +1,25 @@
+package christmas.controller;
+
+import christmas.model.Order;
+import christmas.model.VisitDate;
+import christmas.view.InputView;
+
+public class InputController {
+ public static VisitDate setVisitDate() {
+ try {
+ return new VisitDate(InputView.readDate());
+ } catch (... | Java | MVC ํจํด์์ Controller๋ผ๋ฆฌ ์๋ก ์์กดํ๋ ๊ฒ์ ๋ณ๋ก ์ข์ง ์๋ค๊ณ ์๊ณ ์๋๋ฐ InputController๋ฅผ ๋ฐ๋ก ๋ง๋ค๊ณ PromotionController์์ ์ฌ์ฉํ ์ด์ ๊ฐ ๋ฐ๋ก ์์๊น์? |
@@ -0,0 +1,25 @@
+package christmas.controller;
+
+import christmas.model.Order;
+import christmas.model.VisitDate;
+import christmas.view.InputView;
+
+public class InputController {
+ public static VisitDate setVisitDate() {
+ try {
+ return new VisitDate(InputView.readDate());
+ } catch (... | Java | setOrder, setVisitDate ๊ฐ๊ฐ VisitDate, Order ๊ฐ์ฒด๋ฅผ ์์ฑํ๊ณ ์๋ ๊ฒ ๊ฐ์์.
set์ด๋ผ๋ ์ ๋์ด๋ณด๋ค generate๊ฐ ์ข ๋ ์ด์ธ๋ฆฐ๋ค๊ณ ์๊ฐํ๋๋ฐ ์ด๋ ์ ๊ฐ์? |
@@ -0,0 +1,49 @@
+package christmas.controller;
+
+import christmas.config.Constant;
+import christmas.config.EventBadge;
+import christmas.config.Gift;
+import christmas.model.Order;
+import christmas.model.Promotion;
+import christmas.model.PromotionGenerator;
+import christmas.model.VisitDate;
+import christmas.view... | Java | ๋ฉ์๋ ๋ช
์ ๋ช
์ฌ๋ก ํ๋ ๊ฒ์ ๋ณ๋ก ์ข์ง ์์ ๊ฒ ๊ฐ์์ |
@@ -0,0 +1,45 @@
+package christmas.model;
+
+import christmas.config.Event;
+import christmas.config.Gift;
+import christmas.config.Menu;
+
+import java.util.EnumMap;
+import java.util.Map;
+
+public class GiftEvent implements DiscountEventInterface {
+ private final int totalPrice;
+
+ public GiftEvent(int tota... | Java | ์ด๋ฒคํธ๊ฐ ์ ๊ณตํ๋ ๊ณตํต๊ธฐ๋ฅ์ ์ธํฐํ์ด์ค๋ก ์ ๋ฝ์ ๊ฒ ๊ฐ์์:+1: |
@@ -0,0 +1,46 @@
+package christmas.model;
+
+import christmas.config.Menu;
+import christmas.config.MenuType;
+import christmas.util.Util;
+import christmas.util.validator.OrderGenerateAfterValidator;
+import christmas.util.validator.OrderGenerateBeforeValidator;
+
+import java.util.Map;
+import java.util.stream.Colle... | Java | ์ ๋ String ๊ฐ์ ์
๋ ฅ๋ฐ์์ Order ๊ฐ์ฒด์์ ํ์ฑ์ ์งํํ๋๋ฐ ์ด ๋ถ๋ถ์ ๋ฐ๋ก OrderGenerator๋ผ๋ ๊ฐ์ฒด๋ก ๋ถ๋ฆฌํ๋๊น ๋ ์ข์ ๊ฒ ๊ฐ์์:+1: |
@@ -0,0 +1,42 @@
+package christmas.model;
+
+import christmas.config.Event;
+import christmas.util.Util;
+
+import java.util.EnumMap;
+import java.util.Map;
+import java.util.stream.Collectors;
+
+public class Promotion {
+ private final Map<Event, Integer> promotion;
+
+ public Promotion() {
+ promotion ... | Java | Promotion์ด๋ผ๋ ํด๋์ค๋ช
์ ํด๋์ค๋ช
๋ง ๋ณด๊ณ ์ด๋ค ๊ธฐ๋ฅ์ ํ๋์ง ์ถ์ธกํ๊ธฐ ์ด๋ ค์ด ๊ฒ ๊ฐ์์ |
@@ -0,0 +1,42 @@
+package christmas.model;
+
+import christmas.config.Event;
+import christmas.util.Util;
+
+import java.util.EnumMap;
+import java.util.Map;
+import java.util.stream.Collectors;
+
+public class Promotion {
+ private final Map<Event, Integer> promotion;
+
+ public Promotion() {
+ promotion ... | Java | ์ด ํํ ๊ธ์ก์ ๊ตฌํ๋ ๋ฉ์๋์ธ๋ฐ TotalDiscount๋ ์ด ํ ์ธ ๊ธ์ก์ ๊ตฌํ๋ ์๋ฏธ๊ฐ ๋ ๊ฐํ ๊ฒ ๊ฐ์์ ๋ฉ์๋ ์ด๋ฆ์ getTotalBenefitPrice๋ผ๋๊ฐ ๋ค๋ฅธ ์ด๋ฆ์ผ๋ก ๋ฐ๊พธ๋ฉด ๋ ์ข์ ๊ฒ ๊ฐ์์ |
@@ -0,0 +1,42 @@
+package christmas.model;
+
+import christmas.config.Event;
+import christmas.util.Util;
+
+import java.util.EnumMap;
+import java.util.Map;
+import java.util.stream.Collectors;
+
+public class Promotion {
+ private final Map<Event, Integer> promotion;
+
+ public Promotion() {
+ promotion ... | Java | setter๋ฅผ ์ด์ฉํด์ Promotion ๊ฐ์ฒด๊ฐ ๊ฐ์ง ์ํ๋ฅผ ์กฐ์ํ๋ ๊ฒ์ ๋ณ๋ก ๊ฐ์ฒด ์งํฅ์ ์ธ ์ค๊ณ๊ฐ ์๋ ๊ฒ ๊ฐ์์ |
@@ -0,0 +1,49 @@
+package christmas.model;
+
+import christmas.config.MenuType;
+
+public class PromotionGenerator {
+ public static final int DISCOUNT_LIMIT_PRICE = 10000;
+
+ private final Promotion promotion;
+
+ public PromotionGenerator(final VisitDate visitDate, final Order order) {
+ this.promoti... | Java | ์ด๋ฒคํธ ๊ฒฐ๊ณผ๋ฅผ ๊ตฌํ๊ณ ๊ทธ ๊ฒฐ๊ณผ๋ก Promotionํด๋์ค๋ฅผ ์์ฑํ๋ ์ญํ ์ ํ๋ ๊ฒ ๊ฐ๊ตฐ์.
์ ๋ Promotion์ ๊ตณ์ด ์์ฑํ์ง ์๊ณ ์ด ํด๋์ค์์ ๊ด๋ฆฌํ๋๊ฒ ๋ ์ข๋ค๊ณ ์๊ฐํ๋๋ฐ ์ด๋ ๊ฒ ์ค๊ณํ์ ์ด์ ๊ฐ ์์๊น์? |
@@ -0,0 +1,49 @@
+package christmas.model;
+
+import christmas.config.MenuType;
+
+public class PromotionGenerator {
+ public static final int DISCOUNT_LIMIT_PRICE = 10000;
+
+ private final Promotion promotion;
+
+ public PromotionGenerator(final VisitDate visitDate, final Order order) {
+ this.promoti... | Java | 26๋ฒ ๋ผ์ธ ๋ถํฐ 44๋ฒ ๋ผ์ธ์ ๊ฐ๊ฐ์ ์ด๋ฒคํธ๋ฅผ ์ ์ฉํ๊ณ ํํ ๊ธ์ก์ promotion๊ฐ์ฒด์ set ํด์ฃผ๋ ๊ฒ ๊ฐ์๋ฐ ์ด๋ถ๋ถ์ ์กฐ๊ธ ๋ ๊ฐ๋ตํ ํ ์ ์์ง ์์๊น์? |
@@ -0,0 +1,49 @@
+package christmas.controller;
+
+import christmas.config.Constant;
+import christmas.config.EventBadge;
+import christmas.config.Gift;
+import christmas.model.Order;
+import christmas.model.Promotion;
+import christmas.model.PromotionGenerator;
+import christmas.model.VisitDate;
+import christmas.view... | Java | ์ผ๋ฐ ์ ์ผ๋ก Controller์์๋ ๋์๋ง ์ ์ํ์ง ์ํ๋ ์ ์ํ์ง ์๋ ๊ฑธ๋ก ์๊ณ ์๋๋ฐ, PromotionController๋ Controller๋ณด๋ค๋ ๋๋ฉ์ธ์ค๋ฌ์ด(?)๊ฒ ๊ฐ์์ |
@@ -0,0 +1,26 @@
+package christmas.config;
+
+import java.util.Arrays;
+
+public enum EventBadge {
+ SANTA("์ฐํ", 20000),
+ TREE("ํธ๋ฆฌ", 10000),
+ STAR("๋ณ", 5000),
+ NONE("์์", 0);
+
+ private final String name;
+ private final int limitPrice;
+
+ EventBadge(String name, int limitPrice) {
+ th... | Java | ๋ฐ๊ตด์ด๋ ์ฝ๋ ๋ณด๊ณ ์๊ฒ๋์์ง๋ง Predicate ๋ฅผ ์ด์ฉํด์ ์กฐ๊ฑด์ ๊ฑธ์ด์ฃผ๋ฉด ์ข์์ ๊ฒ ๊ฐ์ต๋๋ค
ํจ์ํ ์ธํฐํ์ด์ค์ ๋ํ ๊ณต๋ถ๋ฅผ ํด์ผ๊ฒ ๋ค์! |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.