Open
Conversation
Author
|
로직 만들고, 구현해보는게 처음인지라 다각면에서 이리저리 봐주시면 감사드리겠습니다:) |
UiHyeon-Kim
reviewed
Apr 5, 2025
Member
UiHyeon-Kim
left a comment
There was a problem hiding this comment.
1주차 고생하셨습니다~
요구 사항을 조금 더 확인해보고, 기본 요구 사항을 조금 더 지킬 수 있도록 해보면 좋을 것 같아요.
| // TODO: 코드 구현 | ||
| throw new IllegalArgumentException("아직 구현되지 않았습니다."); | ||
| int num = 0; | ||
| int number = 0; |
Member
There was a problem hiding this comment.
num과 number가 서로 무슨 역할을 하는지 헷갈릴 수 있을 것 같아요.
firstOperand, secondOperand처럼 서로 구분이 가도록 이름 짓는 연습을 하면 나중에 협업을 할 때도 도움이 될 거예요!
| int num = 0; | ||
| int number = 0; | ||
| char operation = ' '; | ||
| StringBuilder sb = new StringBuilder(); |
Member
There was a problem hiding this comment.
StringBuilder를 사용한 방법 정말 좋아요
String의 단점을 파악하고 사용하신 건가요? 궁금합니다
| else if (operation == '-') num -= number; | ||
| else if (operation == '*') num *= number; | ||
| else if (operation == '/') num /= number; | ||
| } |
Member
There was a problem hiding this comment.
0으로 나눴을 때 오류가 나는데 이 부분도 오류를 처리해 준다면 더 좋을 것 같아요
| } else if (ch == '+' || ch == '-' || ch == '*' || ch == '/') { | ||
|
|
||
| if (sb.length() == 0) { | ||
| System.out.println("숫자 없이 연산자가 들어왔습니다!"); |
Member
There was a problem hiding this comment.
28번 줄에서 throw 처리해 준 것처럼 여기도 print가 아닌 throw 처리로 해준다면 조금 더 일관성이 있는 코드가 될 것 같아요.
daeun-ver
reviewed
Apr 6, 2025
daeun-ver
left a comment
There was a problem hiding this comment.
제가 작성한 코드와 크게 다르지않아 재밌었어요!
1주차 수고 많으셨습니다~
| char operation = ' '; | ||
| StringBuilder sb = new StringBuilder(); | ||
|
|
||
| input = input.trim().replaceAll("\\s+", ""); |
| num *= number; | ||
| } else if (operation == '/') { | ||
| num /= number; | ||
| } |
This file contains hidden or 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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
로직 만들고, 구현해보는게 처음인지라 다각면에서 이리저리 봐주시면 감사드리겠습니다:)