0% found this document useful (0 votes)
10 views19 pages

Dav Public School Midnapore: Bakery Management Project

Soma soma

Uploaded by

imankdey
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
10 views19 pages

Dav Public School Midnapore: Bakery Management Project

Soma soma

Uploaded by

imankdey
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
You are on page 1/ 19

DAV PUBLIC

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.

I would also like to express


my gratitude to our respective
principle sir Mr.N.K.GAUTAM
for the support by providing
all sort of things that we
required for the competition
of this project I would sincere
also like to thanks my parents
for their sincere help.
BAKERY MANAGEMENT SYSTEM IN PYTHON
Our bakery’s name is DOUGH & DELIGHT Bakery.Here we are going to
build a Python application for it. This is going to be a console-based
application.

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.

LET’S DESIGN THIS SYSTEM:


Workflow:
1. Firstly, we are going to create a database to store the items and
their prices that we are selling in our bakery.
2. The user will have 3 choices: admin login, customer login, and exit. A
while loop will be run infinite times until the user chooses the exit
option.
3. To log in as an admin, a password is needed. For the admin login,
there will be a separate function with options to: add an item,
remove an item, update an item, display the items, and exit from
the section.
4. For customer login, the biller will take the customer’s name and
order as inputs and generate the bill. Here also, there will be an
option to exit the section.
5. Every step will have a time gap to make the result look systematic
and readable.
1. IMPORT THE MODULES
The only modules required here are (sqlite3) for
the database and the time module for the sleep
time.

sqlite3 is the sqlite3 database integrated with


python .There is no need to additionally install
this module as it comes bundled with Python.

MODULES:
import sqlite3
import time

2. CREATE THE DATABASE


The steps to create an SQLite database in
Python is simple. Just establish the connection
and every time you will execute a query, execute
it with a cursor object.

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)''')

The keywords IF NOT EXISTS will make sure that


irrespective of how much code will be run, the database will
only be created once.

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=" ")

time.sleep() takes seconds as parameters and set the given


time as an interval between the two code lines.
5. DESIGN A FUNCTION FOR CUSTOMER LOGIN
Customer login will have only 2 choices:
1. Billing: The customer’s name will be taken as input.
Multiple items can be ordered with desired quantity. The
function will then generate the bill containing the description of
items with their quantities and total price.
2. Exit: This choice will redirect to the main function.

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])

i=input("Anything else?Answer Y for Yes and N


print("Invalid
Entry!")
print(e)
break
if(total!=0):
print()
print("---------Moon Pie
Bakery--------") print("-------
Billing Details-------")
print(f"Name:{name}")
print(f"Items:")
for each in items:

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

You might also like