Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
74 commits
Select commit Hold shift + click to select a range
b89135a
feat: setup smartstore project
brotherstone97 May 4, 2023
525d6d9
docs(기능 목록): 기능 목록 생성
brotherstone97 May 7, 2023
a6be3c3
feat: customer패키지 추가
brotherstone97 May 9, 2023
c793b69
feat: ArrayList 직접 구현을 위한 인터페이스 및 구현클래스 추가
brotherstone97 May 9, 2023
8fcac44
fix(Customers): Customer배열 사용 -> MyArrayList<Customer>사용
brotherstone97 May 9, 2023
2cfa802
docs(기능 목록): 기능 추가 및 제목 변경
brotherstone97 May 9, 2023
65e9bd9
fix(Customers): 싱글톤 객체이기에 기본 생성자를 private으로 수정
brotherstone97 May 9, 2023
dba14a4
feat: menu 패키지 추가
brotherstone97 May 9, 2023
f658e9c
feat(menu): 초기 메뉴 기능 추가
brotherstone97 May 9, 2023
ed53bb1
fix(menu): 데이터CRUD메서드 DataCRUD인터페이스로 분리
brotherstone97 May 9, 2023
6b39430
feat(CustomerMenu): 고객 메뉴의 초기 메뉴 출력 기능 추가
brotherstone97 May 9, 2023
d824b4c
feat(CustomerMenu): 고객 정보 추가 기능 구현
brotherstone97 May 9, 2023
7317683
feat(CustomerMenu): 고객 정보 조회 기능 추가
brotherstone97 May 9, 2023
7a24b0a
feat(CustomerMenu): 고객 정보 수정 기능 추가
brotherstone97 May 9, 2023
7a2c0ce
typo: 메서드 이름 camelCase로 수정
brotherstone97 May 9, 2023
d5ec7c1
feat(collections): index를 받아 요소를 지우는 기능 추가
brotherstone97 May 9, 2023
2838e89
feat(CustomerMenu): 고객 정보 삭제 기능 추가
brotherstone97 May 9, 2023
aea5711
feat: 고객 등급 기준이 되는 Parameter클래스 생성
brotherstone97 May 10, 2023
e670652
feat(group): 고객 등급 정보를 저장하기 위한 클래스 생성
brotherstone97 May 10, 2023
0435438
feat(Customer): 고객의 등급을 계산하는 기능 구현
brotherstone97 May 10, 2023
4aca990
feat(Parameter): 객체 직접 출력을 위한 Parameter클래스의 tostring()메서드 구현
brotherstone97 May 10, 2023
ab00b72
feat(customer): 고객 정보를 등급별로 분류하기 위한 ClassifiedCustomers클래스 생성
brotherstone97 May 10, 2023
81927d5
feat(ClassifiedCustomers): getter 추가
brotherstone97 May 10, 2023
35bcb98
feat(SummaryMenu): 고객 정보 요약(basic) 기능 추가
brotherstone97 May 10, 2023
aadef60
refactor(ClassifiedCustomers): ClassifiedCustomers클래스를 group패키지에서 cus…
brotherstone97 May 10, 2023
57dd6b2
feat(customer): Customer객체가 Comparable하도록 구현
brotherstone97 May 10, 2023
044aa53
fix(customer): Customer객체에서 갖던 sortBy필드를 ClassifiedCustomer객체에서 갖도록 함
brotherstone97 May 10, 2023
80774d7
feat(menu): 고객 정보를 정렬하기 위한 기능 구현
brotherstone97 May 10, 2023
6f353e2
feat(MyArrayList): 정렬 기능 구현
brotherstone97 May 10, 2023
2d6d1ed
feat(SummaryMenu): 누적 이용 시간, 누적 결제 금액 순 정렬 기능 구현
brotherstone97 May 10, 2023
e52ddd8
refactor(SummaryMenu): 중복되는 코드 메서드화
brotherstone97 May 10, 2023
c94b89c
typo: 오타 및 누락된 부분 수정
brotherstone97 May 10, 2023
2780185
feat(GroupMenu): 초기 그룹 메뉴 출력
brotherstone97 May 10, 2023
1fd4e36
feat(GroupMenu): 고객 등급 기준 추가 기능 구현
brotherstone97 May 10, 2023
a8fe309
refactor(GroupMenu): addData() 메서드 분리
brotherstone97 May 10, 2023
c4d2789
refactor(GroupMenu): 메서드 분리
brotherstone97 May 10, 2023
558783e
feat(GroupMenu): 고객 등급 기준 조회 기능 구현
brotherstone97 May 10, 2023
5a623a5
refactor(GroupMenu): 겹치는 메서드 추가 분리 및 updateData() 구현
brotherstone97 May 10, 2023
2f80e40
Merge branch 'HyungseokOh' of github.com:brotherstone97/KDTBE5_Java_T…
brotherstone97 May 10, 2023
00fabe5
docs(기능 목록): 구현한 기능 반영
brotherstone97 May 11, 2023
59c908d
refacor(menu): menu패키지 내 모든 클래스 싱글톤으로 변경
brotherstone97 May 12, 2023
ee16ffa
feat(Runner): 프로그램 실행을 위한 클래스 추가
brotherstone97 May 12, 2023
a9f57ab
fixt(Menu): 입력받은 menu의 숫자를 반환하도록 수정
brotherstone97 May 12, 2023
1496a1c
fix(Menu): while문 내에서 입력받은 메뉴를 반환하는 오류 수정 및 예외처리 코드 삭제
brotherstone97 May 12, 2023
29a7c39
refactor(Menu): 초기 메뉴 번호 입력에 대한 예외처리 및 메서드 정리
brotherstone97 May 12, 2023
dc66c64
refactor(Menu): initMenu -> inputInitMenuNumber
brotherstone97 May 12, 2023
8cb38a5
feat(SummaryMenu): 입력받은 메뉴번호에 대한 요약 기능 호출하도록 구현
brotherstone97 May 12, 2023
488e965
refactor(menu): 메뉴번호를 입력받는 메서드를 하나로 통일
brotherstone97 May 12, 2023
a152e21
refactor(menu): 모든 메뉴 입력 메서드의 기능이 겹침에 따른 중복코드 제거
brotherstone97 May 12, 2023
4b073e9
feat(GroupMenu): 입력받은 메뉴번호에 대한 기능을 실행하도록 구현
brotherstone97 May 12, 2023
46db2cf
feat(CustomerMenu): 입력받은 메뉴번호에 대한 기능을 실행하도록 구현
brotherstone97 May 12, 2023
a2d708e
fix(SummaryMenu): 4뿐만 아니라 5를 입력받았을 때도 누적 금액 순 정렬되는 오류를 수정
brotherstone97 May 12, 2023
ba7cad9
feat(MainRunner): 사용자가 프로그램을 종료하기 전까지 실행 상태 유지하는 기능 구현
brotherstone97 May 12, 2023
aace774
refactor(menu): 불필요하게 선언된 메서드 제거
brotherstone97 May 12, 2023
3af4da7
refactor(CustomerMenu): 메서드 분리
brotherstone97 May 12, 2023
5cead79
fix(Customers): customers의 객체를 어디에서도 생성하지 않아 나던 오류를 고침
brotherstone97 May 12, 2023
df87238
feat(menu): 각 상세메뉴에서 뒤로가기를 입력받기 전까지 해당 메뉴를 유지하도록 함
brotherstone97 May 12, 2023
9ceae4f
fix(Groups):groups객체를 어디에서도 생성하지 않아 나던 오류 수정
brotherstone97 May 14, 2023
d144cc3
feat(GroupMenu): 등록된 등급 기준이 존재하지 않을 때 예외 추가
brotherstone97 May 14, 2023
9c24857
docs(기능 목록): 예외처리 목록 추가
brotherstone97 May 15, 2023
878a549
refactor: CustomerMenu클래스에 등록된 데이터가 존재하는지 확인하는 메서드를 Validator클래스의 메서드…
brotherstone97 May 15, 2023
d4e7601
refactor: GroupMenu클래스에 등록된 등급 기준이 존재하는지 확인하는 메서드를 Validator클래스의 메서드로 분리
brotherstone97 May 15, 2023
ba09987
fix(Validator): 빈 리스트가 아닌 경우에도 비었음을 출력하던 오류를 수정
brotherstone97 May 15, 2023
89734f5
feat(group): Groups객체 생성 시 필드 groups의 초기값을 주도록 함
brotherstone97 May 15, 2023
26a4618
fix(menu): 향상된 for문 구문을 기본 for문으로 수정
brotherstone97 May 15, 2023
d2d61d7
fix(GroupMenu): 기준 입력 시 콘솔에 알맞은 메시지를 출력하도록 변경
brotherstone97 May 15, 2023
f4b52a6
fix(GroupMenu): 사용자가 원할 때까지 메뉴를 종료하지 않도록 변경
brotherstone97 May 15, 2023
081dbcc
refactor(GroupMenu): 직접 메뉴번호를 입력받는 대신 부모클래스 Menu에 정의된 readNumber메서드를 …
brotherstone97 May 15, 2023
dfc09db
fix(Customer): 향상된 for문 구문을 기본 for문으로 수정
brotherstone97 May 15, 2023
1b79226
feat: 등급 기준 신규 생성 및 업데이트 시 그 기준에 따라 고객 등급 필드가 변하도록 구현
brotherstone97 May 15, 2023
da5300c
fix(CustomerMenu): 수정 및 삭제 시 선택한 유저보다 한단계 이전 유저가 선택되던 오류를 수정
brotherstone97 May 15, 2023
28e03b9
typo(GroupType): 네이밍 룰에 맞지 않던 상수명을 올바르게 수정함
brotherstone97 May 15, 2023
8cb91b0
fix: 등급 계산 오류를 수정함
brotherstone97 May 15, 2023
1b2ef80
fix(Customers): 등급 기준 변경 시 반영이 안되던 오류를 수정
brotherstone97 May 15, 2023
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
5 changes: 5 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
.gradle
.idea
build
gradle
out
19 changes: 19 additions & 0 deletions build.gradle
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
plugins {
id 'java'
}

