001-002-005
Variable Assignment: Shopping Total Calculation
Easy
Problem Description
variable Assignment: Shopping Total Calculation
In this problem, you will create a program that reads two item prices into integer variables, calculates their total, and displays the result in a formatted receipt layout to standard output.
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
================================
Ready to Try Running Code?
Log in to access the code editor and execute your solutions for this problem.
Don't have an account?
Sign Up