Project 0, Shopping List

Short Description:

Write a program that will produce a cost estimate for a shopping trip.

This assignment is worth 0 points.

Goals

When you finish this homework, you should have:

Formal Description

You have started using the HelpMeCook app, which is a great application for planning dinners. Unfortunately, it wants to do all of your shopping for you at HighPrice.com. Fortunately, you have found a way around the system. You have convinced HelpMeCook to write the shopping list to a file. This file consists of an item description, the cost of the item at HighPrice.com and the quantity of each item needed.

The output file from HelpMeCook might be

Bananas| 2.00 1
Sugar| 1.80 1
Milk| 3.00 2
Nilla Wafers| 3.45 4
Eggs| 2.99 1  
Note, the app puts a bar (|) after the item description.

Additionally, you have found that MyLocalStore.com has a web page that will take a list of items as described above and return the cost for each item. The output from MyLocalStore.com is a file containing the item description and the price for each item.

An example file from MyLocalStore.com might be

Bananas| 1.40
Sugar| 0.99
Milk| 1.38
Nilla Wafers| 2.99
Eggs| 1.00
This file also has the bar after the item description.

You may assume that

To simplify things, your basic system creates a file called shopping.txt. This file contains the names of the files containing the shopping list for HighPrice.com and the shopping list for MyLocalStore.com. The file might contain

HighDinner.dat
LocalDinner.dat

Your task is to write a program that computes

You should output this in the following format
  1. An item number starting with 1.
  2. The Item description, not including the bar.
  3. Quantity of the item.
  4. The price per unit at HighPrice.com
  5. The price per unit at MyLocalStore.com
  6. The total cost at MyLocalStore.com
  7. The total savings for this item.
Finally, print the total cost for each store and the total savings. Please see the example below for the exact format.
A   B                   C    D      E      F      G
123412345678901234567890123451234567123456712345671234567
   1             Bananas    1   2.00   1.40   1.40   0.60
   2               Sugar    1   1.80   0.99   0.99   0.81
   3                Milk    2   3.00   1.38   2.76   3.24
   4        Nilla Wafers    4   3.45   2.99  11.96   1.84
   5                Eggs    1   2.99   1.00   1.00   1.99

Total cost at MyLocalStore.com 18.11
Savings 8.48
Please note,

Example Files

Other Notes

Required Files

A single tar file containing the source code and makefile for this program.

Please use this Makefile.

Submission

You don't have to do this program, so you don't need to submit it.