003-003-001
Logical Operators: Discount Eligibility
Easy
Problem Description
Logical Operators: Discount Eligibility
Learning Objective: Learn to check any of multiple conditions using the OR operator (||)
Determine restaurant discount eligibility. Discount applies if either "senior 65 or older" OR "child 12 or younger" is satisfied.
Input
Line 1: Age (integer)
Output
If eligible for discount:
Age: [age] years old
Discount applies
```java
If not eligible:
```java
Age: [age] years old
Regular price
Test Cases
※ Output examples follow programming industry standards
Input:
70
Expected Output:
Age: 70 years old Discount applies
Input:
8
Expected Output:
Age: 8 years old Discount applies
Input:
35
Expected Output:
Age: 35 years old Regular price
❌ Some tests failed
Your Solution
Current Mode:● My Code
99
1
2
3
4
5
6
7
8
9
10
›
⌄
⌄
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 6 free executions remaining
