003-004-002

Compound Assignment: Price with Tax

Easy

Problem Description

Compound Assignment: Price with Tax

In this problem, you will create a program that reads a pre-tax price, calculates 10% consumption tax using compound assignment operators, and displays the pre-tax price, tax amount, and total price to standard output.

Learning Objective: Learn to calculate price with tax by combining compound assignment operators (+=) with arithmetic operations

Calculate price including tax. Add 10% consumption tax to pre-tax price to get the total.

Input

Line 1: Pre-tax price (integer)

Output

Pre-tax: [price] yen
Tax: [tax] yen
Total: [total] yen

Test Cases

※ Output examples follow programming industry standards

Normal case
Input:
1000
Expected Output:
Pre-tax: 1000 yen
Tax: 100 yen
Total: 1100 yen
Normal case
Input:
5000
Expected Output:
Pre-tax: 5000 yen
Tax: 500 yen
Total: 5500 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