005-004-006

Nested Conditions: Discount Calculation System

Easy

Problem Description

Nested Conditions: Discount Calculation System

In this problem, you will create a program that reads membership status and product price from standard input, determines a discount rate using nested if statements, then displays the final price to standard output.

Learning Objective: Understand how to implement complex decision logic using nested conditional branches

Overview

Create a program that reads product price and membership status from standard input, determines the discount rate, then calculates the final price.

Specifications

  • Read price (price) and isMember (membership flag) from standard input
  • Discount rules
    • If member
      • Price >= 5000: 20% discount
      • Price < 5000: 10% discount
    • If non-member
      • Price >= 5000: 5% discount
      • Price < 5000: No discount

Input Format

price (integer)
isMember (true/false)

Output Format

Example with input: 6000, true

Original Price: 6000
Discount Rate: 20%
Final Price: 4800

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