005-003-011
Nested If Statements and Compound Conditions
Hard
Problem Description
Nested If Statements and Compound Conditions
In this problem, you will create a program that reads three values from standard input (age, membership flag, and score), determines membership status using nested if statements, and displays the result to standard output.
Learning Objective: Understand writing nested if statements and compound conditions with logical operators
Overview
Nesting if statements inside if enables staged condition evaluation. Logical operators express compound conditions in a single if.
Input Format
age (int)
membership flag (true or false)
score (int)
Specifications
- Read age (int), isMember (boolean), and score (int) using Scanner
- Nested if: age 18+ > member > score 80+: "Gold member", under 80: "Silver member", non-member: "Guest", under 18: "Minor"
Output Format
Status: Gold member
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