Question

INSTRUCTION AND PROBLEMS Create a Python project for each of the following problems. Zip each Python project into a zip file.

choose_dish method to choose a main dish, a choose_soup method to choose a soup, and a displayOrder method to display items o

INSTRUCTION AND PROBLEMS Create a Python project for each of the following problems. Zip each Python project into a zip file. Submit the zip files to Blackboard for credit. PROBLEM 1 A Chinese restaurant has two types of dinner combos for customers to choose. A regular dinner combo includes main dish and soup. A deluxe dinner combo includes main dish, soup and appetizer. There are three main dish choices: sweet and sour pork ($7), sesame chicken ($8) or shrimp fried rice ($9). There are two soup choices: egg drop soup ($1.25) or wanton soup ($1.50). There are two appetizer choices: spring roll ($1.25) or chicken wing ($1.50). They need a program to place orders. You Python project needs to follow these requirements: (a) Create a Dinner_combo class for regular dinner combos. This class has three protected instance variables: main_dish, soup and total. Define a
choose_dish method to choose a main dish, a choose_soup method to choose a soup, and a displayOrder method to display items ordered and total amount due. derived class of the dinner combo class. It has one additional protected instance appetizer, and a displayOrder method to display items ordered and total amount (b) Create a Deluxe_dinner_combo class for deluxe dinner combos. This class is a variables: appetizer. Define a choose_appetizer method to choose an due. (c) In the main module, ask user to choose either regular or deluxe dinner combo. Create an object and call its methods to input food items and display information of the order The following shows a sample test run. This customer chooses regular dinner combo. Enter 1 for dinner combo or 2 for deluxe dinner combo: 1 Enter 1 for egg drop soup [$1.25] or 2 for wanton soup [$1.50]: 1 Enter 1 for sweet and sour pork [$7], 2 for sesame chicken [$8] or 3 for shrimp fired rice [$9]: 2 Items ordered: egg drop soup, sesame chicken Please pay this amount: 9.25 The following shows a sample test run. This customer chooses deluxe dinner combo. Enter 1 for dinner combo or 2 for deluxe dinner combo: 2 Enter 1 for spring roll [$1.25] or 2 for chicken wing [$1.50]: 1 Enter 1 for egg drop soup [$1.25] or 2 for wanton soup L$1.50]: 2 Enter 1 for sweet and sour pork [$7], 2 for sesame chicken [$8] or 3 for shrimp fired rice [$9]: 3 Items ordered: spring roll, wanton soup , shrimp fried rice Please pay this amount: 11.75
0 0
Add a comment Improve this question Transcribed image text
Answer #1

Code

class Dinner_combo():
def __init__(self):
self.main_dish=""
self.soup=""
self.total=0

def choose_dish(self):
choice=input("Enter 1 for sweet and sour pork [$7], 2 for sesame chiken [$8] or 3 shrimp fried rice [$9]:")
if(choice=="1"):
print("hi")
self.main_dish="sweet and sour pork"
self.total+=7
if(choice=="2"):
self.main_dish="sesame chiken"
self.total+=8
if(choice=="3"):
self.main_dish="shrimp fried rice"
self.total+=9

def choose_soup(self):
choice=input("Enter 1 for egg drop soup [$1.25] or 2 for wanton soup [$1.50] : ")
if(choice=="1"):
self.soup="egg drop soup"
self.total+=1.25
if(choice=="2"):
self.soup="wanton soup"
self.total+=1.50

def display_oprder(self):
print("Item ordered: "+self.soup+" , "+self.main_dish)
print("Please pay thi amount: ",self.total)

class Deluxe_dinner_combo(Dinner_combo):
def __init__(self):
Dinner_combo.__init__(self)
self.appetizer=""

def choose_appetizer(self):
choice=input("Enter 1 for spring roll [$1.25] or 2 for chiken wing [$1.50] : ")
if(choice=="1"):
self.appetizer="spring roll"
self.total+=1.25
if(choice=="2"):
self.appetizer="chiken wing"
self.total+=1.50

def display_oprder(self):
print("Item ordered: "+self.appetizer+" , "+self.soup+" , "+self.main_dish)
print("Please pay thi amount: ",self.total)


def main():
choice=input("Enter 1 for dinner combo and 2 for deluxe dinner combo: ")
if(choice=="1"):
d1=Dinner_combo()
d1.choose_soup()
d1.choose_dish()
d1.display_oprder()
if(choice=="2"):
d2=Deluxe_dinner_combo()
d2.choose_appetizer()
d2.choose_soup()
d2.choose_dish()
d2.display_oprder()
main()


output

code snaps

If you have any query regarding the code please ask me in the comment i am here for help you. Please do not direct thumbs down just ask if you have any query. And if you like my work then please appreciates with up vote. Thank You.

Add a comment
Know the answer?
Add Answer to:
INSTRUCTION AND PROBLEMS Create a Python project for each of the following problems. Zip each Pyt...
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for? Ask your own homework help question. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
  • *****************USING JAVA AND JAVA FX ************** PLEASE READ THE INSTRUCTIONS BEFORE YOU GO AND DO IT...

    *****************USING JAVA AND JAVA FX ************** PLEASE READ THE INSTRUCTIONS BEFORE YOU GO AND DO IT SOME OTHER WAY... home / study / engineering / computer science / questions and answers / *****in java & java fx***** a restaurant wants ... Your question has been answered! Rate it below. Let us know if you got a helpful answer. Question *****IN JAVA & JAVA FX***** A restaurant wants an application that calculates a table’s bill. The design should include: Group Boxes,...

  • A Chinese restaurant wants to have a computer-based search system that will display a recipe for...

    A Chinese restaurant wants to have a computer-based search system that will display a recipe for each dish. The owner of the restaurant wants the system to be flexible in that its recipes are stored in a text file. This way, the number of dishes can be expanded by adding more entries to the text file without changing any program code. After analyzing the coding the restaurant realizes that Current coding only outputs first two line of the recipe. Goal:...

ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT