-
Notifications
You must be signed in to change notification settings - Fork 85
[전서영] 계산기 구현 1차 #60
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
base: main
Are you sure you want to change the base?
[전서영] 계산기 구현 1차 #60
Conversation
@@ -0,0 +1,25 @@ | |||
import java.util.Scanner; | |||
public class Calculator { | |||
public static void main(String[] args) { |
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.
요구사항에 메인 메소드를 사용하지 말라는 부분이 있었습니다!
Scanner scanner = new Scanner(System.in); | ||
|
||
// 숫자 입력받기 | ||
System.out.println("Please enter the numbers. : "); |
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.
숫자만 입력받는 형식이 아니기 때문에, "Please enter numbers separated by commas or colons (e.g., 1,2:3): "
와 같은 형식으로 안내되면 좋을 것 같아요!
} | ||
|
||
System.out.println("Results: " + sum); | ||
|
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.
유효하지 않은 값이나, 음수 값이 입력되었을 경우 등에 대한 예외 처리가 필요할 것 같아요!
System.out.println("Please enter the numbers. : "); | ||
String expression = scanner.nextLine(); | ||
|
||
// 쉼표와 콜론으로 숫자들 분리 |
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.
계산 로직을 별개의 메소드로 분리하면 좋을 것 같아요!
No description provided.