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 SeoYongHyun #11

Open
wants to merge 30 commits into
base: main
Choose a base branch
from

Conversation

zjdtm
Copy link

@zjdtm zjdtm commented May 10, 2023

😟😟😟
기능 구현에만 초점을 맞추다 보니 뒤죽박죽인 엉망인 코드가 되어버린것 같습니다.

최선을 다했지만 여기까지인 것 같습니다. 부족한 부분이나 좀 더 나은 방법이 있으면 꼭!! 알려주시면 감사하겠습니다.

zjdtm added 27 commits May 3, 2023 20:52
기존 코드에 refresh 함수 구현
Group 은 Parameter, GroupType 타입의 필드를 가지고 있으며
Parameter 클래스에는 minTime, minPay 각 각 최소 시간과 최소 비용을 필드, GroupType 은 enum 타입으로 되어있다.
DArray를 상속받는 Groups는 싱글턴 객체로 이루어져 있음
- find 함수는 매개변수로 들어오는 GroupType 타입의 변수를 for문을 이용하여 찾아내는 함수이다.
기존 코드에서 font 출력문 style 수정
기존 refresh 함수의 경우 분류기준이 바뀌는 경우에 매개변수로 들어온 groups 의 순서가 정렬되어 있지 않기 때문에 allCustomers 의 group 상태가 모두 NONE 으로 바뀌게 되었었다. (GENERAL, VIP, VVIP, NONE) 를 Arrays.sort() 함수를 사용하여 이용요금과 이용시간 을 기준으로 다시 정렬한 fixGroup 을 이용하여 각 customer 의 맞는 group을 넣도록 리펙터링 하였다.
setParameter, viewParameter, updateParameter 함수 추가
addCustomer, viewCustomer, deleteCustomer 함수 추가
summary, summaryName, summaryTime, summaryPay 함수 추가
parameter 에 minPay, minTime 중 하나라도 null 값이 포함되어 있을 경우에는 다시 입력받을 수 있도록 코드를 수정
- addCustomer 의 customerInfoInput 함수에 새로운 고객을 추가할때 null 체크를 해주는 코드 추가 및 출력문 수정

- updateCustomer 의 END 를 입력하면 이전 메뉴로 이동할 수 있도록 수정, 예외처리 NumberFormatException, IndexOutOfBoundsException 코드 수정 및  출력문 수정

- deleteCustomer 의 END 를 입력하면 이전 메뉴로 이동할 수 있도록 수정, 예외처리 InputEndException, NumberFormatException, IndexOutOfBoundsException 코드 수정 및  출력문 수정 출력문 수정
- addCustomer 의 customerInfoInput 함수에 새로운 고객을 추가할때 null 체크를 해주는 코드 추가 및 출력문 수정

- updateCustomer 의 END 를 입력하면 이전 메뉴로 이동할 수 있도록 수정, 예외처리 NumberFormatException, IndexOutOfBoundsException 코드 수정 및  출력문 수정

- deleteCustomer 의 END 를 입력하면 이전 메뉴로 이동할 수 있도록 수정, 예외처리 InputEndException, NumberFormatException, IndexOutOfBoundsException 코드 수정 및  출력문 수정 출력문 수정
Customer 객체가 생성될 때마다 기본적으로 NONE GroupType 을 가지도록 수정하였음
SummaryMenu 에 A(오름차순), D(내림차순) 을 지정해 주기 위해서 enum 타입의 OrderType 을 추가하였다.
- allCustomers.size() 가 0일 경우 요약 기능을 이용하지 못하도록 수정
- findOrder 함수를 이용하여 A(오름차순), D(내림차순) 이외의 값을 입력하면 예외 처리 및 return 한 orderType 변수에 따라 정렬 기능 수행
- 고객을 추가할 때 잘못된 값이 입력되었을 때 NumberFormatException 예외처리 하도록 수정
- allCustomers.size() 의 값이 0일 경우 viewCustomer(), updateCustomer(), deleteCustomer() 메뉴 선택시 "No Customers. Please input one first." 출력문이 나오도록 수정
- set 메서드를 사용하지 않고 생성자를 사용하도록 리펙터링 함

- Group 생성자에 Parameter, GroupType 에 null 이 들어올 경우 NullArgumentException 에러를 던지도록 리펙터링
- Customer Name, Customer ID Enter 로 입력 받을 시 InputEmptyException 예외를 던지도록 수정

- Customer 에 setCusName(), setCusId() 메서드에 예외처리 기능 추가

- NumberFormatException 예외 처리 customerInfoInput 메서드 안쪽으로 이동
기존 refresh() 함수는 분류기준이 바뀔 때, 새로운 고객이 들어올 때 실행되는 함수로 모든 Group 을 가져와야 하는 로직을 Groups 에게로 옮겨서 refresh() 함수는 groups.findAllGroup() 로 모든 Group 을 불러오도록 수정하였다.

return this; // smartStoreApp
}

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

여기와 Main 의 test는 빠져도 괜찮을거같습니다 :D

" ( •⩊•) _______ (•⩊• )\n" +
" (>\uD83C\uDF70>) | | (<\uD83D\uDD2A<)\n", parameter);
break;
}

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

(・ω・)b

@@ -0,0 +1,20 @@
package me.smartstore.menu;

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

A,D 놓을 패키지가 애매해서 포기했었는데
확실히 하면 깔끔해질 것 같네요 참고해봐야겠습니다!

zjdtm added 2 commits May 15, 2023 15:49
- 코드의 중복을 피하기 위해서 customerInfoInput() 메서드를 이용하여 customer 를 수정하거나 추가할 때 사용하도록 수정
- 반복문 for 문 안에서 메서드를 호출하는 것 보다는 바깥쪽에서 호출한 상태에서 진행하는 것이 속도 면에서 이점을 받을 수 있어서 수정
SummaryMenu 에서 매개변수로 들어온 group 에 속한 Customer 의 수를 카운팅 해주는 groupCount 추가

모든 Customer 의 정보를 가져오기 위한 메서드 findCustomerByGroup 메서드 추가

SummaryMenu 에 중복되어 있는 코드를 모두 수정
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants