Starting from:

$30

IT210- Programming Assignment 3 Solved

Your program should expect to read a file similar to the one shown below (and also available on D2L).

Your program should:

·         Prompt for the name of the file to process and issue an error message and terminate if that file can’t be opened

·         Verify that each line has the correct number of items and terminate if it does not

·         Verify that the dollar amount is a valid floating-­‐point number and terminate if it is not

·         Keep a list with the categories that are encountered (they may be different than below) and another list with the cumulative dollar amount for each category. These are two lists but the elements in one relate to the elements in the other (by position)

·         Close the file when all the data has been processed

·         Display the categories and the total for each one

Sample input file:

Bob;Dinner;10.00;January 1, 2015 Tom;Dinner;14.00;January 2, 2015 Anne;Lodging;125.00;January 3, 2015 Jerry;Lodging;125.00;January 4, 2015

Output from running with the above correct file should be:

Enter the name of the file to display: input.txt

Totals:

Dinner: $ 24.00 Lodging: $ 250.00

More products