005-004-005
Logical Operators: Event Entry
Easy
Problem Description
Logical Operators: Event Entry
Learning Objective: Combine multiple conditions with logical AND operator
In this problem, you will create a program that reads age (integer) and membership flag (true/false) from standard input, evaluates the condition "age >= 18 AND member registered" using the && operator, and displays the event entry eligibility to standard output.
Create program that inputs age and membership to judge event entry eligibility. Use && (AND) operator to allow entry only when 18+ AND member.
Input
Line 1: Age (integer)
Line 2: Member flag (true=member, false=non-member)
Output
When both met:
Age: [age] years old
Member: [status]
Event entry OK
```java
When either not met:
```java
Age: [age] years old
Member: [status]
Event entry NG
```java
## Examples
### Example 1: Both conditions met
Input:
```java
20
true
```java
Output:
```java
Age: 20 years old
Member: true
Event entry OK
```java
### Example 2: Age met but not member
Input:
```java
20
false
```java
Output:
```java
Age: 20 years old
Member: false
Event entry NG
```java
### Example 3: Member but age not met
Input:
```java
15
true
```java
Output:
```java
Age: 15 years old
Member: true
Event entry NG
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