Assignment 1 - Processing the shopping list

due October 1st

The purpose of this assignment is to review the use of  reading and writing text files, writing functions, and formatting output.

Part 1 Detail

Read in the shopping list file, partially shown below. This file consists of a heading line and a list of items and their cost.  

The Shopping List File

Shopping List
banana 0.50
book 139.95
eraser 0.509
flashdrive 9.99
folder 1.00
highlighter 0.98
...

You are to process the input data and produce the report file shown below.  The output format must match exactly that shown below.  The the column widths are 12, 10, 8, and 12.

Item                  Cost      Tax    Subtotal
-----------         ------    -----    --------
banana                0.50     0.00        0.50
book                139.95    12.60      152.55
eraser                0.51     0.05        0.55
flashdrive            9.99     0.90       10.89
folder                1.00     0.09        1.09
highlighter           0.98     0.09        1.07
laptop              559.99    50.40      610.39
...
                                       --------
                                Total    8??.??
The tax rate is 9%, but there is no tax on the banana or the water.

Program requirements

  1. Make sure you check for successful file opens.
  2. Include at least 3 named constants.  Suggestions: input file name, output file name, and tax rate.
  3. Include at least 2 functions besides main().  Suggestions: a function to return the tax amount, a function to write the headings.
  4. Place the function definitions below main() and function prototypes above main().
  5. You may not modify the input file.