group 'org.example'
version '1.0-SNAPSHOT'

repositories {
mavenCentral()
}

dependencies {
testImplementation 'org.junit.jupiter:junit-jupiter-api:5.8.1'
testRuntimeOnly 'org.junit.jupiter:junit-jupiter-engine:5.8.1'
}

test {
useJUnitPlatform()
}
41 changes: 41 additions & 0 deletions docs/feature_list.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
# 기능 목록


## 콘솔, 파일을 통해 고객 등급(group) 분류 기준 CRU
1. [ ] 콘솔 및 파일을 통해 분류 기준 입력 받음
2. [X] 분류 기준 설정
3. [X] 분류 기준 조회
3. [X] 분류 기준 수정


## 고객 등급 분류 기능
(정렬 시 오름차순 또는 내림차순 선택 기능 추가)
1.[X] 분류기준에 따른 고객 분류
2.[X] 분류기준으로 분류된 고객 정보 출력
3.[X] 분류기준으로 분류된 고객 정보를 이름순(name) 정렬
4.[X] 분류기준으로 분류된 고객 정보를 총 이용시간(hours) 순으로 정렬
5. [X] 분류기준으로 분류된 고객 정보를 총 결제금액(totalAmount) 순으로 정렬

## 콘솔, 파일을 통해 고객 정보 CRUD
1. [ ] 고객 정보 입력 기능
2. [x] 고객 정보 추가
2. [X] 고객 정보 수정
3. [X] 고객 정보 조회
4. [X] 고객 정보 삭제


