Assignment 1 - Processing the student shopping list

due October 2nd

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 student shopping list file, partially shown below. This file consists of a heading line and a list of items and their cost.  

The Student Shopping List File

Student's Shopping List
apple 0.89
book 135.00
eraser 0.59
flashdrive 7.99
folder 1.29
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 16, 10, 9, and 12.

Item                  Cost      Tax    Subtotal
-----------         ------    -----    --------
apple                 0.89     0.00        0.89
book                135.00    12.15      147.15
eraser                0.59     0.05        0.64
flashdrive            7.99     0.72        8.71
folder                1.29     0.12        1.41
highlighter           0.98     0.09        1.07
                                Total    7??.??
The tax rate is 9%, but there is no tax on the apple 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.