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 determines membership status using nested if statements based on three variables (age, membership flag, and score) 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.

Specifications

  • Set int age=25, boolean isMember=true, int score=85
  • 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?