001-004-002

Variable Value Update: Point Update

Easy

Problem Description

variable Value Update: Point Update

In this problem, you will create a program that stores initial points in an integer variable, updates its value by adding points from two shopping trips using the += operator, and displays the result at each stage to standard output.

Learning Objective: Understand how to change variable values later

Create a point card app. Input your initial points and add points from two shopping trips. Display points after each shopping trip.

Input

Line 1: Initial points (integer, pt)
Line 2: Points earned from first shopping trip (integer, pt)
Line 3: Points earned from second shopping trip (integer, pt)

Output

================================
     Point Update Card
================================
Initial Points: [initial points]pt
After 1st Shopping: [updated points]pt
After 2nd Shopping: [final points]pt
================================

Examples

Example 1: 100pt plus 50pt and 30pt

Input:

100
50
30

Output:

================================
     Point Update Card
================================
Initial Points: 100pt
After 1st Shopping: 150pt
After 2nd Shopping: 180pt
================================

Test Cases

※ Output examples follow programming industry standards

Normal case
Input:
200
75
25
Expected Output:
================================
  Point Update Card
================================
Initial Points: 200pt
After 1st Shopping: 275pt
After 2nd Shopping: 300pt
================================
Normal case
Input:
0
100
200
Expected Output:
================================
  Point Update Card
================================
Initial Points: 0pt
After 1st Shopping: 100pt
After 2nd Shopping: 300pt
================================

Your Solution

Current Mode: My Code
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