Skip to content

Conversation

@eoueono
Copy link

@eoueono eoueono commented Jan 26, 2025

No description provided.

@@ -0,0 +1,25 @@
import java.util.Scanner;
public class Calculator {
public static void main(String[] args) {

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. : ");

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);

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();

// 쉼표와 콜론으로 숫자들 분리

Choose a reason for hiding this comment

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

계산 로직을 별개의 메소드로 분리하면 좋을 것 같아요!

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