This repository has been archived by the owner on Aug 6, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 7
2회차 과제 PR (차준혁) #20
Open
JunHyeok-Cha
wants to merge
4
commits into
SoongSilComputingClub:JunHyeok-Cha
Choose a base branch
from
JunHyeok-Cha:JunHyeok
base: JunHyeok-Cha
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
2회차 과제 PR (차준혁) #20
JunHyeok-Cha
wants to merge
4
commits into
SoongSilComputingClub:JunHyeok-Cha
from
JunHyeok-Cha:JunHyeok
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
문자열 사칙 연산 계산기 구현
SetTest와 StringTest 파일을 삭제 한 것은 기존에 경로를 잘못 저장했던 파일을 삭제 한 것입니다. |
findstar
suggested changes
Jul 17, 2022
Comment on lines
+23
to
+40
public int partCalculate(String operator, int result, String input){ | ||
|
||
if(input == null || input.equals("")) throw new IllegalArgumentException(); | ||
|
||
switch (operator){ | ||
case "+": | ||
return plus(result, input); | ||
case "-": | ||
return minus(result, input); | ||
case "*": | ||
return multiply(result, input); | ||
case "/": | ||
return division(result, input); | ||
default: | ||
throw new IllegalArgumentException(); | ||
} | ||
|
||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Enum 과 BiFunction을 활용하는 방식을 적용해 볼 수 있습니다.
Operator로직을 별도의 클래스로 분리해보세요.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
return minus(result, input); 이 코드는 테스트 코드에서 수행되지 않았습니다.
minus 의 경우도 테스트 되도록 테스트 코드를 보완해주세요.
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
문자열 사칙 연산 계산기 구현 & 테스트