IC210 AY16 Practice 6Wk Practicum Problem

How to submit a solution

You will be using the submit script to submit your practicum solution.
  1. To submit your solution give the command:
    submit pp6wk pp6wk.cpp

Problem 1

Write a program with source file named pp6wk.cpp that reads in a line containing a price (with leading $), followed by a one-word decriptor (e.g. drink, food, paper ...), followed by another descriptor that is ether "regular" or "sale" and, if the descriptor is "sale", a percent value for the discount, and prints out a final price (with leading $) according to the following rules:
  1. sales tax is 7% of the final cost (i.e. after discounts) of an item
  2. an item marked "sale" gets discounted from the original price by the percentage given
  3. food items are not assessed sales tax
~/$ ./prob1
$45.99 clothing sale 10%
$44.2884
~/$ ./prob1
$45.99 food sale 10%
$41.391
~/$ ./prob1
$45.99 food regular
$45.99
~/$ ./prob1
$14.55 electronics sale 20.5%
$12.377