Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[1차 VER1.0...] Java ToyProject upload by JunHoMun #35

Open
wants to merge 5 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 12 additions & 0 deletions ToyProject01/src/me/smartstore/Main.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
package me.smartstore;

import me.smartstore.menu.Lobby;

public class Main {
public static void main(String[] args) {

Lobby.lobbyMenuUI();


}
}
46 changes: 46 additions & 0 deletions ToyProject01/src/me/smartstore/customer/Customer.java
Original file line number Diff line number Diff line change
@@ -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;
}


}
32 changes: 32 additions & 0 deletions ToyProject01/src/me/smartstore/customer/Customers.java
Original file line number Diff line number Diff line change
@@ -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;
}
}
Original file line number Diff line number Diff line change
@@ -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);
}
}
Original file line number Diff line number Diff line change
@@ -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);
}
}
19 changes: 19 additions & 0 deletions ToyProject01/src/me/smartstore/group/Group.java
Original file line number Diff line number Diff line change
@@ -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();



}
37 changes: 37 additions & 0 deletions ToyProject01/src/me/smartstore/group/GroupGeneral.java
Original file line number Diff line number Diff line change
@@ -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 +
'}';
}
}
31 changes: 31 additions & 0 deletions ToyProject01/src/me/smartstore/group/GroupVIP.java
Original file line number Diff line number Diff line change
@@ -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;
}


}
31 changes: 31 additions & 0 deletions ToyProject01/src/me/smartstore/group/GroupVVIP.java
Original file line number Diff line number Diff line change
@@ -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;
}


}
49 changes: 49 additions & 0 deletions ToyProject01/src/me/smartstore/group/Groups.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
package me.smartstore.group;

import java.util.Optional;

public class Groups {

private static Groups instance;
private Optional<GroupGeneral> groupGeneral;// 이렇게 optional를 사용하는게 맞는지는 모르겠지만 진행
private Optional<GroupVIP> groupVIP;
private Optional<GroupVVIP> 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<GroupGeneral> getGroupGeneral() {
return groupGeneral;
}

public void setGroupGeneral(Optional<GroupGeneral> groupGeneral) {
this.groupGeneral = groupGeneral;
}

public Optional<GroupVIP> getGroupVIP() {
return groupVIP;
}

public void setGroupVIP(Optional<GroupVIP> groupVIP) {
this.groupVIP = groupVIP;
}

public Optional<GroupVVIP> getGroupVVIP() {
return groupVVIP;
}

public void setGroupVVIP(Optional<GroupVVIP> groupVVIP) {
this.groupVVIP = groupVVIP;
}
}
9 changes: 9 additions & 0 deletions ToyProject01/src/me/smartstore/menu/CustomerData.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
package me.smartstore.menu;

public class CustomerData {

public static void CustomerDataMenu(){

}

}
43 changes: 43 additions & 0 deletions ToyProject01/src/me/smartstore/menu/Lobby.java
Original file line number Diff line number Diff line change
@@ -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();
}
}

}


}
39 changes: 39 additions & 0 deletions ToyProject01/src/me/smartstore/menu/Parameter.java
Original file line number Diff line number Diff line change
@@ -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();
}
}

}
}
Loading