Question: Write a program that prints the total amount owed for a cart full of groceries to a text file, and saves the file to a
Write a program that prints the total amount owed for a cart full of groceries to a text file, and saves the file to a folder on your computer's desktop named "Receipts". The program must satisfy the following requirements:
1.Asks the user to enter the name he/she wishes to give the .txt file.
2. Continuously asks the user to enter the name and size/weight of theproduct, until the user enters \Done".
3.The program searches the file "PriceList.txt" for the price(s) ofthe item(s) entered.
4. The program formats the output so that it lists each item on the left, andsubtotal for that item aligned some space to the right.
5. The program should automatically detect If the quantity of an item is greater than one, then the program prints the quantity followed by``@"and the price of one item inparentheses, lists the price for 1 item to the left of the subtotal, the subtotal reflects the number of items, the total is printed at the end of list, separated by two newlines
Below is an example of what a printed output should look like:
Just Fooding
123 E. Lechuga St.
Carrotville, CA 99999
Item Subtotal
Carrots $1.29
Best Value Mayo 2(@1.99) $3.98
Red tomato 2(@0.50) $1.00
Total $6.27
xtra Credit
In addition to the requirements above, to receive extra credit the program must:
1. ...ask the user to enter payment.
2. ...list the items with their corresponding subtotals in alpha-numerical or-
der (0-9, A/a-Z/z)
3. ...print the payment and change after the total.
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
