Question

Problem 1 python A Chinese restaurant has two types of dinner combos for customers to choose....

Problem 1

python

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:

  1. 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.
  2. Create a Deluxe_dinner_combo class for deluxe dinner combos. This class is a derived class of the dinner_combo class. It has one additional protected instance variables: appetizer. Define a choose_appetizer method to choose an appetizer, and a displayOrder method to display items ordered and total amount due.
  3. 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 [$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
Thanks for the question.

Below is the code you will be needing  Let me know if you have any doubts or if you need anything to change.

Thank You !

===========================================================================

class Dinner_Combo():

    def __init__(self):
        self.main_dish = 0
        self.soup = 0
        self.cost = 0

    def choose_dish(self):
        self.main_dish = int(
            input('Enter 1 for sweet and sour pork [$7], 2 for sesame chicken [$8] or 3 for shrimp fired rice [$9]: '))
        if self.main_dish == 1: self.cost += 7
        if self.main_dish == 2: self.cost += 8
        if self.main_dish == 3: self.cost += 9

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

    def displayOrder(self):

        if self.soup == 1: print('egg drop soup, ', end='')
        if self.soup == 2: print('wantop soup, ', end='')
        if self.main_dish == 1: print('sweet and sour pork')
        if self.main_dish == 2: print('sesame chicken')
        if self.main_dish == 3: print('shrimp fried rice')
        print('Please pay this amount: ${:.2f}'.format(self.cost))


class Deluxe_Dinner_Combo(Dinner_Combo):
    def __init__(self):
        super().__init__()
        self.appetizer = 0

    def choose_appetizer(self):
        self.appetizer = int(input('Enter 1 for spring roll [$1.25] or 2 for chicken wing [$1.50]: '))
        if self.appetizer == 1: self.cost += 1.25
        if self.appetizer == 2: self.cost += 1.50

    def displayOrder(self):
        if self.appetizer == 1: print('spring roll, ', end='')
        if self.appetizer == 2: print('chicken wing, ', end='')
        super().displayOrder()


def main():
    type = input('Enter 1 for dinner combo or 2 for deluxe dinner combo: ')
    dinnerType = None
    if type == '1':
        dinnerType = Dinner_Combo()
    elif type == '2':
        dinnerType = Deluxe_Dinner_Combo()
        dinnerType.choose_appetizer()
    dinnerType.choose_soup()
    dinnerType.choose_dish()
    print('Items ordered: ', end='')
    dinnerType.displayOrder()


main()

=================================================================

---------------------------------------------------------------------------------------------------------------

let me know if you have any doubts or if you need anything to change.

If you are satisfied with the solution, please rate the answer.

Thanks!

Add a comment
Know the answer?
Add Answer to:
Problem 1 python A Chinese restaurant has two types of dinner combos for customers to choose....
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
  • INSTRUCTION AND PROBLEMS Create a Python project for each of the following problems. Zip each Pyt...

    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...

  • For the dinner special at a restaurant, the customer must choose an appetizer, a salad, an...

    For the dinner special at a restaurant, the customer must choose an appetizer, a salad, an entree, a side dish, and a dessert. Here are the items to choose from. Choice Possible items Appetizer Onion rings, Buffalo wings, Nachos, Chicken strips, Shrimp cocktail Salad Garden, Southwest, Caesar Entree Lamb, Roast turkey, T-bone steak Side dish Baked potato, Corn, Rice Dessert Apple pie, Cheesecake, Chocolate cake How many dinner specials are possible?

  • 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