Question: Modify the code given above so that once the customer has selected No more doughnuts, the information for their order is added to a file

 Modify the code given above so that once the customer has
Modify the code given above so that once the customer has selected "No more doughnuts", the information for their order is added to a file called sales.txt. The information you must record includes the customers name and the number of each donut type. You are free to structure your file in any way you wish, but a suggested structure is given below (note: these are descriptions of what each line of the file would represent the actual values saved in the file should be the variable values from the program):
Customer Name (purchase #1)
# of Chocolate-dipped Maple Puff (purchase #1)
# of Strawberry Twizzler (purchase #1)
# of Vanilla Chai Strudel (purchase #1)
# of Honey-drizzled Lemon Dutchies (purchase #1)
Customer Name (purchase #2)
# of Chocolate-dipped Maple Puff (purchase #2)
# of Strawberry Twizzler (purchase #2)
# of Vanilla Chai Strudel (purchase #2)
# of Honey-drizzled Lemon Dutchies (purchase #2) ...etc...
Add a final option to the donut selection menu that allows the user to select Display sales statistics. When this option is selected, the program should read the sales.txt file and print out: the total number of sales that have been made, the total dollar amount of all purchases, the average dollar amount of all purchases, and the name of the customer with the largest single purchase.

print"elcome to Dinel's International Doughnut Shoppe!") name -input( Please enter your name to begin:) flag = 1 doughnutsCount [0, 0, 0,01 doughnutsChocolate-dipped Maple Puff", "Strawberry Twizzler", "Vanilla Chai Strudel"Honey-drizzled Lemon Dutchie" doughnutsPrices 3.5, 2.25, 4.05, 1.99] while (flag 1)1 print("Please select a doughnut from the following menu:) print(. Chocolate-dipped Maple Puff (3.5 each)") print( 2. Strawberry Twizzler 2.25 each)) print3. Vanilla Chai Strudel ($4.05 each)") print( 4. Honey-drizzled Lemon Dutchie $1.99)" print( 5. No more doughnuts) op int(input(>) if (op 0 and op totalPricedoughnutsPrices(doughnutscount(i print (nanehere is your receipti") print for in range(o, 4) if doughnutsCount[i - 0 print (doughnutscount[i].-str-() " + + doughnuts[i)) print print( "Total Coat $" + totalprice.-str-()} print"Thank you, have a nice day!" print"elcome to Dinel's International Doughnut Shoppe!") name -input( Please enter your name to begin:) flag = 1 doughnutsCount [0, 0, 0,01 doughnutsChocolate-dipped Maple Puff", "Strawberry Twizzler", "Vanilla Chai Strudel"Honey-drizzled Lemon Dutchie" doughnutsPrices 3.5, 2.25, 4.05, 1.99] while (flag 1)1 print("Please select a doughnut from the following menu:) print(. Chocolate-dipped Maple Puff (3.5 each)") print( 2. Strawberry Twizzler 2.25 each)) print3. Vanilla Chai Strudel ($4.05 each)") print( 4. Honey-drizzled Lemon Dutchie $1.99)" print( 5. No more doughnuts) op int(input(>) if (op 0 and op totalPricedoughnutsPrices(doughnutscount(i print (nanehere is your receipti") print for in range(o, 4) if doughnutsCount[i - 0 print (doughnutscount[i].-str-() " + + doughnuts[i)) print print( "Total Coat $" + totalprice.-str-()} print"Thank you, have a nice day

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 Databases Questions!