003-004-003
Assignment Operators: Point Balance Update
Easy
Problem Description
Assignment Operators: Point Balance Update
Learning Objective: Efficiently update variable values using compound assignment operators (+=, -=, *=, /=)
Create a store point card system. Use compound assignment operators to concisely write point additions and subtractions.
Input
Line 1: Current points (integer)
Line 2: Points to add (integer)
Line 3: Points to use (integer)
Output
Current: [current points]pt
After add: [after add points]pt
After use: [after use points]pt
Test Cases
※ Output examples follow programming industry standards
Input:
100 50 30
Expected Output:
Current: 100pt After add: 150pt After use: 120pt
Input:
500 200 100
Expected Output:
Current: 500pt After add: 700pt After use: 600pt
Input:
0 100 50
Expected Output:
Current: 0pt After add: 100pt After use: 50pt
❌ 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 10 free executions remaining
