Dav Public School Midnapore: Bakery Management Project
Dav Public School Midnapore: Bakery Management Project
SCHOOL
MIDNAPORE
BAKERY MANAGEMENT
PROJECT
SUBMITTED BY:
NAME:SWARNADEEP CHAND
CLASS:XII(SC) SEC:A
ROLL NO:-39
SUBJECT:COMPU
TER SCIENCE
Session:2024-
2025
CERTIFICATE
This is to certify that
“SWARNADEEP CHANDA” is a
student of class XII has
successfully completed the
investigory project on the
topics.
This project is absolutely
genuine and does not include in
plagiarism of any kind this
project is also considered by
CBSE 2024-25 the reference is
taken in making this project
have been declared at the end
of this project.
DATE:-____________ ________________________
EXAMINER
_________________________ ___________________________
PHYSICS TEACHER PRINCIPAL
ACKNOWLEDGEM
ENT
I am very glad to present the
project after the hard toil
over a month. I want to
sincerely express my
gratitude to our respected
Computer Science teacher
Mrs.SANGEETA BAG ma’am
for this kind support and
unforgettable help in
completing this task.
PROJECT WORKING:
We will store the data (product names and their prices) of our bakery in
a database.
This data can be accessed as:
1. Admin Login:
The admin can access the data, view the items, add or delete an item,
and update the price of an item.
2. Customer login:
This will be the login for customer billing. Biller will note the items and
their quantities as per the customer’s input and generate the bill for the
same.
MODULES:
import sqlite3
import time
connection =
sqlite3.connect('menu.db’)
cursor = connection.cursor()
menu will be the name of our database. Now create the
table, Menu. It will require the following three entities: product_id
(primary key + autoincrement), product_name, and product_price.
cursor.execute('‘’
CREATE TABLE IF NOT EXISTS Menu([product_id]
INTEGER PRIMARY KEY AUTOINCREMENT,
[product_name] TEXT,[product_price]
INTEGER)''')
Let’s insert values into the database. This can be done in two
ways: you can either run a query inside the code for that or you
can manually open the database file into SQLite studio and
insert the values.
query = '''SELECT * FROM Menu'''
cursor.execute(query)
results = cursor.fetchall()
if results==[]:
cursor.execute('‘’
INSERT INTO Menu (product_name,
product_price)
VALUES
('Cake',400),
('Bread',50),
('Cookies',100),
Again, to make sure that the values are inserted only once,
('Doughnuts',80),
check if the Menu table is empty.
('Pie',120)
'‘’) connection.commit()
3. DESIGN A MAIN FUNCTION
This will be the main function of our code. Here we will display
welcome messages and give choices to users for proceeding
functions.
The password for the admin login is MoonPie and it will be
verified first whenever an admin attempts to log in.
For both admin and customer login, we will design separate
functions which will take the connection and cursor as
parameters.
def main():
inloop = 1
while inloop:
print()
print("-------------------------------------------------")
print("-----------Welcome to Moon Pie
Bakery!-----------")
print("-------------------------------------------------")
print("How you want to Enter?")
print("Choice 1: Admin Login","Choice 2: Customer Login", "Choice
3: Exit",sep="\n")
choice = input("Enter your choice:")
if choice=='1’:
password = input("Enter the
password: ")
if password=="MoonPie":
admin_login(connection,cursor)
else: print("Incorrect Password!")
time.sleep(1)
elif choice=='2’:
customer_login(connection,cursor)
elif choice=='3’:
exit()
else:
print("Invalid Choice!")
The loop will only be broken in case the user chooses to exit.
4. DESIGN FUNCTION FOR ADMIN LOGIN
The function admin_login() will have 5 choices:
1. add an item: The item name and price will be inputted and
inserted into the table using an insert query.
2. remove an item: Using the product id as input, the
corresponding row will be deleted using a delete query.
3. update an item: The product price will be updated by
taking the product id and new price as input using an update
query.
4. display all the items: A function will be designed to
display the menu list with its prices. This function will be used
whenever required in other choices as well.
5. exit from the function: This choice will redirect to the
main admin_login(connection,cursor):
def function.
print()
print("---------Welcome! You are logged in
as Admin!----------")
print() print("Here are the list of
choices:") print("Choice 1: Add an item",
"Choice 2: Remove an item",
"Choice 3: Update item
price",
"Choice 4: See all the
items",
"Choice 5:Exit", sep="\n")
choice = int(input("Enter your choice: "))
print()
time.sleep(0.5)
if choice==1:
print("What you like to add?")
product_name = input("Enter product name: ")
product_price = input("Enter product price: ")
try:
query=f'''INSERT INTO Menu(product_name,
product_price) VALUES
('{product_name}','{product_price}')'‘’
cursor.execute(query)
connection.commit()
print("The item has been added to the
list!") except Exception as e:
elif choice==2:
display_items(cursor)
print("Which item you would like to
remove?")
id = int(input("Enter product id:"))
try:
query=f'''DELETE FROM Menu WHERE
product_id={id}'‘’
cursor.execute(query)
connection.commit()
print("The item has been removed
from the shop!") except Exception as e:
print("Invalid item!")
time.sleep(1)
admin_login(connection,cursor)
elif choice==3:
display_items(cursor)
print("Which item price you would like to
update?")
id=int(input("Enter product ID:"))
price=int(input("Enter the updated price:"))
try:
query=f'''UPDATE Menu SET
product_price={price} WHERE product_id={id}'‘’
cursor.execute(query)
connection.commit()
print("The item price has been
updated!") except Exception as e:
print("Invalid Product ID!")
time.sleep(1)
admin_login(connection,cursor)
elif choice==4:
display_items(cursor)
time.sleep(1.5)
admin_login(connection,cursor)
elif choice==5:
main()
else:
print("Invalid Choice!")
time.sleep(1)
admin_login(connection,cursor)
From the code, you can see that for the choices of update and
delete we are displaying the menu first, making it suitable for the
user to input the correct id and price.
Let’s code display_items() now.
def display_items(cursor):
query='''SELECT * FROM Menu'‘’
cursor.execute(query)
results=cursor.fetchall()
print("List of items: ")
print("ID","Name","Price",sep=" ")
for each in results:
print(each[0],each[1],each[2],sep=" ")
def customer_login(connection,cursor): \
print("-----------Welcome,You are logged
in as a biller!-------------")
print("Here is the list of choices:")
print("Choice 1: Billing", "Choice 2:
Exit",sep="\n")
choice = int(input("Enter your choice:"))
if(choice==1):
name = input("Enter the customer
name:") print(f"What do you
wanna buy {name}?")
time.sleep(0.5)
display_items(cursor)
print()
total = 0
items=[]
while 1:
id=int(input("Enter the
product ID:")) quantity
=int(input("Enter the quantity:"))
try:
query=f'''SELECT *
FROM Menu WHERE product_id={id}’‘’
cursor.execute(query)
result=cursor.fetchone()
total +=
result[2]*quantity
items.append([result[1],quantity])
print(each[0],each[1],sep=":")
print(f"Total:
{total}") print("Thank you! Have a sweet day!")
print()
time.sleep(1)
customer_login(connection,cursor)
elif choice==2:
main()
else:
print("Invalid Choice!")
Now, the only thing left is totime.sleep(1)
call the main function and start the
program execution.
customer_login(connection,cursor)
main()
OUTPUT
BIBLIOGRAPHY
• SUMITA ARORA CLASS XII
• WWW.GOOGLE.COM
• WWW.WIKIPEDIA.COM
• NCERT COMPUTER SCIENCE
• PYTHON IDLE
THANK YOU