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

Test Cases

※ Output examples follow programming industry standards

Input:
6000
Expected Output:
Purchase amount: 6000 yen
Discount applied
Input:
3000
Expected Output:
Purchase amount: 3000 yen
Regular price
Input:
5000
Expected Output:
Purchase amount: 5000 yen
Discount applied
Input:
100
Expected Output:
Purchase amount: 100 yen
Regular price
❌ 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 10 free executions remaining