## 예외처리
1. [ ] 고객 분류 기준이 추가될 경우 수정된 분류기준에 따라 고객 재분류 가능해야한다.
2. [X] 고객 정보가 추가될 때, 다음 시나리오에 대한 예외 처리
- 배열의 크기가 부족할 수 있음
- 배열 크기 더블링 (x2, x1.xx)
- 기존 배열의 크기가 5 일 경우, 6번째 고객이 들어온다고 가정.
- 배열의 크기를 더블링 시키고 (10)
- 기존 배열의 데이터를 복붙하고
- 6번째 고객의 정보도 저장한다.
3. [ ] 고객 정보가 추가될 때, 다음 시나리오에 대한 예외 처리
- 배열 구멍 뚫리면 안됨
- 0, 1, 2: null, 3, 4 ⇒ 0, 1, 2, 3, 4: null
4. [ ] 배열의 저장범위를 벗어나게 되면 생기는 예외 처리
5. [ ] 상황에 알맞는 사용자 정의 예외 클래스 만들기

234 changes: 234 additions & 0 deletions gradlew
Original file line number Diff line number Diff line change
@@ -0,0 +1,234 @@
#!/bin/sh

#
# Copyright © 2015-2021 the original authors.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# https://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#

##############################################################################
#
# Gradle start up script for POSIX generated by Gradle.
#
# Important for running:
#
# (1) You need a POSIX-compliant shell to run this script. If your /bin/sh is
# noncompliant, but you have some other compliant shell such as ksh or
# bash, then to run this script, type that shell name before the whole
# command line, like:
#
# ksh Gradle
#
# Busybox and similar reduced shells will NOT work, because this script
# requires all of these POSIX shell features:
# * functions;
# * expansions «$var», «${var}», «${var:-default}», «${var+SET}»,
# «${var#prefix}», «${var%suffix}», and «$( cmd )»;
# * compound commands having a testable exit status, especially «case»;
# * various built-in commands including «command», «set», and «ulimit».
#
# Important for patching:
#
# (2) This script targets any POSIX shell, so it avoids extensions provided
# by Bash, Ksh, etc; in particular arrays are avoided.
#
# The "traditional" practice of packing multiple parameters into a
# space-separated string is a well documented source of bugs and security
# problems, so this is (mostly) avoided, by progressively accumulating
# options in "$@", and eventually passing that to Java.
#
# Where the inherited environment variables (DEFAULT_JVM_OPTS, JAVA_OPTS,
# and GRADLE_OPTS) rely on word-splitting, this is performed explicitly;
# see the in-line comments for details.
#
# There are tweaks for specific operating systems such as AIX, CygWin,
# Darwin, MinGW, and NonStop.
#
# (3) This script is generated from the Groovy template
# https://github.com/gradle/gradle/blob/master/subprojects/plugins/src/main/resources/org/gradle/api/internal/plugins/unixStartScript.txt
# within the Gradle project.
#
# You can find Gradle at https://github.com/gradle/gradle/.
#
##############################################################################

