Logical Operators: Event Entry
Problem Description
Logical Operators: Event Entry
In this problem, you will create a program that reads age and membership status from standard input, evaluates both conditions simultaneously using the && (AND) operator, determines event entry eligibility, and displays the result to standard output.
Learning Objective: Combine multiple conditions with logical AND operator
Create a program that inputs age and membership status to judge event entry eligibility. Use the && (AND) operator to allow entry only when the user is 18 or older AND a registered member.
Input
Line 1: Age (integer)
Line 2: Member flag (true=member, false=non-member)
Output
When both conditions are met:
Age: [age] years old
Member: [status]
Event entry OK
When either condition is not met:
Age: [age] years old
Member: [status]
Event entry NG
Examples
Example 1: Both conditions met
Input:
20
true
Output:
Age: 20 years old
Member: true
Event entry OK
Example 2: Age met but not a member
Input:
20
false
Output:
Age: 20 years old
Member: false
Event entry NG
Example 3: Member but age not met
Input:
15
true
Output:
Age: 15 years old
Member: true
Event entry NG
Test Cases
※ Output examples follow programming industry standards
25 true
Age: 25 years old Member: true Event entry OK
16 false
Age: 16 years old Member: false Event entry NG
Your Solution
You have 10 free executions remaining
