003-004-006
Compound Assignment: Point Update
Easy
Problem Description
Compound Assignment: Point Update
Learning Objective: Learn to update variables efficiently using compound assignment operators (+=)
Manage point card points. Add new points to current points and display the total.
Input
Line 1: Current points (integer)
Line 2: Earned points (integer)
Output
Current: [points1] pt
Earned: [points2] pt
Total: [points1+points2] pt
Test Cases
※ Output examples follow programming industry standards
Input:
150 50
Expected Output:
Current: 150 pt Earned: 50 pt Total: 200 pt
Input:
500 1000
Expected Output:
Current: 500 pt Earned: 1000 pt Total: 1500 pt
Input:
0 100
Expected Output:
Current: 0 pt Earned: 100 pt Total: 100 pt
❌ 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
