Receipt Processing Program For this bonus task, you will produce a program that asks a user for
Fantastic news! We've Found the answer you've been seeking!
Question:
Receipt Processing Program
For this bonus task, you will produce a program that asks a user for a receipt filename, reads the file, counts the number of items in the file, and reports their total price.
You can reuse a large amount of the code from the previous solution, but there is still one very tricky part to the task.
You will need to extract the price from each line in the file, as the item name and price are combined in a single string. You already have all of the tools in your toolbelt, but here are a couple of hints:
You'll need to find the dollar symbol to know where to perform slicing.
Prices will need to be converted to a float in order to be aggregated.
Example run :
Enter receipt filename: receipt.txt
Rice kg : $
Pasta sauce g : $
Grass fed beef kg : $
items
Total price : $
Example run :
Enter receipt filename: abc.txt
Receipt file doesn't exist!
Related Book For
Concepts of Database Management
ISBN: 978-1285427102
8th edition
Authors: Philip J. Pratt, Mary Z. Last
Posted Date: