Question & Answer: Program required: Processing 3.0…..

Language: Python

Program required: Processing 3.0

Don't use plagiarized sources. Get Your Custom Essay on
Question & Answer: Program required: Processing 3.0…..
GET AN ESSAY WRITTEN FOR YOU FROM AS LOW AS $13/PAGE
Order Essay

Purpose: To practice list operations such as adding. removing and finding indices Degree of Difficulty: Moderate The Sesame Street Bakery sells four items at the following prices . Bread ($5) .Doughnut ($2) . Muffin ($3) ● Cookie (S1) For this question, you will write a program that allows the user to place an order at the bakery. Here is how your program should behave . Use a 500x500 white canvas as your background On the left side of the canvas. display the bakerys menu, which consists of the name and price of each item. On the right side of the canvas, display all of the items in the users order so far. Initially, the order will be empty. It is okay if the order gets too big for the screen: you dont need to handle this case . Below the users order, display the total cost of the entire order. Initially the cost is O. When the user presses the b, d, m orckeys: Add the appropriate item to the order (bfor Bread, c for Cookie, etc.) When the user presses theu (for undo) key: Remove the most recently-added item from the order and adjust the total cost accordingly. Menu Bread: $5 Muffin: $3 Your order Bread COOKIE: $1 COOKIE COOKIE COOKIE Cost: $16 Figure 2: A sample order It is not possible to solve this question without making at least some use of lists (in particular, you will need a list to store the order). However, to get full marks for this question, you must make effective use of lists beyond the bare minimum in the following ways: Store the items in the bakerys menu in a list, i.e. at the top of your program you will have a statement like menu = [Bread , Doughnut, Muffin. COOKIE]. Your program should be designed such that if the bakery were to add another item to its menu, your draw) function would not need to change at all!! Store the prices for each menu item in a list as well, ie, prices- [5, 2, 3 , 1]. Your program should be designed such that if the bakery were to change the price of an item, changing this list of prices is the ONLY thing you would need to do for your program!! Finally designing a graphical picture/logo for the bakery involving gratuitous use of cookies and/or furry blue monsters with googly eyes is not required, but cannot possibly hurt you.

Purpose: To practice list operations such as adding, removing and finding indices Degree of Difficulty: Moderate The Sesame Street Bakery sells four items at the following prices. Bread ($5) Doughnut ($2) Muffin ($3) Cookie ($1) For this question, you will write a program that allows the user to place an order at the bakery. Here is how your program should behave. Use a 500 times 500 white canvas as your background On the left side of the canvas. display the bakery’s menu, which consists of the name and price of each item. On the right side of the canvas, display all of the items in the user’s order so far. Initially, the order will be empty. It is okay if the order gets too big for the screen: you don’t need to handle this case. Below the user’s order, display the total cost of the entire order. Initially the cost is O. When the user presses the ‘b’, ‘d’, ‘m’ or ‘c’ keys: Add the appropriate item to the order (‘b’ for Bread, ‘c’ for Cookie, etc…) When the user presses the ‘u’ (for “undo”) key: Remove the most recently-added item from the order and adjust the total cost accordingly. It is not possible to solve this question without making at least some use of lists (in particular, you will need a list to store the order). However, to get full marks for this question, you must make effective use of lists beyond the bare minimum in the following ways: Store the items in the bakery’s menu in a list, i.e. at the top of your program you will have a statement like menu = [“Bread”, “Doughnut”, “Muffin”. “COOKIE”]. Your program should be designed such that if the bakery were to add another item to its menu, your draw) function would not need to change at all!! Store the prices for each menu item in a list as well, i.e., prices = [5, 2, 3, 1]. Your program should be designed such that if the bakery were to change the price of an item, changing this list of prices is the ONLY thing you would need to do for your program!! Finally designing a graphical picture/logo for the bakery involving gratuitous use of cookies and/or furry blue monsters with googly eyes is not required, but cannot possibly hurt you.

Expert Answer

 

copyable code

import tkinter as tk

root = tk.Tk()

root.title(“Seesamee street bakery “)

root.resizable(0, 0)