# Attempt to set APP_HOME

# Resolve links: $0 may be a link
app_path=$0

# Need this for daisy-chained symlinks.
while
APP_HOME=${app_path%"${app_path##*/}"} # leaves a trailing /; empty if no leading path
[ -h "$app_path" ]
do
ls=$( ls -ld "$app_path" )
link=${ls#*' -> '}
case $link in #(
/*) app_path=$link ;; #(
*) app_path=$APP_HOME$link ;;
esac
done

APP_HOME=$( cd "${APP_HOME:-./}" && pwd -P ) || exit

APP_NAME="Gradle"
APP_BASE_NAME=${0##*/}

# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"'

# Use the maximum available, or set MAX_FD != -1 to use that value.
MAX_FD=maximum

warn () {
echo "$*"
} >&2

die () {
echo
echo "$*"
echo
exit 1
} >&2

# OS specific support (must be 'true' or 'false').
cygwin=false
msys=false
darwin=false
nonstop=false
case "$( uname )" in #(
CYGWIN* ) cygwin=true ;; #(
Darwin* ) darwin=true ;; #(
MSYS* | MINGW* ) msys=true ;; #(
NONSTOP* ) nonstop=true ;;
esac

CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar


# Determine the Java command to use to start the JVM.
if [ -n "$JAVA_HOME" ] ; then
if [ -x "$JAVA_HOME/jre/sh/java" ] ; then
# IBM's JDK on AIX uses strange locations for the executables
JAVACMD=$JAVA_HOME/jre/sh/java
else
JAVACMD=$JAVA_HOME/bin/java
fi
if [ ! -x "$JAVACMD" ] ; then
die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME
Please set the JAVA_HOME variable in your environment to match the
location of your Java installation."
fi
else
JAVACMD=java
which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
Please set the JAVA_HOME variable in your environment to match the
location of your Java installation."
fi

# Increase the maximum file descriptors if we can.
if ! "$cygwin" && ! "$darwin" && ! "$nonstop" ; then
case $MAX_FD in #(
max*)
MAX_FD=$( ulimit -H -n ) ||
warn "Could not query maximum file descriptor limit"
esac
case $MAX_FD in #(
'' | soft) :;; #(
*)
ulimit -n "$MAX_FD" ||
warn "Could not set maximum file descriptor limit to $MAX_FD"
esac
fi

# Collect all arguments for the java command, stacking in reverse order:
# * args from the command line
# * the main class name
# * -classpath
# * -D...appname settings
# * --module-path (only if needed)
# * DEFAULT_JVM_OPTS, JAVA_OPTS, and GRADLE_OPTS environment variables.

# For Cygwin or MSYS, switch paths to Windows format before running java
if "$cygwin" || "$msys" ; then
APP_HOME=$( cygpath --path --mixed "$APP_HOME" )
CLASSPATH=$( cygpath --path --mixed "$CLASSPATH" )

JAVACMD=$( cygpath --unix "$JAVACMD" )

