001-002-005

Variable Assignment: Shopping Total Calculation

Easy

Problem Description

Variable Assignment: Shopping Total Calculation

Learning Objective: Assign values to multiple variables and use them for calculations

Create a program that calculates the total amount when buying two items. When you input the price of each item, it calculates and displays the total.

Input

Line 1: Price of item A (integer, yen)
Line 2: Price of item B (integer, yen)

Output

================================
        Receipt
================================
Item A: [priceA] yen
Item B: [priceB] yen
------------------------
Total: [total] yen
================================
```java

## Examples

### Example 1: 500 and 300 yen Purchase
Input:
```java
500
300
```java
Output:
```java
================================
        Receipt
================================
Item A: 500 yen
Item B: 300 yen
------------------------
Total: 800 yen
================================
```java

### Example 2: 1200 and 800 yen Purchase
Input:
```java
1200
800
```java
Output:
```java
================================
        Receipt
================================
Item A: 1200 yen
Item B: 800 yen
------------------------
Total: 2000 yen
================================
```java

### Example 3: 0 and 100 yen Purchase
Input:
```java
0
100
```java
Output:
```java
================================
        Receipt
================================
Item A: 0 yen
Item B: 100 yen
------------------------
Total: 100 yen
================================

Test Cases

※ Output examples follow programming industry standards

Input:
500
300
Expected Output:
================================
      Receipts
================================
ProductA: 500 yen
ProductB: 300 yen
------------------------
Total: 800 yen
================================
Input:
1200
800
Expected Output:
================================
      Receipts
================================
ProductA: 1200 yen
ProductB: 800 yen
------------------------
Total: 2000 yen
================================
Input:
0
100
Expected Output:
================================
      Receipts
================================
ProductA: 0 yen
ProductB: 100 yen
------------------------
Total: 100 yen
================================
❌ Some tests failed
❌ エラー発生

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 6 free executions remaining