005-004-003

Logical Operators: Discount Eligibility

Easy

Problem Description

Logical Operators: Discount Eligibility

In this problem, you will create a program that reads an age as input, evaluates a compound condition (65 or older OR 12 or younger) using the || (logical OR) operator, and displays whether a discount applies to standard output.

Learning Objective: Combine multiple conditions with logical OR operator

Create a program that inputs an age and determines discount eligibility. Use the || (OR) operator to apply a discount when the age is 65 or older OR 12 or under.

Input

Line 1: Age (integer)

Output

When eligible:

Age: [age] years old
Discount applied

When not eligible:

Age: [age] years old
Regular price

Examples

Example 1: Senior (65+)

Input:

70

Output:

Age: 70 years old
Discount applied

Example 2: Child (12 or under)

Input:

10

Output:

Age: 10 years old
Discount applied

Example 3: General (13-64)

Input:

30

Output:

Age: 30 years old
Regular price

Test Cases

※ Output examples follow programming industry standards

Input:
70
Expected Output:
Age: 70 years old
Discount applied
Input:
10
Expected Output:
Age: 10 years old
Discount applied
Input:
65
Expected Output:
Age: 65 years old
Discount applied
Input:
130
Expected Output:
Age: 130 years old
Discount applied
❌ 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 9 free executions remaining