Programming Assignment # 4:  Files, conditionals, and loops

Due 9/17/2009

 

Do problem 16 on page 253 ( http://www.cs.panam.edu/~schwellerr/6302F09/homework/page1.pdf ), modified as follows:

 

Rather than reading a file that includes only a single customer, design your program to read in a file containing multiple customers.  Assume the file has the following format:  The first line of the file is an integer specifying how many customers are stored in the file.  Each proceeding line then consists of a customer’s name followed by their package, followed by the number of hours used.  An example file is as follows:

 

5

Schweller B 19

Garret C 59

Kolter C 12

Schwarzeneger A 237

Hansen B 23

 

As output, write to a file “billing.dat” a list of each customer followed by their total bill for the month.  For the above file, the corresponding output file should contain:

 

Schweller $14.95

Garret $19.95

Kolter $19.95

Schwarzeneger $463.95

Hansen $17.95