Flow Control 2

Description

The purpose of this challenge is to use the IF statement to control program flow. This challenge simulates a simple Point-Of-Sale (POS) system.

Requirements

Feel like a challenge? Go straight to the output without looking at the step-by-step requirements!

  1. Declare a double variable called cost
  2. Declare a char variable called is_electronic
  3. Declare a string variable called item
  4. Declare a double called fee
  5. Ask the user to enter a string that describes a single item that is being returned
  6. Ask the user to enter the cost of the item
  7. Ask the user if the item is electronic (Ask the user to enter a single character and store this in is_electronic)
  8. If the item is electronic, calculate restocking fee as 30% of the cost
  9. Display a friendly summary message and display the appropriate restocking fee as needed

Hints

  1. Include the <iomanip> header file. This will allow you to use various options to format your output
  2. It’s good practice to initialize variables to default values that make sense (for example, set fee to 0.00)
  3. Include the code below before any other cout lines. The setprecision(x) will display your decimal output with x decimal places.
cout << fixed << setprecision(2);

Sample Interaction / Output

-- Welcome to LOSS --
What item are you returning? laptop
Cost of laptop? 1200
Is this item electronic (y/n)? y

We're bummed you had to make a return. Please pay a restocking fee of $360.00

RUN IT AGAIN:

-- Welcome to LOSS --
What item are you returning? sweater
Cost of sweater? 22.99
Is this item electronic (y/n)? n

We're bummed you had to make a return. There is no restocking fee.

LEGEND
PROGRAM OUTPUT
USER ENTRY 
FROM INPUT 

CATALOG ID: CPP-FLOW0002

Print Requirements