003-001-002

Arithmetic Operators: Shopping Total Calculation

Easy

Problem Description

Arithmetic Operators: Shopping Total Calculation

In this problem, you will create a program that reads two item prices as integers, calculates the total using the addition operator (+), and displays the result to standard output.

Learning Objective: Learn to add multiple item prices using the addition operator (+) to calculate the total amount

Calculate the total shopping amount. Input prices of 2 items and display the total.

Input

Line 1: Item 1 price (integer)
Line 2: Item 2 price (integer)

Output

Item 1: [price1] yen
Item 2: [price2] yen
Total: [price1+price2] yen

Test Cases

※ Output examples follow programming industry standards

Normal case
Input:
500
300
Expected Output:
Item 1: 500 yen
Item 2: 300 yen
Total: 800 yen
Normal case
Input:
1200
800
Expected Output:
Item 1: 1200 yen
Item 2: 800 yen
Total: 2000 yen

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