Pythod Food Orders
Pythod Food Orders
The input for the system includes customer name, mobile number, date, order
items, and their quantities.
The output should include the mobile number, name of the customer, date of the
order, total price of the order, and status of the order (paid, unpaid or cancelled).
The processes involved in the system are adding a new order, viewing all existing
orders, searching for a specific order, modifying the status of an order, and
displaying the menu.
Solution Design
The solution to the problem presented involves creating a Python program that
uses functions to perform the necessary tasks.
Firstly, the menu is defined as a list of tuples containing the name and price of each
item. Then, a function is defined to display the menu using a for loop and string
formatting.
Next, a dictionary is created to store the orders with the mobile number as the key
and the customer details, order items, status and total price as values.
A function is defined to add a new order by taking inputs from the user for
customer name, mobile number, date, and order items with their quantities. The
function also calculates the total price of the order and sets the status to "new".
Another function is defined to view all the existing orders stored in the dictionary.
The function uses a for loop to iterate over the dictionary and prints out the
necessary details.
A third function is defined to search for a specific order by taking input from the
user for the mobile number. If the mobile number exists in the dictionary, the
function prints out the relevant details such as customer name, date of the order,
total price and status. If it does not exist, an error message is displayed.
The fourth function is defined to modify the status of an order by taking input from
the user for the mobile number and the new status (paid, unpaid, or cancelled). If
the mobile number exists in the dictionary, the function updates the status of the
order. If it does not exist, an error message is displayed.
Finally, a main function is defined that controls the flow of the program using if-
else statements and loops. The main function provides a menu with options to add
a new order, view all existing orders, search for a specific order, modify the status
of an order, display the menu, and exit the program. The menu option to exit the
program also saves the orders and menu to separate files.
Pseudo-code:
Define the menu as a list of tuples containing the name and price of each item
Define a function to add a new menu item , takes input from admin name and price
Define a dictionary to store the orders
Define a function to display the menu: a. Iterate over the menu using a for loop and
string formatting
Define a function to add a new order: a. Take inputs from the user for customer
name, mobile number, and date b. Use a while loop to add items to the order until
the limit of 6 items is reached or the user chooses to stop adding items c. Calculate
the total price of the order d. Set the status of the order to "new" e. Add the order to
the dictionary
Define a function to view all existing orders: a. Iterate over the orders dictionary
using a for loop and print out the necessary details
Define a function to search for a specific order: a. Take input from the user for
mobile number b. If the mobile number exists in the dictionary, print out the
relevant details such as customer name, date of the order, total price, and status. c.
If it does not exist, display an error message
Define a function to modify the status of an order: a. Take input from the user for
mobile number and new status (paid, unpaid, or cancelled) b. If the mobile number
exists in the dictionary, update the status of the order. c. If it does not exist, display
an error message
Define a main function that controls the flow of the program using if-else
statements and loops: a. Display a menu with options to add a new order, view all
existing orders, search for a specific order, modify the status of an order, display
the menu, and exit the program. b. The menu option to exit the program also saves
the orders and menu
o separate files using with open() and write() functions.
Self-reflection
This project allowed me to practice my Python programming skills while working
on a practical problem. It was a great opportunity to learn about dictionaries, loops,
conditional statements, and file handling in Python.
While working on this project, I faced some challenges such as figuring out how to
add items to the order until the limit of 6 items is reached or the user chooses to
stop adding items, how to search for a specific order in the dictionary, and how to
save the orders and menu to separate files. However, I was able to overcome these
challenges by researching online, reading documentation, and experimenting with
different codes.