005-003-008

Member Rank Determination with Nested If Statements

Medium

Problem Description

Member Rank Determination with Nested If Statements

In this problem, you will create a program that reads a membership flag (true / false) and a purchase amount (integer) from standard input, then uses nested if statements — the outer check for membership, the inner check for purchase amount — to determine and print a rank.

Input Format:

<isMember: true or false>
<purchaseAmount: integer>

Output Format:

Rank: Gold     // member AND purchaseAmount >= 10000
Rank: Silver   // member AND purchaseAmount < 10000
Rank: Guest    // not a member

Learning Objectives:

  • Implement hierarchical conditional logic using nested if statements
  • Understand the role of outer and inner conditions in a nested structure
  • Combine boolean variables and integer comparisons in multi-level branching

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