007-001-007
Class Creation: Calculator Class
Easy
Problem Description
Class Creation: Calculator Class
Learning Objective: Create simple class and call methods
Create calculator class that can add and subtract two numbers. Implement add and subtract methods in class.
Input
Line 1: Number 1 (integer)
Line 2: Number 2 (integer)
Output
Addition: [result]
Subtraction: [result]
```java
## Examples
### Example 1: Calculate 10 and 5
Input:
```java
10
5
```java
Output:
```java
Addition: 15
Subtraction: 5
```java
### Example 2: Calculate 20 and 15
Input:
```java
20
15
```java
Output:
```java
Addition: 35
Subtraction: 5
```java
### Example 3: Calculate 0 and 0 (boundary)
Input:
```java
0
0
```java
Output:
```java
Addition: 0
Subtraction: 0
Test Cases
※ Output examples follow programming industry standards
Input:
10 5
Expected Output:
Addition: 15 Subtraction: 5
Input:
20 15
Expected Output:
Addition: 35 Subtraction: 5
Input:
0 0
Expected Output:
Addition: 0 Subtraction: 0
❌ Some tests failed
Your Solution
Current Mode:● My Code
99
1
2
3
4
5
6
7
8
9
10
›
⌄
⌄
import java.util.Scanner;
public class Main {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
// Write your code here
sc.close();
}
}
0 B / 5 MB
You have 9 free executions remaining
