Question
URGENT PLEASE HELP! COMPUTER SCIECE PROBLEM Modify your code from the previous par t so that once the customer has selected No more doughnuts, the
URGENT PLEASE HELP! COMPUTER SCIECE PROBLEM
Modify your code from the previous part 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)
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. It may be easier to implement/test the sales statistics functionality in a separate program first and then copy the code into your final Dinos program.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...
PLEASE MODIFY THIS CODE WITH THE ABOVE INSTRUCTIONS - COPY AND PASTE FROM BELOW
(indentation is off)
#welcomes user and asks for name print("Welcome to Dino's International Doughnut Shoppe!") name = input("Please enter your name to begin: ")
#asks user for a choice chocolate = strawberry = vanilla = honey = 0 done = False while not done: print("Please enter a valid choice from 1-4.") print("Please select a doughnut from the following menu: ") print("1. Chocolate-dipped Maple Puff ($3.50 each)") print("2. Strawberry Twizzler ($2.25 each)") print("3. Vanilla Chai Strudel ($4.05 each)") print("4. Honey-drizzled Lemon Dutchie ($1.99)") print("5. No more doughnuts.") choice = int(input(">"))
#if-elif statements for choices if choice == 1: chocolate = int(input("How many chocolate-dipped Maple Puff(s) would you like to purchase? ")) elif choice == 2: strawberry = int(input("How many Strawberry Twizzler(s) would you like to purchase? ")) elif choice == 3: vanilla = int(input("How many Vanilla Chai Strudel(s) would you like to purchase? ")) elif choice == 4: honey = int(input("How many Honey-drizzled Lemon Dutchie(s) would you like to purchase? ")) elif choice == 5: done = True print(f"{name}, Here is your receipt: ") #receipt
if chocolate >= 1: print("==========================================") print(f"{chocolate} Chocolate Dipped Maple Puffs") if strawberry >= 1: print(f"{strawberry} Strawberry Twizzlers") if vanilla >= 1: print(f"{vanilla} Vanilla Chai Strudels") if honey >= 1: print(f"{honey} Honey-drizzled Lemon Dutchies") print("==========================================") print(f"Total Cost for Today: ${chocolate*3.50 + strawberry*2.25 + vanilla*4.05 + honey*1.99:.2f}") print("Thank you for shopping at Dino's International Doughnut Shoppe! Please come again!")
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started