005-004-002

Logical Operators: Event Entry

Easy

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

Normal case
Input:
25
true
Expected Output:
Age: 25 years old
Member: true
Event entry OK
Normal case
Input:
16
false
Expected Output:
Age: 16 years old
Member: false
Event entry NG

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 10 free executions remaining