#500 multiply 500 canvas background

canvas = tk.Canvas(root, width=500, height=500)

canvas.pack()

menuitem = [“Bread”,”Doughnut”,”Muffine”,”COOKIE”]

pricessesame = [5,2,3,1]

orderitem = []

cost1 = 0

cost1_id = ”

h1 = 100

def draw():

global cost1_id

canvas.create_line(250,0,250,500)

canvas.create_text(100,50,text=”menuitem”)

h1 = 100

for k in range(len(menuitem)):

string1 = menuitem[k] + ” : $” + str(pricessesame[k])

canvas.create_text(130,h1,text=string1)

h1 = h1+20

canvas.create_text(350,50,text=”Your orderitem”)

cost1_id=canvas.create_text(350,450,text=”cost value : $0″)

def key(eve):

global h1

global cost1

global cost1_id

if eve.char == ‘b’ :

k=0

elif eve.char == ‘d’ :

k=1

elif eve.char == ‘m’ :

k=2

elif eve.char == ‘c’ :

k=3

elif eve.char == ‘u’ :

k=-1

h1 = h1+20

if k == -1 :

if len(orderitem) > 0:

itemval = orderitem.pop()

string1 = canvas.itemcget(itemval, ‘text’)

canvas.delete(itemval)

for k in range(len(menuitem)):

if menuitem[k] == string1 :

cost1 = cost1 – pricessesame[k]

canvas.delete(cost1_id)

string1 = “cost1 : $” + str(cost1)

cost1_id=canvas.create_text(350,450,text=string1)

else :

orderitem.append(canvas.create_text(350,h1,text=menuitem[k]))

cost1 = cost1+pricessesame[k]

canvas.delete(cost1_id)

string1 = “cost : $” + str(cost1)

cost1_id=canvas.create_text(350,450,text=string1)

draw()

canvas.bind_all(“<b>”, key)

canvas.bind_all(“<d>”, key)

canvas.bind_all(“<m>”, key)

canvas.bind_all(“<c>”, key)

canvas.bind_all(“<u>”, key)

root.mainloop()

Grand Paper Writers
Order NOW For A 10% Discount!
Pages (550 words)
Approximate price: -

Our Advantages

Plagiarism Free Papers

All papers are written by the best professional writers to ensure 100% originality. We always provide plagiarism reports whenever we deliver completed papers.

Free Revisions

All papers by Grand Paper Writers are completed and submitted on time. This timely delivery of papers gives you time to go through the paper before the official deadline.

Title-page

As an additional service, we will provide a title page that precedes the contents of your paper. Here, you will provide your personal details.

Bibliography

We also ensure that we provide an extra page for the references or bibliographies following referencing rules.

Originality & Security

At Grandpaperwriters.com, we guarantee students for the provision of security and original work. All your personal information is handled with confidentiality and is not shared with third parties. Additionally, we ensure that we provide original content with accompanying plagiarism reports to show originality.

24/7 Customer Support

Our customer support team is always available 24/7 to provide instant responses to any queries raised by students.

Try it now!

Calculate the price of your order

We'll send you the first draft for approval by at
Total price:
$0.00

How it works?

Follow these simple steps to get your paper done

Place your order

Fill in the order form and provide all details of your assignment.

Proceed with the payment

Choose the payment system that suits you most.

Receive the final file

Once your paper is ready, we will email it to you.

Our Services

Grandpaperwriters.com has the best professional essay writers for quality services.

Pricing

Flexible Pricing

Here, a Grandpaperwriters.com, we do not compromise on the time of our clients. We always deliver all completed papers on or before the deadlines.

Communication

Admission Help & Client-Writer Contact

Grandpaperwriters.com provides an interactive portal where students can communicate directly to their writers.

Deadlines

Paper Submission

Here, a Grandpaperwriters.com, we do not compromise on the time of our clients. We always deliver all completed papers on or before the deadlines.

Reviews

Customer Feedback

Grandpaperwriters.com appreciates feedback from our clients to help us improve the delivery of essay writing services. As such, we are constantly changing our policies to ensure maximum customer and writer satisfaction.