005-001-007
If Statement: Discount Check
Easy
Problem Description
if statement: Discount Check
Learning Objective: Perform conditional judgment with if statement
In this problem, you will create a program that reads a purchase amount, uses an if-else statement to check whether it is 5000 yen or more, and displays "Discount applied" or "Regular price" to standard output.
Create a program that inputs a purchase amount and displays "Discount applied" if the amount is 5000 yen or more, or "Regular price" if it is under 5000 yen. Use an if-else statement for branching.
Input
Line 1: Purchase amount (integer)
Output
For 5000+:
Purchase amount: [amount] yen
Discount applied
```java
For under 5000:
```java
Purchase amount: [amount] yen
Regular price
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