From 5bfee4624aa2d193498554c283280ea38c5d04a1 Mon Sep 17 00:00:00 2001 From: MunJunHo Date: Fri, 12 May 2023 16:58:52 +0900 Subject: [PATCH 1/5] chore : project setting --- ToyProject01/src/me/smartstore/Main.java | 4 ++++ 1 file changed, 4 insertions(+) create mode 100644 ToyProject01/src/me/smartstore/Main.java diff --git a/ToyProject01/src/me/smartstore/Main.java b/ToyProject01/src/me/smartstore/Main.java new file mode 100644 index 00000000..10466eb9 --- /dev/null +++ b/ToyProject01/src/me/smartstore/Main.java @@ -0,0 +1,4 @@ +package me.smartstore; + +public class Main { +} From 7ba56b35dad1691b27bd289254add6b2e11f2ae6 Mon Sep 17 00:00:00 2001 From: MunJunHo Date: Mon, 15 May 2023 19:23:50 +0900 Subject: [PATCH 2/5] feat : customer and group --- ToyProject01/src/me/smartstore/Main.java | 4 -- .../src/me/smartstore/customer/Customer.java | 46 +++++++++++++++++++ .../src/me/smartstore/customer/Customers.java | 32 +++++++++++++ .../src/me/smartstore/group/Group.java | 19 ++++++++ .../src/me/smartstore/group/GroupGeneral.java | 31 +++++++++++++ .../src/me/smartstore/group/GroupVIP.java | 31 +++++++++++++ .../src/me/smartstore/group/GroupVVIP.java | 31 +++++++++++++ .../src/me/smartstore/menu/MenuMain.java | 10 ++++ 8 files changed, 200 insertions(+), 4 deletions(-) delete mode 100644 ToyProject01/src/me/smartstore/Main.java create mode 100644 ToyProject01/src/me/smartstore/customer/Customer.java create mode 100644 ToyProject01/src/me/smartstore/customer/Customers.java create mode 100644 ToyProject01/src/me/smartstore/group/Group.java create mode 100644 ToyProject01/src/me/smartstore/group/GroupGeneral.java create mode 100644 ToyProject01/src/me/smartstore/group/GroupVIP.java create mode 100644 ToyProject01/src/me/smartstore/group/GroupVVIP.java create mode 100644 ToyProject01/src/me/smartstore/menu/MenuMain.java diff --git a/ToyProject01/src/me/smartstore/Main.java b/ToyProject01/src/me/smartstore/Main.java deleted file mode 100644 index 10466eb9..00000000 --- a/ToyProject01/src/me/smartstore/Main.java +++ /dev/null @@ -1,4 +0,0 @@ -package me.smartstore; - -public class Main { -} diff --git a/ToyProject01/src/me/smartstore/customer/Customer.java b/ToyProject01/src/me/smartstore/customer/Customer.java new file mode 100644 index 00000000..dcb9ed02 --- /dev/null +++ b/ToyProject01/src/me/smartstore/customer/Customer.java @@ -0,0 +1,46 @@ +package me.smartstore.customer; + +import me.smartstore.group.Group; + +import java.util.Objects; + +public class Customer { + private String customerName; + private String customerId; + private String customerShoppingTime; + private Group customerGroup; + + public String getCustomerName() { + return customerName; + } + + public void setCustomerName(String customerName) { + this.customerName = customerName; + } + + public String getCustomerId() { + return customerId; + } + + public void setCustomerId(String customerId) { + this.customerId = customerId; + } + + public String getCustomerShoppingTime() { + return customerShoppingTime; + } + + public void setCustomerShoppingTime(String customerShoppingTime) { + this.customerShoppingTime = customerShoppingTime; + } + + public Group getCustomerGroup() { + return customerGroup; + } + + public void setCustomerGroup(Group customerGroup) { + this.customerGroup = customerGroup; + } + + +} diff --git a/ToyProject01/src/me/smartstore/customer/Customers.java b/ToyProject01/src/me/smartstore/customer/Customers.java new file mode 100644 index 00000000..26c1b17d --- /dev/null +++ b/ToyProject01/src/me/smartstore/customer/Customers.java @@ -0,0 +1,32 @@ +package me.smartstore.customer; + +public class Customers extends Customer { + + private static Customers instance; + + private static final int defaultCapacity = 10; + + private Customer[] CustomerArray; + private int capacity; + + private Customers() { + + this.CustomerArray = new Customer[defaultCapacity]; + this.capacity = defaultCapacity; + } + + public static Customers getInstance() { + if (instance == null) { + instance = new Customers(); + } + return instance; + } + + public int getCapacity() { + return capacity; + } + + public void setCapacity(int capacity) { + this.capacity = capacity; + } +} diff --git a/ToyProject01/src/me/smartstore/group/Group.java b/ToyProject01/src/me/smartstore/group/Group.java new file mode 100644 index 00000000..6e145a77 --- /dev/null +++ b/ToyProject01/src/me/smartstore/group/Group.java @@ -0,0 +1,19 @@ +package me.smartstore.group; + +public abstract class Group { + + public String groupName; + public double time; + public double pay; + + abstract void setMinimumTime(double time); + + abstract void setMinimumPay(double pay); + + abstract double getMinimumTime(); + + abstract double getMinimumPay(); + + + +} diff --git a/ToyProject01/src/me/smartstore/group/GroupGeneral.java b/ToyProject01/src/me/smartstore/group/GroupGeneral.java new file mode 100644 index 00000000..3a36036f --- /dev/null +++ b/ToyProject01/src/me/smartstore/group/GroupGeneral.java @@ -0,0 +1,31 @@ +package me.smartstore.group; + +public class GroupGeneral extends Group { + + + public GroupGeneral() { + this.groupName = "General"; + } + + @Override + void setMinimumTime(double time) { + this.time = time; + } + + @Override + void setMinimumPay(double pay) { + this.pay = pay; + } + + @Override + double getMinimumTime() { + return this.time; + } + + @Override + double getMinimumPay() { + return this.pay; + } + + +} diff --git a/ToyProject01/src/me/smartstore/group/GroupVIP.java b/ToyProject01/src/me/smartstore/group/GroupVIP.java new file mode 100644 index 00000000..6b08e47f --- /dev/null +++ b/ToyProject01/src/me/smartstore/group/GroupVIP.java @@ -0,0 +1,31 @@ +package me.smartstore.group; + +public class GroupVIP extends Group{ + + + public GroupVIP() { + this.groupName = "VIP"; + } + + @Override + void setMinimumTime(double time) { + + } + + @Override + void setMinimumPay(double pay) { + + } + + @Override + double getMinimumTime() { + return 0; + } + + @Override + double getMinimumPay() { + return 0; + } + + +} diff --git a/ToyProject01/src/me/smartstore/group/GroupVVIP.java b/ToyProject01/src/me/smartstore/group/GroupVVIP.java new file mode 100644 index 00000000..44f9d01f --- /dev/null +++ b/ToyProject01/src/me/smartstore/group/GroupVVIP.java @@ -0,0 +1,31 @@ +package me.smartstore.group; + +public class GroupVVIP extends Group{ + + + public GroupVVIP() { + this.groupName = "VVIP"; + } + + @Override + void setMinimumTime(double time) { + + } + + @Override + void setMinimumPay(double pay) { + + } + + @Override + double getMinimumTime() { + return 0; + } + + @Override + double getMinimumPay() { + return 0; + } + + +} diff --git a/ToyProject01/src/me/smartstore/menu/MenuMain.java b/ToyProject01/src/me/smartstore/menu/MenuMain.java new file mode 100644 index 00000000..27b06244 --- /dev/null +++ b/ToyProject01/src/me/smartstore/menu/MenuMain.java @@ -0,0 +1,10 @@ +package me.smartstore.menu; + +public class MenuMain { + public static void main(String[] args) { + + + + + } +} From 82fc22ba9d91a06cea59d51eaf782671cf685815 Mon Sep 17 00:00:00 2001 From: MunJunHo Date: Mon, 15 May 2023 23:15:48 +0900 Subject: [PATCH 3/5] LobbyMenu and Scan --- ToyProject01/src/me/smartstore/Main.java | 12 ++++++++ .../src/me/smartstore/menu/LobbyMenu.java | 30 +++++++++++++++++++ .../src/me/smartstore/menu/MenuMain.java | 10 ------- .../src/me/smartstore/scanner/Scan.java | 18 +++++++++++ 4 files changed, 60 insertions(+), 10 deletions(-) create mode 100644 ToyProject01/src/me/smartstore/Main.java create mode 100644 ToyProject01/src/me/smartstore/menu/LobbyMenu.java delete mode 100644 ToyProject01/src/me/smartstore/menu/MenuMain.java create mode 100644 ToyProject01/src/me/smartstore/scanner/Scan.java diff --git a/ToyProject01/src/me/smartstore/Main.java b/ToyProject01/src/me/smartstore/Main.java new file mode 100644 index 00000000..67a6ec07 --- /dev/null +++ b/ToyProject01/src/me/smartstore/Main.java @@ -0,0 +1,12 @@ +package me.smartstore; + +import me.smartstore.menu.LobbyMenu; + +public class Main { + public static void main(String[] args) { + + LobbyMenu.lobbyMenuUI(); + + + } +} diff --git a/ToyProject01/src/me/smartstore/menu/LobbyMenu.java b/ToyProject01/src/me/smartstore/menu/LobbyMenu.java new file mode 100644 index 00000000..e69e5c4c --- /dev/null +++ b/ToyProject01/src/me/smartstore/menu/LobbyMenu.java @@ -0,0 +1,30 @@ +package me.smartstore.menu; + + +import me.smartstore.scanner.Scan; +import java.util.Scanner; + +public class LobbyMenu { + + public static void lobbyMenuUI(){ + String strlobbyMenuUI = "==============================\n" + + " 1. Parameter\n" + + " 2. Customer Data\n" + + " 3. Classification Summary\n" + + " 4. Quit\n" + + "==============================\n"; + System.out.print(strlobbyMenuUI+"Choose One: "); + String in = Scan.getInstance().nextLine(); + + if(in.equals("1")){ + System.out.println(in); + }else{ + System.out.println("error"); + System.out.println(in); + } + + + } + + +} diff --git a/ToyProject01/src/me/smartstore/menu/MenuMain.java b/ToyProject01/src/me/smartstore/menu/MenuMain.java deleted file mode 100644 index 27b06244..00000000 --- a/ToyProject01/src/me/smartstore/menu/MenuMain.java +++ /dev/null @@ -1,10 +0,0 @@ -package me.smartstore.menu; - -public class MenuMain { - public static void main(String[] args) { - - - - - } -} diff --git a/ToyProject01/src/me/smartstore/scanner/Scan.java b/ToyProject01/src/me/smartstore/scanner/Scan.java new file mode 100644 index 00000000..9a93f91e --- /dev/null +++ b/ToyProject01/src/me/smartstore/scanner/Scan.java @@ -0,0 +1,18 @@ +package me.smartstore.scanner; + +import java.util.Scanner; + +public class Scan { + + private static Scanner instance; + + private Scan(){} + + public static Scanner getInstance(){ + if(instance == null) { + instance = new Scanner(System.in); + } + return instance; + } + +} From 446121ba78b63e86f09118a6a7bfd7312bf1defd Mon Sep 17 00:00:00 2001 From: MunJunHo Date: Thu, 18 May 2023 17:21:45 +0900 Subject: [PATCH 4/5] groups, menu, parameter package semi complete --- ToyProject01/src/me/smartstore/Main.java | 4 +- .../exception/InvalidInputExcetion.java | 8 ++++ .../src/me/smartstore/group/Group.java | 2 +- .../src/me/smartstore/group/GroupGeneral.java | 2 +- .../src/me/smartstore/group/Groups.java | 27 +++++++++++ .../src/me/smartstore/menu/CustomerData.java | 9 ++++ .../src/me/smartstore/menu/Lobby.java | 43 +++++++++++++++++ .../src/me/smartstore/menu/LobbyMenu.java | 30 ------------ .../src/me/smartstore/menu/Parameter.java | 47 +++++++++++++++++++ .../me/smartstore/parameter/SetParameter.java | 4 ++ .../smartstore/parameter/UpdateParameter.java | 4 ++ .../smartstore/parameter/ViewParameter.java | 4 ++ 12 files changed, 150 insertions(+), 34 deletions(-) create mode 100644 ToyProject01/src/me/smartstore/exception/InvalidInputExcetion.java create mode 100644 ToyProject01/src/me/smartstore/group/Groups.java create mode 100644 ToyProject01/src/me/smartstore/menu/CustomerData.java create mode 100644 ToyProject01/src/me/smartstore/menu/Lobby.java delete mode 100644 ToyProject01/src/me/smartstore/menu/LobbyMenu.java create mode 100644 ToyProject01/src/me/smartstore/menu/Parameter.java create mode 100644 ToyProject01/src/me/smartstore/parameter/SetParameter.java create mode 100644 ToyProject01/src/me/smartstore/parameter/UpdateParameter.java create mode 100644 ToyProject01/src/me/smartstore/parameter/ViewParameter.java diff --git a/ToyProject01/src/me/smartstore/Main.java b/ToyProject01/src/me/smartstore/Main.java index 67a6ec07..c4cba66a 100644 --- a/ToyProject01/src/me/smartstore/Main.java +++ b/ToyProject01/src/me/smartstore/Main.java @@ -1,11 +1,11 @@ package me.smartstore; -import me.smartstore.menu.LobbyMenu; +import me.smartstore.menu.Lobby; public class Main { public static void main(String[] args) { - LobbyMenu.lobbyMenuUI(); + Lobby.lobbyMenuUI(); } diff --git a/ToyProject01/src/me/smartstore/exception/InvalidInputExcetion.java b/ToyProject01/src/me/smartstore/exception/InvalidInputExcetion.java new file mode 100644 index 00000000..c238ff7b --- /dev/null +++ b/ToyProject01/src/me/smartstore/exception/InvalidInputExcetion.java @@ -0,0 +1,8 @@ +package me.smartstore.exception; + +public class InvalidInputExcetion extends Exception{ + private final static String MESSAGE = "Invalid Input. Please try again."; + public InvalidInputExcetion(){ + super(MESSAGE); + } +} diff --git a/ToyProject01/src/me/smartstore/group/Group.java b/ToyProject01/src/me/smartstore/group/Group.java index 6e145a77..f164284e 100644 --- a/ToyProject01/src/me/smartstore/group/Group.java +++ b/ToyProject01/src/me/smartstore/group/Group.java @@ -2,7 +2,7 @@ public abstract class Group { - public String groupName; + public String groupType; public double time; public double pay; diff --git a/ToyProject01/src/me/smartstore/group/GroupGeneral.java b/ToyProject01/src/me/smartstore/group/GroupGeneral.java index 3a36036f..0a4f3dcb 100644 --- a/ToyProject01/src/me/smartstore/group/GroupGeneral.java +++ b/ToyProject01/src/me/smartstore/group/GroupGeneral.java @@ -4,7 +4,7 @@ public class GroupGeneral extends Group { public GroupGeneral() { - this.groupName = "General"; + this.groupType = "General"; } @Override diff --git a/ToyProject01/src/me/smartstore/group/Groups.java b/ToyProject01/src/me/smartstore/group/Groups.java new file mode 100644 index 00000000..fbe87f4b --- /dev/null +++ b/ToyProject01/src/me/smartstore/group/Groups.java @@ -0,0 +1,27 @@ +package me.smartstore.group; + +import java.util.Optional; + +public class Groups { + + private static Groups instance; + private Optional groupGeneral;// 이렇게 optional를 사용하는게 맞는지는 모르겠지만 진행 + private Optional groupVIP; + private Optional groupVVIP; + + private Groups(){ + groupGeneral = Optional.empty(); + groupVIP = Optional.empty(); + groupVVIP = Optional.empty(); + + } + + public static Groups getInstance(){ + if(instance == null){ + instance = new Groups(); + } + return instance; + } + + +} diff --git a/ToyProject01/src/me/smartstore/menu/CustomerData.java b/ToyProject01/src/me/smartstore/menu/CustomerData.java new file mode 100644 index 00000000..5b17d5b1 --- /dev/null +++ b/ToyProject01/src/me/smartstore/menu/CustomerData.java @@ -0,0 +1,9 @@ +package me.smartstore.menu; + +public class CustomerData { + + public static void CustomerDataMenu(){ + + } + +} diff --git a/ToyProject01/src/me/smartstore/menu/Lobby.java b/ToyProject01/src/me/smartstore/menu/Lobby.java new file mode 100644 index 00000000..7b6b6e39 --- /dev/null +++ b/ToyProject01/src/me/smartstore/menu/Lobby.java @@ -0,0 +1,43 @@ +package me.smartstore.menu; + + +import me.smartstore.exception.InvalidInputExcetion; +import me.smartstore.scanner.Scan; +import java.util.Scanner; + +public class Lobby { + + public static void lobbyMenuUI() { + System.out.println( "==============================\n" + + " 1. Parameter\n" + + " 2. Customer Data\n" + + " 3. Classification Summary\n" + + " 4. Quit\n" + + "=============================="); + System.out.print("Choose One: "); + String in = Scan.getInstance().nextLine(); + + + + if(in.equals("1")){ + Parameter.parameterMenu(); + }else if(in.equals("2")){ + + }else if(in.equals("3")){ + + }else if(in.equals("4")){// 프로그램 종료 + System.exit(0); + } + else{ + try { + throw new InvalidInputExcetion(); + } catch (InvalidInputExcetion e) { + System.out.println(e.getMessage()); + lobbyMenuUI(); + } + } + + } + + +} diff --git a/ToyProject01/src/me/smartstore/menu/LobbyMenu.java b/ToyProject01/src/me/smartstore/menu/LobbyMenu.java deleted file mode 100644 index e69e5c4c..00000000 --- a/ToyProject01/src/me/smartstore/menu/LobbyMenu.java +++ /dev/null @@ -1,30 +0,0 @@ -package me.smartstore.menu; - - -import me.smartstore.scanner.Scan; -import java.util.Scanner; - -public class LobbyMenu { - - public static void lobbyMenuUI(){ - String strlobbyMenuUI = "==============================\n" + - " 1. Parameter\n" + - " 2. Customer Data\n" + - " 3. Classification Summary\n" + - " 4. Quit\n" + - "==============================\n"; - System.out.print(strlobbyMenuUI+"Choose One: "); - String in = Scan.getInstance().nextLine(); - - if(in.equals("1")){ - System.out.println(in); - }else{ - System.out.println("error"); - System.out.println(in); - } - - - } - - -} diff --git a/ToyProject01/src/me/smartstore/menu/Parameter.java b/ToyProject01/src/me/smartstore/menu/Parameter.java new file mode 100644 index 00000000..834deb65 --- /dev/null +++ b/ToyProject01/src/me/smartstore/menu/Parameter.java @@ -0,0 +1,47 @@ +package me.smartstore.menu; + +import me.smartstore.customer.Customers; +import me.smartstore.exception.InvalidInputExcetion; +import me.smartstore.scanner.Scan; + +public class Parameter { + public static void parameterMenu(){ + System.out.println("==============================\n" + + " 1. Set Parameter\n" + + " 2. View Parameter\n" + + " 3. Update Parameter\n" + + " 4. Back\n" + + "==============================\n"); + System.out.print("Choose One: "); + String in = Scan.getInstance().nextLine(); + + if(in.equals("1")){ + System.out.println("Which group (GENERAL (G), VIP (V), VVIP (VV))?\n" + + "** Press 'end', if you want to exit! **"); + in = Scan.getInstance().nextLine(); + if(in.equalsIgnoreCase("G")){ + + }else if(in.equalsIgnoreCase("V")){ + + }else if(in.equalsIgnoreCase("VV")){ + + }else{ + + } + }else if(in.equals("2")){ + + }else if(in.equals("3")){ + + }else if(in.equals("4")){ + Lobby.lobbyMenuUI(); + }else{ + try { + throw new InvalidInputExcetion(); + } catch (InvalidInputExcetion e) { + System.out.println(e.getMessage()); + parameterMenu(); + } + } + + } +} diff --git a/ToyProject01/src/me/smartstore/parameter/SetParameter.java b/ToyProject01/src/me/smartstore/parameter/SetParameter.java new file mode 100644 index 00000000..483d10df --- /dev/null +++ b/ToyProject01/src/me/smartstore/parameter/SetParameter.java @@ -0,0 +1,4 @@ +package me.smartstore.parameter; + +public class SetParameter { +} diff --git a/ToyProject01/src/me/smartstore/parameter/UpdateParameter.java b/ToyProject01/src/me/smartstore/parameter/UpdateParameter.java new file mode 100644 index 00000000..2312007a --- /dev/null +++ b/ToyProject01/src/me/smartstore/parameter/UpdateParameter.java @@ -0,0 +1,4 @@ +package me.smartstore.parameter; + +public class UpdateParameter { +} diff --git a/ToyProject01/src/me/smartstore/parameter/ViewParameter.java b/ToyProject01/src/me/smartstore/parameter/ViewParameter.java new file mode 100644 index 00000000..db545c82 --- /dev/null +++ b/ToyProject01/src/me/smartstore/parameter/ViewParameter.java @@ -0,0 +1,4 @@ +package me.smartstore.parameter; + +public class ViewParameter { +} From 70be7f67473a34857a8843ce06826de8b5e57fcb Mon Sep 17 00:00:00 2001 From: MunJunHo Date: Mon, 22 May 2023 19:11:19 +0900 Subject: [PATCH 5/5] feat : group package --- .../exception/InvalidFormatInput.java | 8 ++ .../src/me/smartstore/group/GroupGeneral.java | 8 +- .../src/me/smartstore/group/GroupVIP.java | 2 +- .../src/me/smartstore/group/GroupVVIP.java | 2 +- .../src/me/smartstore/group/Groups.java | 22 +++++ .../src/me/smartstore/menu/Parameter.java | 20 ++--- .../me/smartstore/parameter/SetParameter.java | 86 +++++++++++++++++++ .../smartstore/parameter/UpdateParameter.java | 4 + .../smartstore/parameter/ViewParameter.java | 9 ++ 9 files changed, 144 insertions(+), 17 deletions(-) create mode 100644 ToyProject01/src/me/smartstore/exception/InvalidFormatInput.java diff --git a/ToyProject01/src/me/smartstore/exception/InvalidFormatInput.java b/ToyProject01/src/me/smartstore/exception/InvalidFormatInput.java new file mode 100644 index 00000000..ae7fa7d2 --- /dev/null +++ b/ToyProject01/src/me/smartstore/exception/InvalidFormatInput.java @@ -0,0 +1,8 @@ +package me.smartstore.exception; + +public class InvalidFormatInput extends Exception{ + private final static String MESSAGE = "Invalid Format for Input. Please try again."; + public InvalidFormatInput(){ + super(MESSAGE); + } +} diff --git a/ToyProject01/src/me/smartstore/group/GroupGeneral.java b/ToyProject01/src/me/smartstore/group/GroupGeneral.java index 0a4f3dcb..ed37c6cb 100644 --- a/ToyProject01/src/me/smartstore/group/GroupGeneral.java +++ b/ToyProject01/src/me/smartstore/group/GroupGeneral.java @@ -27,5 +27,11 @@ void setMinimumPay(double pay) { return this.pay; } - + @Override + public String toString() { + return "parameter{" + + "minimumSpentTime=" + time + + ", minimumTotalPay=" + pay + + '}'; + } } diff --git a/ToyProject01/src/me/smartstore/group/GroupVIP.java b/ToyProject01/src/me/smartstore/group/GroupVIP.java index 6b08e47f..eef4ed0c 100644 --- a/ToyProject01/src/me/smartstore/group/GroupVIP.java +++ b/ToyProject01/src/me/smartstore/group/GroupVIP.java @@ -4,7 +4,7 @@ public class GroupVIP extends Group{ public GroupVIP() { - this.groupName = "VIP"; + this.groupType = "VIP"; } @Override diff --git a/ToyProject01/src/me/smartstore/group/GroupVVIP.java b/ToyProject01/src/me/smartstore/group/GroupVVIP.java index 44f9d01f..9adba3ff 100644 --- a/ToyProject01/src/me/smartstore/group/GroupVVIP.java +++ b/ToyProject01/src/me/smartstore/group/GroupVVIP.java @@ -4,7 +4,7 @@ public class GroupVVIP extends Group{ public GroupVVIP() { - this.groupName = "VVIP"; + this.groupType = "VVIP"; } @Override diff --git a/ToyProject01/src/me/smartstore/group/Groups.java b/ToyProject01/src/me/smartstore/group/Groups.java index fbe87f4b..b41ecfc4 100644 --- a/ToyProject01/src/me/smartstore/group/Groups.java +++ b/ToyProject01/src/me/smartstore/group/Groups.java @@ -23,5 +23,27 @@ public static Groups getInstance(){ return instance; } + public Optional getGroupGeneral() { + return groupGeneral; + } + + public void setGroupGeneral(Optional groupGeneral) { + this.groupGeneral = groupGeneral; + } + + public Optional getGroupVIP() { + return groupVIP; + } + public void setGroupVIP(Optional groupVIP) { + this.groupVIP = groupVIP; + } + + public Optional getGroupVVIP() { + return groupVVIP; + } + + public void setGroupVVIP(Optional groupVVIP) { + this.groupVVIP = groupVVIP; + } } diff --git a/ToyProject01/src/me/smartstore/menu/Parameter.java b/ToyProject01/src/me/smartstore/menu/Parameter.java index 834deb65..2baed006 100644 --- a/ToyProject01/src/me/smartstore/menu/Parameter.java +++ b/ToyProject01/src/me/smartstore/menu/Parameter.java @@ -2,6 +2,9 @@ import me.smartstore.customer.Customers; import me.smartstore.exception.InvalidInputExcetion; +import me.smartstore.parameter.SetParameter; +import me.smartstore.parameter.UpdateParameter; +import me.smartstore.parameter.ViewParameter; import me.smartstore.scanner.Scan; public class Parameter { @@ -16,22 +19,11 @@ public static void parameterMenu(){ String in = Scan.getInstance().nextLine(); if(in.equals("1")){ - System.out.println("Which group (GENERAL (G), VIP (V), VVIP (VV))?\n" + - "** Press 'end', if you want to exit! **"); - in = Scan.getInstance().nextLine(); - if(in.equalsIgnoreCase("G")){ - - }else if(in.equalsIgnoreCase("V")){ - - }else if(in.equalsIgnoreCase("VV")){ - - }else{ - - } + SetParameter.setParameterMethod(); }else if(in.equals("2")){ - + ViewParameter.viewParameterMethod(); }else if(in.equals("3")){ - + UpdateParameter.updateParameterMethod(); }else if(in.equals("4")){ Lobby.lobbyMenuUI(); }else{ diff --git a/ToyProject01/src/me/smartstore/parameter/SetParameter.java b/ToyProject01/src/me/smartstore/parameter/SetParameter.java index 483d10df..ab27c461 100644 --- a/ToyProject01/src/me/smartstore/parameter/SetParameter.java +++ b/ToyProject01/src/me/smartstore/parameter/SetParameter.java @@ -1,4 +1,90 @@ package me.smartstore.parameter; +import me.smartstore.exception.InvalidFormatInput; +import me.smartstore.exception.InvalidInputExcetion; +import me.smartstore.group.GroupGeneral; +import me.smartstore.group.Groups; +import me.smartstore.menu.Parameter; +import me.smartstore.scanner.Scan; + +import java.util.Optional; + public class SetParameter { + public static void setParameterMethod() { + + System.out.println("Which group (GENERAL (G), VIP (V), VVIP (VV))?\n" + + "** Press 'end', if you want to exit! **"); + String in = Scan.getInstance().nextLine(); + if (in.equalsIgnoreCase("G")) { + setGeneralParameterMethod(); + } else if (in.equalsIgnoreCase("V")) { + setVipParameterMethod(); + } else if (in.equalsIgnoreCase("VV")) { + setVvipParameterMethod(); + } else if (in.equals("end")) { + System.out.println("END is pressed. Exit this menu.\n"); + Parameter.parameterMenu(); + } else { + try { + throw new InvalidInputExcetion(); + } catch (InvalidInputExcetion e) { + System.out.println(e.getMessage()); + + } + setParameterMethod(); + } + } + + public static void setGeneralParameterMethod() { + Groups groups = Groups.getInstance(); + if (groups.getGroupGeneral().isPresent()) { + String groupType = groups.getGroupGeneral().get().groupType; + System.out.println(groupType + " group already exists.\n"); + System.out.println(); + System.out.println("GroupType: " + groupType); + System.out.println("Parameter: " + groups.getGroupGeneral().get().toString()); + setParameterMethod(); + + } else { + System.out.println("==============================\n" + + " 1. Minimum Spent Time\n" + + " 2. Minimum Total Pay\n" + + " 3. Back\n" + + "=============================="); + String in = Scan.getInstance().nextLine(); + if(in.equals("1")){ + setMinimumSpentTime(); + }else if(in.equals("2")){ + setMinimumTotalPay(); + }else if(in.equals("3")){ + + }else{ + try { + throw new InvalidFormatInput(); + } catch (InvalidFormatInput e) { + System.out.println(e.getMessage()); + + } + } + + } + } + + public static void setVipParameterMethod() { + + } + + public static void setVvipParameterMethod() { + + } + + public static void setMinimumSpentTime(){ + String in = Scan.getInstance().nextLine(); + } + + public static void setMinimumTotalPay(){ + + } + + } diff --git a/ToyProject01/src/me/smartstore/parameter/UpdateParameter.java b/ToyProject01/src/me/smartstore/parameter/UpdateParameter.java index 2312007a..dbe72ad5 100644 --- a/ToyProject01/src/me/smartstore/parameter/UpdateParameter.java +++ b/ToyProject01/src/me/smartstore/parameter/UpdateParameter.java @@ -1,4 +1,8 @@ package me.smartstore.parameter; public class UpdateParameter { + + public static void updateParameterMethod(){ + + } } diff --git a/ToyProject01/src/me/smartstore/parameter/ViewParameter.java b/ToyProject01/src/me/smartstore/parameter/ViewParameter.java index db545c82..6bb9c687 100644 --- a/ToyProject01/src/me/smartstore/parameter/ViewParameter.java +++ b/ToyProject01/src/me/smartstore/parameter/ViewParameter.java @@ -1,4 +1,13 @@ package me.smartstore.parameter; public class ViewParameter { + + public static void viewParameterMethod(){ + + + + + + + } }