# Now convert the arguments - kludge to limit ourselves to /bin/sh
for arg do
if
case $arg in #(
-*) false ;; # don't mess with options #(
/?*) t=${arg#/} t=/${t%%/*} # looks like a POSIX filepath
[ -e "$t" ] ;; #(
*) false ;;
esac
then
arg=$( cygpath --path --ignore --mixed "$arg" )
fi
# Roll the args list around exactly as many times as the number of
# args, so each arg winds up back in the position where it started, but
# possibly modified.
#
# NB: a `for` loop captures its iteration list before it begins, so
# changing the positional parameters here affects neither the number of
# iterations, nor the values presented in `arg`.
shift # remove old arg
set -- "$@" "$arg" # push replacement arg
done
fi

# Collect all arguments for the java command;
# * $DEFAULT_JVM_OPTS, $JAVA_OPTS, and $GRADLE_OPTS can contain fragments of
# shell script including quotes and variable substitutions, so put them in
# double quotes to make sure that they get re-expanded; and
# * put everything else in single quotes, so that it's not re-expanded.

set -- \
"-Dorg.gradle.appname=$APP_BASE_NAME" \
-classpath "$CLASSPATH" \
org.gradle.wrapper.GradleWrapperMain \
"$@"

# Use "xargs" to parse quoted args.
#
# With -n1 it outputs one arg per line, with the quotes and backslashes removed.
#
# In Bash we could simply go:
#
# readarray ARGS < <( xargs -n1 <<<"$var" ) &&
# set -- "${ARGS[@]}" "$@"
#
# but POSIX shell has neither arrays nor command substitution, so instead we
# post-process each arg (as a line of input to sed) to backslash-escape any
# character that might be a shell metacharacter, then use eval to reverse
# that process (while maintaining the separation between arguments), and wrap
# the whole thing up as a single "set" statement.
#
# This will of course break if any of these variables contains a newline or
# an unmatched quote.
#

eval "set -- $(
printf '%s\n' "$DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS" |
xargs -n1 |
sed ' s~[^-[:alnum:]+,./:=@_]~\\&~g; ' |
tr '\n' ' '
)" '"$@"'

exec "$JAVACMD" "$@"
89 changes: 89 additions & 0 deletions gradlew.bat
Original file line number Diff line number Diff line change
@@ -0,0 +1,89 @@
@rem
@rem Copyright 2015 the original author or authors.
@rem
@rem Licensed under the Apache License, Version 2.0 (the "License");
@rem you may not use this file except in compliance with the License.
@rem You may obtain a copy of the License at
@rem
@rem https://www.apache.org/licenses/LICENSE-2.0
@rem
@rem Unless required by applicable law or agreed to in writing, software
@rem distributed under the License is distributed on an "AS IS" BASIS,
@rem WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@rem See the License for the specific language governing permissions and
@rem limitations under the License.
@rem

@if "%DEBUG%" == "" @echo off
@rem ##########################################################################
@rem
@rem Gradle startup script for Windows
@rem
@rem ##########################################################################

@rem Set local scope for the variables with windows NT shell
if "%OS%"=="Windows_NT" setlocal

set DIRNAME=%~dp0
if "%DIRNAME%" == "" set DIRNAME=.
set APP_BASE_NAME=%~n0
set APP_HOME=%DIRNAME%

@rem Resolve any "." and ".." in APP_HOME to make it shorter.
for %%i in ("%APP_HOME%") do set APP_HOME=%%~fi

@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
set DEFAULT_JVM_OPTS="-Xmx64m" "-Xms64m"

@rem Find java.exe
if defined JAVA_HOME goto findJavaFromJavaHome

set JAVA_EXE=java.exe
%JAVA_EXE% -version >NUL 2>&1
if "%ERRORLEVEL%" == "0" goto execute

echo.
echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
echo.
echo Please set the JAVA_HOME variable in your environment to match the
echo location of your Java installation.

goto fail

:findJavaFromJavaHome
set JAVA_HOME=%JAVA_HOME:"=%
set JAVA_EXE=%JAVA_HOME%/bin/java.exe

if exist "%JAVA_EXE%" goto execute

echo.
echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME%
echo.
echo Please set the JAVA_HOME variable in your environment to match the
echo location of your Java installation.

goto fail

:execute
@rem Setup the command line

set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar


@rem Execute Gradle
"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %*

:end
@rem End local scope for the variables with windows NT shell
if "%ERRORLEVEL%"=="0" goto mainEnd

:fail
rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of
rem the _cmd.exe /c_ return code!
if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1
exit /b 1

:mainEnd
if "%OS%"=="Windows_NT" endlocal

:omega
2 changes: 2 additions & 0 deletions settings.gradle
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
rootProject.name = 'KDTBE5_Java_ToyProject'

Loading