diff --git a/ToyProject01/src/me/smartstore/Main.java b/ToyProject01/src/me/smartstore/Main.java new file mode 100644 index 00000000..c4cba66a --- /dev/null +++ b/ToyProject01/src/me/smartstore/Main.java @@ -0,0 +1,12 @@ +package me.smartstore; + +import me.smartstore.menu.Lobby; + +public class Main { + public static void main(String[] args) { + + Lobby.lobbyMenuUI(); + + + } +} 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/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/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 new file mode 100644 index 00000000..f164284e --- /dev/null +++ b/ToyProject01/src/me/smartstore/group/Group.java @@ -0,0 +1,19 @@ +package me.smartstore.group; + +public abstract class Group { + + public String groupType; + 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..ed37c6cb --- /dev/null +++ b/ToyProject01/src/me/smartstore/group/GroupGeneral.java @@ -0,0 +1,37 @@ +package me.smartstore.group; + +public class GroupGeneral extends Group { + + + public GroupGeneral() { + this.groupType = "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; + } + + @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 new file mode 100644 index 00000000..eef4ed0c --- /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.groupType = "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..9adba3ff --- /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.groupType = "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/group/Groups.java b/ToyProject01/src/me/smartstore/group/Groups.java new file mode 100644 index 00000000..b41ecfc4 --- /dev/null +++ b/ToyProject01/src/me/smartstore/group/Groups.java @@ -0,0 +1,49 @@ +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; + } + + 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/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/Parameter.java b/ToyProject01/src/me/smartstore/menu/Parameter.java new file mode 100644 index 00000000..2baed006 --- /dev/null +++ b/ToyProject01/src/me/smartstore/menu/Parameter.java @@ -0,0 +1,39 @@ +package me.smartstore.menu; + +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 { + 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")){ + SetParameter.setParameterMethod(); + }else if(in.equals("2")){ + ViewParameter.viewParameterMethod(); + }else if(in.equals("3")){ + UpdateParameter.updateParameterMethod(); + }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..ab27c461 --- /dev/null +++ b/ToyProject01/src/me/smartstore/parameter/SetParameter.java @@ -0,0 +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 new file mode 100644 index 00000000..dbe72ad5 --- /dev/null +++ b/ToyProject01/src/me/smartstore/parameter/UpdateParameter.java @@ -0,0 +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 new file mode 100644 index 00000000..6bb9c687 --- /dev/null +++ b/ToyProject01/src/me/smartstore/parameter/ViewParameter.java @@ -0,0 +1,13 @@ +package me.smartstore.parameter; + +public class ViewParameter { + + public static void viewParameterMethod(){ + + + + + + + } +} 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; + } + +}