Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

please just read problem 1 and 2 but no need to solve it, and please focus on problem 3. and i provideed the code of

please just read problem 1 and 2 but no need to solve it, and please focus on problem 3. image text in transcribed
image text in transcribed
image text in transcribed
and i provideed the code of problem 1 and 2 for you to solve problem 3 easierly.
image text in transcribed
image text in transcribed
i know these pictures seem like a lot, but you just need to do problem 3. thanks so much
Problem 1 (Taking Orders) Write a program called a3q1.py that creates a text-based purchasing system for Dino's International Doughnut Shoppe For this first part, you'll build a menu system that allows customers to purchase quantities of a single type of doughnut. The program should start by asking the customer for their name. Next it should display a menu that asks the user to select one of the following 4 kinds of doughnuts 1. Chocolate-dipped Maple Puff ($3.50 each) 2. Strawberry Twizzler ($2.25 each) 3. Vanilla Chai Strudel ($4.05 each) 4. Honey-drizzled Lemon Dutchie ($1.99) The user should make their selection by entering the corresponding number. You can assume the user will enter an integer number, but must verify that it is a valid input (i.e., in the range 1-4). Once the customer has selected a variety, the program should ask how many of that variety the customer would like. Again, you can assume that a number is entered but must ensure it is a valid value (e.g., 0 or more). Following this, the program should provide the user with their receipt (report the type, quantity, and total cost of the user's order). Dino has made a special request that when telling the customer their order's cost that the program be personable and use the customer's name Problem 2 (Buying in Bulk) For this second part, copy your solution from part 1 into a new file called a3q2.py. Do not overwrite your solution to Part 1, as the TAs will want to see both solutions Modify your code for Dino's International Doughnut Shoppe's text-based purchasing system T so that customers can purchase multiple varieties of doughnuts. To do this, the menu that you built in part 1 should repeat to the customer until they select a new "No more doughnuts" option Your program should keep track of the quantity of each kind of doughnut that the customer orders. Note: if a customer selects the same variety of doughnut twice, their order amounts should be added together (i.e., they should be able to order 5 donuts of a particular type and then order 5 more of that same type for a total of 10). Once the customer selects the "no more doughnuts" option, their receipt should then display as before but now should include all of the doughnuts that customer has purchased Some tips: Your menu loop will need to repeat until a request to stop is made. You will need to keep track of the quantities of each type of doughnut separately. You should have a separate variable for each quantity. Your final cost calculation will involve all 4 types of doughnuts, even those that weren't selected by the user (where quantity 0). Be sure to initialize all of your variables at the beginning of your program. The final receipt should display only those doughnuts which the user has purchased. That is, for each type, check first if it should be on the receipt before printing. Problem 3 (Recording Sales) For this third part, you will be using files to record all sales that occur at Dino's shop. Again, copy your solution from the previous part into a new file called a3q3.py. Do not overwrite your previous solution, as the TAs will want to see all of them. 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 customer's 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. It may be easier to implement/test the sales statistics functionality in a separate program first and then copy the code into your final Dino's program. python code: a2q1.py D:/chg/python/a2q1.py (3.7.0bl)* File Edit Format Runptions Window Help print ('Welcome to Dino\'s International Doughnut Shoppe! ' name-input ('Please enter your name to begin:' flag-i while (flag--1): print ('Please select a doughnut from the following menu: print ('1. Chocolate-dipped Maple PufE (03.5 each) ') print ('2. Strawberry Twizzler (2.25 each)) print ('3. Vni1la Chai Strudel (4.05 each)) print ('4. Honey-drizzled Lemon Dutchie (1.99) op-int (input (>) if (op>0 and op) 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!" Problem 1 (Taking Orders) Write a program called a3q1.py that creates a text-based purchasing system for Dino's International Doughnut Shoppe For this first part, you'll build a menu system that allows customers to purchase quantities of a single type of doughnut. The program should start by asking the customer for their name. Next it should display a menu that asks the user to select one of the following 4 kinds of doughnuts 1. Chocolate-dipped Maple Puff ($3.50 each) 2. Strawberry Twizzler ($2.25 each) 3. Vanilla Chai Strudel ($4.05 each) 4. Honey-drizzled Lemon Dutchie ($1.99) The user should make their selection by entering the corresponding number. You can assume the user will enter an integer number, but must verify that it is a valid input (i.e., in the range 1-4). Once the customer has selected a variety, the program should ask how many of that variety the customer would like. Again, you can assume that a number is entered but must ensure it is a valid value (e.g., 0 or more). Following this, the program should provide the user with their receipt (report the type, quantity, and total cost of the user's order). Dino has made a special request that when telling the customer their order's cost that the program be personable and use the customer's name Problem 2 (Buying in Bulk) For this second part, copy your solution from part 1 into a new file called a3q2.py. Do not overwrite your solution to Part 1, as the TAs will want to see both solutions Modify your code for Dino's International Doughnut Shoppe's text-based purchasing system T so that customers can purchase multiple varieties of doughnuts. To do this, the menu that you built in part 1 should repeat to the customer until they select a new "No more doughnuts" option Your program should keep track of the quantity of each kind of doughnut that the customer orders. Note: if a customer selects the same variety of doughnut twice, their order amounts should be added together (i.e., they should be able to order 5 donuts of a particular type and then order 5 more of that same type for a total of 10). Once the customer selects the "no more doughnuts" option, their receipt should then display as before but now should include all of the doughnuts that customer has purchased Some tips: Your menu loop will need to repeat until a request to stop is made. You will need to keep track of the quantities of each type of doughnut separately. You should have a separate variable for each quantity. Your final cost calculation will involve all 4 types of doughnuts, even those that weren't selected by the user (where quantity 0). Be sure to initialize all of your variables at the beginning of your program. The final receipt should display only those doughnuts which the user has purchased. That is, for each type, check first if it should be on the receipt before printing. Problem 3 (Recording Sales) For this third part, you will be using files to record all sales that occur at Dino's shop. Again, copy your solution from the previous part into a new file called a3q3.py. Do not overwrite your previous solution, as the TAs will want to see all of them. 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 customer's 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. It may be easier to implement/test the sales statistics functionality in a separate program first and then copy the code into your final Dino's program. python code: a2q1.py D:/chg/python/a2q1.py (3.7.0bl)* File Edit Format Runptions Window Help print ('Welcome to Dino\'s International Doughnut Shoppe! ' name-input ('Please enter your name to begin:' flag-i while (flag--1): print ('Please select a doughnut from the following menu: print ('1. Chocolate-dipped Maple PufE (03.5 each) ') print ('2. Strawberry Twizzler (2.25 each)) print ('3. Vni1la Chai Strudel (4.05 each)) print ('4. Honey-drizzled Lemon Dutchie (1.99) op-int (input (>) if (op>0 and op) 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

Step: 1

blur-text-image

Get Instant Access with AI-Powered Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Students also viewed these Databases questions