Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

PYTHON PROGRAMMING: Write a program to help a local restaurant automate its breakfast billing system. The program should do the following: a. Show the customer

PYTHON PROGRAMMING:

Write a program to help a local restaurant automate its breakfast billing system. The program should do the following:

a. Show the customer the different breakfast items offered by the restaurant.

b. Take customer order

c. Change customer order

d. Display all orders

e. Delete a customer order

f. Allow the customer to select more than one item from the menu

g. Display the order information. The order should include a 6-digit order number. Each order number must be unique

a. Once a customers order has been displayed, the program should return to the main menu

h. Keep track of all orders

To build this application, students will use multiple classes and modules.

1. client module (client.py). This module will contain the main program that the user interacts with. It should contain two functions: mainMenu and orderMenu. mainMenu function will display the program main options. orderMenu function displays the order menu and price of each item.

2. order module (order.py). This module will contain a class, Order, that represents an order. Each order can have customer name , order number, order items and their prices, tax amount, and total. There should be set and get methods for each attribute except the order number. The order number should only have a get method. The order number is generated when an order is created. The order number must be created within the Order class, it cannot be passed an in argument. The order number is a 6-digit number

3. orderDatabase module (orderDatabase.py). This module will be used to store, retrieve, and manipulate orders. It will contain a class, OrderDB, that will contain all the required functionality for working with orders.

a. OrderDB class methods

i. addOrder method. This method takes an order object as parameter and adds it to the order database

ii. changeOrderAddItem method. This method takes as parameters the order number and item (name and price) that will be added to an order. The order will be updated in the database. The updated order is returned

iii. changeOrderRemoveItem method. This method takes as parameters the order number and item (name and price) that will be remove from the order. The order will be updated in the database. The updated order is returned.

iv. findOrder method. This method takes as parameter the order number of the order to find. Once the order is located, the method returns the order. If the order is not found, the method returns None

v. findCustomerOrders method. This method takes the customer name as parameter and returns all orders for that customer

vi. printAllOrders method. This method returns all orders in the database.

vii. deleteOrder method. This method takes the order number as a parameter and removes the order associated with the order number from the database. It returns the deleted order

viii. deleteCustomerOrders method. This method take the customer name as a parameter, finds all orders for that customer, and deletes them. This method returns the deleted orders.

ix. deleteAllOrders method. This method deletes all orders from the database and display the number of orders deleted.

When the program begins, the following options will be presented to the user:

1. Make An Order

2. Change An Order

3. Find Single Order

4. Find Customer Orders

5. Display Orders

6. Delete Single Order

7. Delete Customer Orders

8. Delete all orders

9. exit

Option 1 (Make An Order)

When the user selects this option, the program should present the menu for breakfast items and prompt the user to make a selection. The user will enter the number that corresponds to a menu item. Once the user makes a selection, the program will add the item to order and prompt the user to make another selection (To keep things simple, an item can only appear in an order one time), if the user has finished ordering they will hit enter at the prompt without enter a value. The program will prompt for the customer name. Once the name is entered, the program will calculate the order tax and total, create an order, add the order to the database, and display the order information. The program will return to the main menu

1. Plain Egg $1.45

2. Bacon and Egg $2.45

3. Muffin $0.99

4. French Toast $1.99

5. Fruit Basket $2.49

6. Cereal $0.50

7. Coffee $0.50

8. Tea $0.75

Note: Sales tax is 5%

Example Order Information

Name: Jane

Order number: 456797

Bacon and Egg $2.45

Muffin $0.99

Coffee $.50

Tax $.20

Amount Due $4.14

Option 2 (Change An Order)

When this option is selected, the user will be prompted for the order number. Once the order number is entered, the program will present the user with another prompt asking if they will like to add or remove an item from the order. The user will enter 1 to add item or 2 to remove item. The program will prompt for the name of the item to add or remove. If the users response is 1, the changeOrderAddItem method from OrderDB will be called and passed the item name and price. If the users response was 2, the changeOrderRemoveItem method from OrderDB will called and passed the item name and price. The program will display the updated order.

Option 3 (Find Single Order)

When this option is selected, the program will prompt for the order number. Once the order number is entered, the program will call findOder method from the OrderDB class and pass in the order it. If the order exists, the program will display the order information.

Option 4 (Find Customer Orders)

When this option is selected, the program will prompt for the customer name. The program will call findCustomerOrders from OrderDB class and pass in the customer name. The program will display all orders found for the customer.

Example Order Information

Name: Jane

Order number: 456797

Bacon and Egg $2.45

Muffin $0.99

Coffee $.50

Tax $.20

Amount Due $4.14

Option 5 (Display Orders)

When this option is selected, the program will call PrintOrders from OrderDB class.

Option 6 (Delete Single Order)

When this option is selected, the program will prompt for the order number. The order number will be passed to the deleteOrder method from OrderDB class. The deleted order information must be displayed

Option 7(Delete Customer Orders)

When this option is selected, the program will prompt for the customer name. Once the customer name is provided, the program will call the deleteCustomerOrders method from OrderDB class. The deleted order information must be displayed

Option 8 (Delete All Orders)

When this option is selected, the program will call deleteAllOrders method from OrderDB class.

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored 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

Recommended Textbook for

Machine Learning And Knowledge Discovery In Databases European Conference Ecml Pkdd 2014 Nancy France September 15 19 2014 Proceedings Part 2 Lnai 8725

Authors: Toon Calders ,Floriana Esposito ,Eyke Hullermeier ,Rosa Meo

2014th Edition

3662448505, 978-3662448502

More Books

Students also viewed these Databases questions