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 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
From d88b949c8c5cbd866b03ecf7fc228e20df071a0b Mon Sep 17 00:00:00 2001
From: yujeongkwon <87534067+yujeongkwon@users.noreply.github.com>
Date: Sun, 26 Nov 2023 12:12:10 +0900
Subject: [PATCH 07/13] =?UTF-8?q?feat()=20:=20=EC=84=A0=ED=83=9D=ED=95=9C?=
=?UTF-8?q?=20=EC=98=B5=EC=85=98=EC=9D=98=20=EC=9D=8C=EB=A3=8C=EB=93=A4=20?=
=?UTF-8?q?=EC=B6=9C=EB=A0=A5?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
docs/README.md | 2 +-
src/main/view/OutputView.java | 23 +++++++++++++++++++++++
2 files changed, 24 insertions(+), 1 deletion(-)
diff --git a/docs/README.md b/docs/README.md
index f744766..b4acbd7 100644
--- a/docs/README.md
+++ b/docs/README.md
@@ -3,7 +3,7 @@
- [ ] 진행 위한 입력 받기
- [x] 차가운/따뜻한 음료 택1 안내 출력
- [ ] 차가운/따뜻한 음료 택1 입력 받기
-- [ ] 위에서 선택한 음료 메뉴 출력
+- [x] 위에서 선택한 음료 메뉴 출력
- [ ] 사용자의 구매 음료 입렫 받기
- [ ] 결제 방식 출력
- [ ] 사용자의 결제 방식 입력 받기
diff --git a/src/main/view/OutputView.java b/src/main/view/OutputView.java
index 36eae5e..9b065b5 100644
--- a/src/main/view/OutputView.java
+++ b/src/main/view/OutputView.java
@@ -1,7 +1,10 @@
package main.view;
+import main.domain.Beverage;
import main.domain.Options;
+import java.util.List;
+
public class OutputView {
public static void printException(Exception exception) {
@@ -21,4 +24,24 @@ public static void printOptions() {
System.out.println("[" + (option.ordinal() + 1) + "] " + option.getOptions());
}
}
+
+ public void printBeverages(int optionNumber) {
+ Options selectedOption = getOptionByNumber(optionNumber);
+
+ List beverages = selectedOption.getBeverages();
+
+ for (int i = 0; i < beverages.size(); i++) {
+ Beverage beverage = beverages.get(i);
+ System.out.printf("[%d] %s : %d원\n", i + 1, beverage.name(), beverage.price());
+ }
+ }
+
+ private Options getOptionByNumber(int optionNumber) {
+ return Options.values()[optionNumber - 1];
+ }
+
+
+ public void lineClassification() {
+ System.out.println("------------------------------");
+ }
}
From ad75ab6cd0df8fc202626537532a6ab4979148f2 Mon Sep 17 00:00:00 2001
From: yujeongkwon <87534067+yujeongkwon@users.noreply.github.com>
Date: Sun, 26 Nov 2023 13:19:40 +0900
Subject: [PATCH 08/13] =?UTF-8?q?feat()=20:=20=ED=98=84=EA=B8=88=20?=
=?UTF-8?q?=ED=88=AC=EC=9E=85=20=EC=B6=9C=EB=A0=A5?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
docs/README.md | 2 +-
src/main/domain/CashDenomination.java | 26 ++++++++++++++++++++++++++
src/main/view/OutputView.java | 8 ++++++++
3 files changed, 35 insertions(+), 1 deletion(-)
create mode 100644 src/main/domain/CashDenomination.java
diff --git a/docs/README.md b/docs/README.md
index b4acbd7..e994c60 100644
--- a/docs/README.md
+++ b/docs/README.md
@@ -10,7 +10,7 @@
- 카드 결제시
- [ ] continue
- 현금 결제시
- - [ ] 현금 투입 출력
+ - [x] 현금 투입 출력
- [ ] 음료 메뉴 가격에 따라 반복
- [ ] 현금 투입 입력 받기
- [ ] 투입 금액 출력
diff --git a/src/main/domain/CashDenomination.java b/src/main/domain/CashDenomination.java
new file mode 100644
index 0000000..6890fcd
--- /dev/null
+++ b/src/main/domain/CashDenomination.java
@@ -0,0 +1,26 @@
+package main.domain;
+
+public enum CashDenomination {
+ FIFTY_THOUSAND_WON(1, 50000),
+ TEN_THOUSAND_WON(2, 10000),
+ FIVE_THOUSAND_WON(3, 5000),
+ ONE_THOUSAND_WON(4, 1000),
+ FIVE_HUNDRED_WON(5, 500),
+ ONE_HUNDRED_WON(6, 100);
+
+ private final int option;
+ private final int value;
+
+ CashDenomination(int option, int value) {
+ this.option = option;
+ this.value = value;
+ }
+
+ public int getOption() {
+ return option;
+ }
+
+ public int getValue() {
+ return value;
+ }
+}
\ No newline at end of file
diff --git a/src/main/view/OutputView.java b/src/main/view/OutputView.java
index 9b065b5..6652e63 100644
--- a/src/main/view/OutputView.java
+++ b/src/main/view/OutputView.java
@@ -1,6 +1,7 @@
package main.view;
import main.domain.Beverage;
+import main.domain.CashDenomination;
import main.domain.Options;
import java.util.List;
@@ -36,6 +37,13 @@ public void printBeverages(int optionNumber) {
}
}
+ public void printCashDenomination() {
+ for (CashDenomination denomination : CashDenomination.values()) {
+ System.out.println("[" + denomination.getOption() + "] " + denomination.getValue() + "원");
+ }
+ System.out.println("[0] 반환");
+ }
+
private Options getOptionByNumber(int optionNumber) {
return Options.values()[optionNumber - 1];
}
From 4f5d42ba3f65396c05cb152fd9f985a734a31dc6 Mon Sep 17 00:00:00 2001
From: yujeongkwon <87534067+yujeongkwon@users.noreply.github.com>
Date: Sun, 26 Nov 2023 13:29:09 +0900
Subject: [PATCH 09/13] =?UTF-8?q?feat()=20:=20=ED=98=84=EA=B8=88=20?=
=?UTF-8?q?=ED=88=AC=EC=9E=85=20=EC=9E=85=EB=A0=A5=20=EB=B0=9B=EA=B8=B0?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
docs/README.md | 2 +-
src/main/domain/Cash.java | 17 +++++++++++++++++
2 files changed, 18 insertions(+), 1 deletion(-)
create mode 100644 src/main/domain/Cash.java
diff --git a/docs/README.md b/docs/README.md
index e994c60..73467cb 100644
--- a/docs/README.md
+++ b/docs/README.md
@@ -12,7 +12,7 @@
- 현금 결제시
- [x] 현금 투입 출력
- [ ] 음료 메뉴 가격에 따라 반복
- - [ ] 현금 투입 입력 받기
+ - [x] 현금 투입 입력 받기
- [ ] 투입 금액 출력
- [ ] 이용 감사 안내 출력
- [ ] 주문 음료 출력
diff --git a/src/main/domain/Cash.java b/src/main/domain/Cash.java
new file mode 100644
index 0000000..6df7c34
--- /dev/null
+++ b/src/main/domain/Cash.java
@@ -0,0 +1,17 @@
+package main.domain;
+
+import java.util.Arrays;
+
+public class Cash implements Payment{
+ private int cashInput = 0;
+
+ public void injectionCash(int inputOption) {
+ Arrays.stream(CashDenomination.values())
+ .filter(denomination -> denomination.getOption() == inputOption)
+ .forEach(denomination -> cashInput += denomination.getValue());
+ }
+
+ private int calculateChange(int price) {
+ return price - cashInput;
+ }
+}
From 1b97314aa597f4547e77138dd03a086354822b2d Mon Sep 17 00:00:00 2001
From: yujeongkwon <87534067+yujeongkwon@users.noreply.github.com>
Date: Sun, 26 Nov 2023 13:30:00 +0900
Subject: [PATCH 10/13] =?UTF-8?q?feat()=20:=20=ED=98=84=EA=B8=88=20?=
=?UTF-8?q?=ED=88=AC=EC=9E=85=20=EC=9E=85=EB=A0=A5=20=EB=B0=9B=EA=B8=B0?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
docs/README.md | 4 ++--
src/main/domain/Payment.java | 4 ++++
2 files changed, 6 insertions(+), 2 deletions(-)
create mode 100644 src/main/domain/Payment.java
diff --git a/docs/README.md b/docs/README.md
index 73467cb..8366c22 100644
--- a/docs/README.md
+++ b/docs/README.md
@@ -21,7 +21,7 @@
## 자판기
- [x] 음료 메뉴
- [ ] 현금 결제만 가능
- - [ ] 거스름 돈 반환
+ - [x] 거스름 돈 반환
- [ ] 돈을 잘못 넣은 경우를 위해 반환 기능
- [ ] 카드 결제 추가
- - [ ] 10% 부가세 추가 결제
\ No newline at end of file
+ - [x] 10% 부가세 추가 결제
\ No newline at end of file
diff --git a/src/main/domain/Payment.java b/src/main/domain/Payment.java
new file mode 100644
index 0000000..05e1043
--- /dev/null
+++ b/src/main/domain/Payment.java
@@ -0,0 +1,4 @@
+package main.domain;
+
+public interface Payment {
+}
From 5dbccef6f16059d0ec256ccbf54f6340a7e0d3be Mon Sep 17 00:00:00 2001
From: yujeongkwon <87534067+yujeongkwon@users.noreply.github.com>
Date: Sun, 26 Nov 2023 13:31:22 +0900
Subject: [PATCH 11/13] =?UTF-8?q?feat()=20:=2010%=20=EB=B6=80=EA=B0=80?=
=?UTF-8?q?=EC=84=B8=20=EC=B6=94=EA=B0=80=20=EA=B2=B0=EC=A0=9C?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
src/main/domain/Credit.java | 14 ++++++++++++++
1 file changed, 14 insertions(+)
create mode 100644 src/main/domain/Credit.java
diff --git a/src/main/domain/Credit.java b/src/main/domain/Credit.java
new file mode 100644
index 0000000..6fdc3de
--- /dev/null
+++ b/src/main/domain/Credit.java
@@ -0,0 +1,14 @@
+package main.domain;
+
+public class Credit {
+ private final double FEE = 0.1;
+ private final int amount;
+
+ public Credit(int price) {
+ this.amount = price;
+ }
+
+ public int getPaymentAmount() {
+ return (int) (amount + amount * FEE);
+ }
+}
From 6ed77e9ab991979f071b5423eabe1981aa8bad4d Mon Sep 17 00:00:00 2001
From: yujeongkwon <87534067+yujeongkwon@users.noreply.github.com>
Date: Sun, 26 Nov 2023 13:47:21 +0900
Subject: [PATCH 12/13] =?UTF-8?q?feat()=20:=20=EC=9E=85=EC=B6=9C=EB=A0=A5?=
=?UTF-8?q?=20=EC=B6=94=EA=B0=80?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
docs/README.md | 10 +++++-----
src/main/view/InputView.java | 26 ++++++++++++++++++++++++++
src/main/view/OutputView.java | 14 +++++++++++++-
3 files changed, 44 insertions(+), 6 deletions(-)
create mode 100644 src/main/view/InputView.java
diff --git a/docs/README.md b/docs/README.md
index 8366c22..7579af0 100644
--- a/docs/README.md
+++ b/docs/README.md
@@ -1,12 +1,12 @@
## 입/출력
- [x] 음료 자판기 시작 안내 출력
-- [ ] 진행 위한 입력 받기
+- [x] 진행 위한 입력 받기
- [x] 차가운/따뜻한 음료 택1 안내 출력
-- [ ] 차가운/따뜻한 음료 택1 입력 받기
+- [x] 차가운/따뜻한 음료 택1 입력 받기
- [x] 위에서 선택한 음료 메뉴 출력
-- [ ] 사용자의 구매 음료 입렫 받기
-- [ ] 결제 방식 출력
-- [ ] 사용자의 결제 방식 입력 받기
+- [x] 사용자의 구매 음료 입렫 받기
+- [x] 결제 방식 출력
+- [x] 사용자의 결제 방식 입력 받기
- 카드 결제시
- [ ] continue
- 현금 결제시
diff --git a/src/main/view/InputView.java b/src/main/view/InputView.java
new file mode 100644
index 0000000..8e5f0f3
--- /dev/null
+++ b/src/main/view/InputView.java
@@ -0,0 +1,26 @@
+package main.view;
+
+import java.util.Scanner;
+
+public class InputView {
+ private static final Scanner scanner = new Scanner(System.in);
+
+ public static int readBeverageOption(Scanner scanner) {
+ System.out.println("계속 하려면 아무키나 입력하세요 ...");
+ System.out.print("사용자 입력 >");
+ return scanner.nextInt();
+ }
+
+ public static int readBeverageNumber(Scanner scanner) {
+ System.out.print("사용자 입력 >");
+ return scanner.nextInt();
+ }
+
+ public static int getPaymentOption(Scanner scanner) {
+ return scanner.nextInt();
+ }
+
+ public static int getCashOption(Scanner scanner) {
+ return scanner.nextInt();
+ }
+}
\ No newline at end of file
diff --git a/src/main/view/OutputView.java b/src/main/view/OutputView.java
index 6652e63..e571949 100644
--- a/src/main/view/OutputView.java
+++ b/src/main/view/OutputView.java
@@ -21,9 +21,14 @@ public static void printOptionsSelection() {
}
public static void printOptions() {
+ System.out.println("음료를 선택 해주세요!");
+ System.out.println();
+
for (Options option : Options.values()) {
System.out.println("[" + (option.ordinal() + 1) + "] " + option.getOptions());
}
+
+ System.out.println();
}
public void printBeverages(int optionNumber) {
@@ -38,6 +43,7 @@ public void printBeverages(int optionNumber) {
}
public void printCashDenomination() {
+
for (CashDenomination denomination : CashDenomination.values()) {
System.out.println("[" + denomination.getOption() + "] " + denomination.getValue() + "원");
}
@@ -48,8 +54,14 @@ private Options getOptionByNumber(int optionNumber) {
return Options.values()[optionNumber - 1];
}
+ public static void printPaymentOptions() {
+ lineClassification();
+ System.out.println("[결제 방식 선택]\n");
+ System.out.println("[1] 현금");
+ System.out.println("[2] 카드 (부가세 10% 적용)");
+ }
- public void lineClassification() {
+ public static void lineClassification() {
System.out.println("------------------------------");
}
}
From 8784df47c63091cd286698df4d187114d2a71136 Mon Sep 17 00:00:00 2001
From: yujeongkwon <87534067+yujeongkwon@users.noreply.github.com>
Date: Sun, 26 Nov 2023 14:01:17 +0900
Subject: [PATCH 13/13] =?UTF-8?q?add()=20:=20=EC=B6=9C=EB=A0=A5=20?=
=?UTF-8?q?=EB=B0=8F=20=EC=98=B5=EC=85=98=20=EC=84=A0=ED=83=9D=20=EB=A9=94?=
=?UTF-8?q?=EC=86=8C=EB=93=9C=20=EC=B6=94=EA=B0=80?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
src/main/domain/Options.java | 4 ++++
src/main/view/InputView.java | 6 +++++-
src/main/view/OutputView.java | 1 +
3 files changed, 10 insertions(+), 1 deletion(-)
diff --git a/src/main/domain/Options.java b/src/main/domain/Options.java
index 60c16a0..00b1107 100644
--- a/src/main/domain/Options.java
+++ b/src/main/domain/Options.java
@@ -36,6 +36,10 @@ public enum Options {
this.beverages = beverages;
}
+ public static Options getUserSelectedOption(int userInput) {
+ return Options.values()[userInput - 1];
+ }
+
public String getOptions() {
return options;
}
diff --git a/src/main/view/InputView.java b/src/main/view/InputView.java
index 8e5f0f3..9498a1f 100644
--- a/src/main/view/InputView.java
+++ b/src/main/view/InputView.java
@@ -5,8 +5,12 @@
public class InputView {
private static final Scanner scanner = new Scanner(System.in);
- public static int readBeverageOption(Scanner scanner) {
+ public static String readContinueStatus(Scanner scanner) {
System.out.println("계속 하려면 아무키나 입력하세요 ...");
+ return scanner.nextLine();
+ }
+
+ public static int readBeverageOption(Scanner scanner) {
System.out.print("사용자 입력 >");
return scanner.nextInt();
}
diff --git a/src/main/view/OutputView.java b/src/main/view/OutputView.java
index e571949..5d3c4e4 100644
--- a/src/main/view/OutputView.java
+++ b/src/main/view/OutputView.java
@@ -14,6 +14,7 @@ public static void printException(Exception exception) {
public static void printWelcomeMessage() {
System.out.println("[어서와요! GDSC 음료 자판기]");
+ System.out.println();
}
public static void printOptionsSelection() {