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

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 1:
Enter receipt filename: receipt.txt
Rice 1kg : $ 2.99
Pasta sauce 500g : $ 3.20
Grass fed beef 2kg : $32.99
3 items
Total price : $39.18
Example run 2:
Enter receipt filename: abc.txt
Receipt file doesn't exist!

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Programming Questions!