003-003-007
Logical Operators: Membership Eligibility
Easy
Problem Description
Logical Operators: Membership Eligibility
Learning Objective: Learn to check that all conditions are met using the AND operator (&&)
Determine shopping mall membership eligibility. Can register as member when both "18 or older" AND "purchase 3000 yen or more" are satisfied.
Input
Line 1: Age (integer)
Line 2: Purchase amount (integer)
Output
If both conditions met:
Age: [age] years old
Purchase: [amount] yen
Eligible for membership
```java
If either condition not met:
```java
Age: [age] years old
Purchase: [amount] yen
Not eligible for membership
Test Cases
※ Output examples follow programming industry standards
Input:
25 5000
Expected Output:
Age: 25 years old Purchase: 5000 yen Eligible for membership
Input:
16 5000
Expected Output:
Age: 16 years old Purchase: 5000 yen Not eligible for membership
Input:
18 3000
Expected Output:
Age: 18 years old Purchase: 3000 yen Eligible for membership
❌ 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 10 free executions remaining
