From 71c340395fa0a89e07242302bc7cbe94786a3ef6 Mon Sep 17 00:00:00 2001 From: yujeongkwon <87534067+yujeongkwon@users.noreply.github.com> Date: Sun, 26 Nov 2023 11:00:20 +0900 Subject: [PATCH 01/13] init --- .idea/.gitignore | 8 +++ .idea/misc.xml | 9 ++++ .idea/modules.xml | 8 +++ .idea/uiDesigner.xml | 124 +++++++++++++++++++++++++++++++++++++++++++ .idea/vcs.xml | 6 +++ src/Application.java | 5 ++ vending-machine.iml | 14 +++++ 7 files changed, 174 insertions(+) create mode 100644 .idea/.gitignore create mode 100644 .idea/misc.xml create mode 100644 .idea/modules.xml create mode 100644 .idea/uiDesigner.xml create mode 100644 .idea/vcs.xml create mode 100644 src/Application.java create mode 100644 vending-machine.iml diff --git a/.idea/.gitignore b/.idea/.gitignore new file mode 100644 index 0000000..c3f502a --- /dev/null +++ b/.idea/.gitignore @@ -0,0 +1,8 @@ +# 디폴트 무시된 파일 +/shelf/ +/workspace.xml +# 에디터 기반 HTTP 클라이언트 요청 +/httpRequests/ +# Datasource local storage ignored files +/dataSources/ +/dataSources.local.xml diff --git a/.idea/misc.xml b/.idea/misc.xml new file mode 100644 index 0000000..29cba1f --- /dev/null +++ b/.idea/misc.xml @@ -0,0 +1,9 @@ + + + + + + + + \ No newline at end of file diff --git a/.idea/modules.xml b/.idea/modules.xml new file mode 100644 index 0000000..ece9f84 --- /dev/null +++ b/.idea/modules.xml @@ -0,0 +1,8 @@ + + + + + + + + \ No newline at end of file diff --git a/.idea/uiDesigner.xml b/.idea/uiDesigner.xml new file mode 100644 index 0000000..2b63946 --- /dev/null +++ b/.idea/uiDesigner.xml @@ -0,0 +1,124 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/.idea/vcs.xml b/.idea/vcs.xml new file mode 100644 index 0000000..94a25f7 --- /dev/null +++ b/.idea/vcs.xml @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file diff --git a/src/Application.java b/src/Application.java new file mode 100644 index 0000000..2e03025 --- /dev/null +++ b/src/Application.java @@ -0,0 +1,5 @@ +public class Application { + public static void main(String[] args) { + System.out.println("Hello world!"); + } + } \ No newline at end of file diff --git a/vending-machine.iml b/vending-machine.iml new file mode 100644 index 0000000..74e6d75 --- /dev/null +++ b/vending-machine.iml @@ -0,0 +1,14 @@ + + + + + + + + + + + + + \ No newline at end of file From 64e94189f369ffab9f9c334a34f9e4570a84ecf7 Mon Sep 17 00:00:00 2001 From: yujeongkwon <87534067+yujeongkwon@users.noreply.github.com> Date: Sun, 26 Nov 2023 11:21:12 +0900 Subject: [PATCH 02/13] =?UTF-8?q?docs=20:=20=EA=B8=B0=EB=8A=A5=20=EB=AA=A9?= =?UTF-8?q?=EB=A1=9D=20=EC=B6=94=EA=B0=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/docs/README.md | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) create mode 100644 src/docs/README.md diff --git a/src/docs/README.md b/src/docs/README.md new file mode 100644 index 0000000..1b6e2e0 --- /dev/null +++ b/src/docs/README.md @@ -0,0 +1,28 @@ +## 입/출력 +- [ ] 음료 자판기 시작 안내 출력 +- [ ] 진행 위한 입력 안내 출력 +- [ ] 진행 위한 입력 받기 +- [ ] 차가운/따뜻한 음료 택1 안내 출력 +- [ ] 차가운/따뜻한 음료 택1 입력 받기 +- [ ] 위에서 선택한 음료 메뉴 출력 +- [ ] 사용자의 구매 음료 입렫 받기 +- [ ] 결제 방식 출력 +- [ ] 사용자의 결제 방식 입력 받기 +- 카드 결제시 + - [ ] continue +- 현금 결제시 + - [ ] 현금 투입 출력 + - [ ] 음료 메뉴 가격에 따라 반복 + - [ ] 현금 투입 입력 받기 + - [ ] 투입 금액 출력 +- [ ] 이용 감사 안내 출력 +- [ ] 주문 음료 출력 +- [ ] 잔돈 출력 +- +## 자판기 +- [ ] 음료 메뉴 +- [ ] 현금 결제만 가능 + - [ ] 거스름 돈 반환 + - [ ] 돈을 잘못 넣은 경우를 위해 반환 기능 +- [ ] 카드 결제 추가 + - [ ] 10% 부가세 추가 결제 \ No newline at end of file From e9e2dce82f00a80d865a5af41d79c976f0afed87 Mon Sep 17 00:00:00 2001 From: yujeongkwon <87534067+yujeongkwon@users.noreply.github.com> Date: Sun, 26 Nov 2023 11:28:55 +0900 Subject: [PATCH 03/13] =?UTF-8?q?feat(OutputView)=20:=20=EC=9D=8C=EB=A3=8C?= =?UTF-8?q?=20=EC=9E=90=ED=8C=90=EA=B8=B0=20=EC=8B=9C=EC=9E=91=20=EC=95=88?= =?UTF-8?q?=EB=82=B4=20=EC=B6=9C=EB=A0=A5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- {src/docs => docs}/README.md | 2 +- src/Application.java | 8 +++++--- src/controller/VendingMachineController.java | 13 +++++++++++++ src/view/OutputView.java | 13 +++++++++++++ 4 files changed, 32 insertions(+), 4 deletions(-) rename {src/docs => docs}/README.md (95%) create mode 100644 src/controller/VendingMachineController.java create mode 100644 src/view/OutputView.java diff --git a/src/docs/README.md b/docs/README.md similarity index 95% rename from src/docs/README.md rename to docs/README.md index 1b6e2e0..324f2e0 100644 --- a/src/docs/README.md +++ b/docs/README.md @@ -1,5 +1,5 @@ ## 입/출력 -- [ ] 음료 자판기 시작 안내 출력 +- [x] 음료 자판기 시작 안내 출력 - [ ] 진행 위한 입력 안내 출력 - [ ] 진행 위한 입력 받기 - [ ] 차가운/따뜻한 음료 택1 안내 출력 diff --git a/src/Application.java b/src/Application.java index 2e03025..d274fed 100644 --- a/src/Application.java +++ b/src/Application.java @@ -1,5 +1,7 @@ +import controller.VendingMachineController; + public class Application { public static void main(String[] args) { - System.out.println("Hello world!"); - } - } \ No newline at end of file + new VendingMachineController().start(); + } +} \ No newline at end of file diff --git a/src/controller/VendingMachineController.java b/src/controller/VendingMachineController.java new file mode 100644 index 0000000..f0fc18f --- /dev/null +++ b/src/controller/VendingMachineController.java @@ -0,0 +1,13 @@ +package controller; + +import view.OutputView; + +public class VendingMachineController { + public void start() { + set(); + } + + private void set() { + OutputView.printWelcomeMessage(); + } +} diff --git a/src/view/OutputView.java b/src/view/OutputView.java new file mode 100644 index 0000000..f1c51d0 --- /dev/null +++ b/src/view/OutputView.java @@ -0,0 +1,13 @@ +package view; + +public class OutputView { + + public static void printException(Exception exception) { + System.out.println(exception.getMessage()); + } + + public static void printWelcomeMessage() { + System.out.println("[어서와요! GDSC 음료 자판기]"); + } + +} From 839516f50b4466c0cb99ef9c6abc44f4a887fea1 Mon Sep 17 00:00:00 2001 From: yujeongkwon <87534067+yujeongkwon@users.noreply.github.com> Date: Sun, 26 Nov 2023 11:47:27 +0900 Subject: [PATCH 04/13] =?UTF-8?q?feat(Options)=20:=20=EC=9D=8C=EB=A3=8C=20?= =?UTF-8?q?=EB=A9=94=EB=89=B4=20=EA=B8=B0=EC=88=A0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- docs/README.md | 2 +- src/domain/Beverage.java | 4 ++++ src/domain/Options.java | 47 ++++++++++++++++++++++++++++++++++++++++ 3 files changed, 52 insertions(+), 1 deletion(-) create mode 100644 src/domain/Beverage.java create mode 100644 src/domain/Options.java diff --git a/docs/README.md b/docs/README.md index 324f2e0..502c66d 100644 --- a/docs/README.md +++ b/docs/README.md @@ -20,7 +20,7 @@ - [ ] 잔돈 출력 - ## 자판기 -- [ ] 음료 메뉴 +- [x] 음료 메뉴 - [ ] 현금 결제만 가능 - [ ] 거스름 돈 반환 - [ ] 돈을 잘못 넣은 경우를 위해 반환 기능 diff --git a/src/domain/Beverage.java b/src/domain/Beverage.java new file mode 100644 index 0000000..d7398f9 --- /dev/null +++ b/src/domain/Beverage.java @@ -0,0 +1,4 @@ +package domain; + +public record Beverage(String name, int price) { +} diff --git a/src/domain/Options.java b/src/domain/Options.java new file mode 100644 index 0000000..f1634b4 --- /dev/null +++ b/src/domain/Options.java @@ -0,0 +1,47 @@ +package domain; + +import java.awt.*; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +public enum Options { + COLD("차가운 음료",List.of( + new Beverage("스프라이트 ", 1500), + new Beverage("코카콜라", 1300), + new Beverage("솔의눈 ", 1000), + new Beverage("펩시 콜라 ", 1100) + )), + HOT("따뜻한 음료", List.of( + new Beverage("TOP커피", 1800), + new Beverage("꿀물", 1500), + new Beverage("홍삼차 ", 1700), + new Beverage("단팥죽 ", 2100) + )); + + private static final Map beverageToOptions = new HashMap<>(); + + static { + for (Options menu : Options.values()) { + for (Beverage food : menu.beverages) { + beverageToOptions.put(food.name(), menu); + } + } + } + + private final String options; + private final List beverages; + + Options(String options, List beverages) { + this.options = options; + this.beverages = beverages; + } + + public String getOptions() { + return options; + } + + public List getBeverages() { + return beverages; + } +} From 025ceb73dbb18bea3df778edae42d32b5bfbfa21 Mon Sep 17 00:00:00 2001 From: yujeongkwon <87534067+yujeongkwon@users.noreply.github.com> Date: Sun, 26 Nov 2023 11:57:58 +0900 Subject: [PATCH 05/13] =?UTF-8?q?feat(Options)=20:=20=EC=9D=8C=EB=A3=8C=20?= =?UTF-8?q?=EB=A9=94=EB=89=B4=20=EA=B8=B0=EC=88=A0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/main/view/OutputView.java | 24 ++++++++++++++++++++++++ src/view/OutputView.java | 13 ------------- 2 files changed, 24 insertions(+), 13 deletions(-) create mode 100644 src/main/view/OutputView.java delete mode 100644 src/view/OutputView.java diff --git a/src/main/view/OutputView.java b/src/main/view/OutputView.java new file mode 100644 index 0000000..36eae5e --- /dev/null +++ b/src/main/view/OutputView.java @@ -0,0 +1,24 @@ +package main.view; + +import main.domain.Options; + +public class OutputView { + + public static void printException(Exception exception) { + System.out.println(exception.getMessage()); + } + + public static void printWelcomeMessage() { + System.out.println("[어서와요! GDSC 음료 자판기]"); + } + + public static void printOptionsSelection() { + System.out.println("음료를 선택 해주세요!"); + } + + public static void printOptions() { + for (Options option : Options.values()) { + System.out.println("[" + (option.ordinal() + 1) + "] " + option.getOptions()); + } + } +} diff --git a/src/view/OutputView.java b/src/view/OutputView.java deleted file mode 100644 index f1c51d0..0000000 --- a/src/view/OutputView.java +++ /dev/null @@ -1,13 +0,0 @@ -package view; - -public class OutputView { - - public static void printException(Exception exception) { - System.out.println(exception.getMessage()); - } - - public static void printWelcomeMessage() { - System.out.println("[어서와요! GDSC 음료 자판기]"); - } - -} From 6eb3ead2be1fce421c660887768a75558c28c3ae Mon Sep 17 00:00:00 2001 From: yujeongkwon <87534067+yujeongkwon@users.noreply.github.com> Date: Sun, 26 Nov 2023 11:59:18 +0900 Subject: [PATCH 06/13] =?UTF-8?q?move()=20:=20mian=EA=B3=BC=20test?= =?UTF-8?q?=ED=8C=A8=ED=82=A4=EC=A7=80=20=EA=B5=AC=EB=B6=84?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- docs/README.md | 3 +-- src/Application.java | 2 +- .../controller/VendingMachineController.java | 4 +-- src/{ => main}/domain/Beverage.java | 2 +- src/{ => main}/domain/Options.java | 3 +-- vending-machine.iml | 26 +++++++++++++++++++ 6 files changed, 32 insertions(+), 8 deletions(-) rename src/{ => main}/controller/VendingMachineController.java (75%) rename src/{ => main}/domain/Beverage.java (71%) rename src/{ => main}/domain/Options.java (97%) diff --git a/docs/README.md b/docs/README.md index 502c66d..f744766 100644 --- a/docs/README.md +++ b/docs/README.md @@ -1,8 +1,7 @@ ## 입/출력 - [x] 음료 자판기 시작 안내 출력 -- [ ] 진행 위한 입력 안내 출력 - [ ] 진행 위한 입력 받기 -- [ ] 차가운/따뜻한 음료 택1 안내 출력 +- [x] 차가운/따뜻한 음료 택1 안내 출력 - [ ] 차가운/따뜻한 음료 택1 입력 받기 - [ ] 위에서 선택한 음료 메뉴 출력 - [ ] 사용자의 구매 음료 입렫 받기 diff --git a/src/Application.java b/src/Application.java index d274fed..36415ce 100644 --- a/src/Application.java +++ b/src/Application.java @@ -1,4 +1,4 @@ -import controller.VendingMachineController; +import main.controller.VendingMachineController; public class Application { public static void main(String[] args) { diff --git a/src/controller/VendingMachineController.java b/src/main/controller/VendingMachineController.java similarity index 75% rename from src/controller/VendingMachineController.java rename to src/main/controller/VendingMachineController.java index f0fc18f..4d81703 100644 --- a/src/controller/VendingMachineController.java +++ b/src/main/controller/VendingMachineController.java @@ -1,6 +1,6 @@ -package controller; +package main.controller; -import view.OutputView; +import main.view.OutputView; public class VendingMachineController { public void start() { diff --git a/src/domain/Beverage.java b/src/main/domain/Beverage.java similarity index 71% rename from src/domain/Beverage.java rename to src/main/domain/Beverage.java index d7398f9..1b7bff0 100644 --- a/src/domain/Beverage.java +++ b/src/main/domain/Beverage.java @@ -1,4 +1,4 @@ -package domain; +package main.domain; public record Beverage(String name, int price) { } diff --git a/src/domain/Options.java b/src/main/domain/Options.java similarity index 97% rename from src/domain/Options.java rename to src/main/domain/Options.java index f1634b4..60c16a0 100644 --- a/src/domain/Options.java +++ b/src/main/domain/Options.java @@ -1,6 +1,5 @@ -package domain; +package main.domain; -import java.awt.*; import java.util.HashMap; import java.util.List; import java.util.Map; diff --git a/vending-machine.iml b/vending-machine.iml index 74e6d75..b054cc0 100644 --- a/vending-machine.iml +++ b/vending-machine.iml @@ -7,6 +7,32 @@ + + + + + + + + + + + + + + + + + + + + + + + + + +