0% found this document useful (0 votes)
33 views20 pages

Project Work: My SQL

Uploaded by

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

Project Work: My SQL

Uploaded by

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

PROJECT WORK

SOFTWARE- PYTHON AND


MY SQL

TOPIC- BAKERY BILLING


MANAGEMENT SYSTEM

1| Page
Item Number: 1, Item: cheesecake, Pieces: 20, Price: $150, Type: cake
Item Number: 2, Item: blackforest, Pieces: 15, Price: $100, Type: cake
Item Number: 3, Item: butterscotch, Pieces: 15, Price: $125, Type: cake
Item Number: 4, Item: red velvet, Pieces: 7, Price: $200, Type: cake
Item Number: 5, Item: multi grain, Pieces: 18, Price: $100, Type: bread
Item Number: 6, Item: croissant, Pieces: 10, Price: $250, Type: bread
Item Number: 7, Item: baguette, Pieces: 5, Price: $225, Iype: bread
Item Number: 8, Item: chocolate donut, Pieces: 5, Price: ^155, Type: donut
Item Number: 9, Item: vanilla, Pieces: 11, Price: $50, Type: donut
Item Number: 10, Item: frosted donut, Pieces: 15, Price: $75, Type: donut
Item Number: 11, Item: panini, Pieces: 12, Price: $245, Type: sandwich
Item Number: 12, Item: french toast, Pieces: 10, Price: $275, Type: sandwich
Do you want to add an item to the cart? (yes/no): yes
Enter the item name: red velvet
Enter the number of pieces: 3
Item: red velvet, Pieces: 3, Price: ^200
Do you want to add an item to the cart? (yes/no): yes
Enter the item name: croissant
Enter the number of pieces: 2
Item: croissant, Pieces: 2, Price: $250
Do you want to add an item to the cart? (yes/no): no
Total cost: ^1100

13| Page
# Get the price of the item
cursor.execute("'SELECT price FROM schoolbakery
WHERE item =%s", (item,))
price = cursor.fetchone()[0]

# Update the pieces in the database


cursor.execute("UPDATE schoolbakery SET pieces
= pieces -%s WHERE item=%s",(pieces, item))
cnx.commit()

#Print the item name, number of pieces, and price


print(f"lItem: fitem}, Pieces: {pieces), Price:
${price}")

# Calculate the total cost

total_cost += pieces * price


else:
break

# Print the total cost

print(f"Total cost: ${total_cost}")


12 | Page
ADDING ITEMS TOTHE CART AND GETTING TOTAL
PRICE

cursor.execute("SELECT * FROM schoolbakery")

for (itemno, item, pieces, price, type) in cursor:


print(f"Item Number: {itemno}, Item: {item}, Pieces:
{pieces}, Price: ${price), Type: (type}")

# Initialize total cost

total cost = 0

while True:
# Ask the user if they want to add an item to the cart
choice = input("Do youwant to add an item to the
cart? (yes/no): ")
if choice.lower()=="yes":
# Get the item name and number of pieces from the
user

item = input("Enter the item name: ")


pieces = int(input("Enter the number of pieces: ")
11| Page
#Ask the user if they want to add or delete pieces
action = input("Doyou want to add or delete pieces?
(add/delete): ")

# Get the item name and number of pieces from the user
item = input("Enter the item name: ")
pieces = int(input("Enter the number of pieces: ")

if action =="add":
#Add the specified number of pieces to the item in the
database
cursor.execute("UPDATE Schoolbakery SET pieces =
pieces + %s WHERE item =%s",(pieces, item)
cnx.commit()
print("Pieces added successfully!")
elif action == "delete":

# Delete the specified number of pieces from the item in


the database

cursor.execute("UPDATE Schoolbakery SET pieces =


pieces - %s WHERE item = %s",(pieces, item)
cnx.commit()
print("Pieces deleted successfully!")
else:

9| Page
#Ask the user if they want to add or delete pieces
action = input("Doyou want to add or delete pieces?
(add/delete): ")

# Get the item name and number of pieces from the user
item = input("Enter the item name: ")
pieces = int(input("Enter the number of pieces: ")

if action =="add":
#Add the specified number of pieces to the item in the
database
cursor.execute("UPDATE Schoolbakery SET pieces =
pieces + %s WHERE item =%s",(pieces, item)
cnx.commit()
print("Pieces added successfully!")
elif action == "delete":

# Delete the specified number of pieces from the item in


the database

cursor.execute("UPDATE Schoolbakery SET pieces =


pieces - %s WHERE item = %s",(pieces, item)
cnx.commit()
print("Pieces deleted successfully!")
else:

9| Page
print("Invalid action, please enter 'add' or 'delete'")

#Ask the user if they want to continue


choice = input("Do you want tocontinue? (yes/no): ")
if choice.lower() != "yes":
break

Item Number: 1, Item: cheesecake, Pieces: 20, Price: 150, Type: cake
Item Number: 2, Item: blackforest, Pieces: 15, Price: $100, Type: cake
Item Number: 3, Item: butterscotch, Pieces: 15, Price: ^125, Type: cake
Item Number: 4, Item: red velvet, Pieces: 9, Price: $200, Type: cake
Item Number: 5, Item: multi grain, Pieces: 18, Price: $100, Type: bread
Item Number: 6, Item: croissant, Pieces: 10, Price: $250, Type: bread
Item Number: 7, Item: baguette, Pieces: 5, Price: $225, Iype: bread
Item Number: 8, Item: chocolate donut, Pieces: 6, Price: $155, Type: donut
Item Number: 9, Item: vanilla, Pieces: 11, Price: $50, Iype: donut
Item Number: 10, Item: frosted donut, Pieces: 15, Price: $75, Type: donut
Item Number: 11, Item: panini, Pieces: 12, Price: $245, Type: sandwich
Item Number: 12, Item: french toast, Pieces: 10, Price: $275, Type: sandwich
Do you want to add or delete pieces? (add/delete) : add
Enter the item name: croissant
Enter the number of pieces: 5
Pieces added successfully!
Do you want to continue? (yes/no): yes
Do you want to add or delete pieces? (add/ delete) : delete
Enter the item name: chocolate donut
Enter the number of pieces: 1
Pieces deleted successfully !
DO you want to continue? (yes/no): no
10| Page
SOURCECODE
ADD OR DELETE ITEM PIECES FROM DATABASE

import mysql.connector

# Connect to the database

cnx = mysql.connector.connect(user='root',
password='Eren@mikasa',
host='localhost',
database='project')

# Create acursor
cursor = cnx.cursor()

cursor.execute("'SELECT * FROM schoolbakery")

#Iterate through the result set


for (itemno, item, pieces, price, type) in cursor:
#Print the itemno, item,pieces, price, and type
print(f"Item Number: {itemno}, Item: {item}, Pieces:
{pieces}, Price: ${price}, Type: {type}")

while True:

8| Page
MY SQL DATABASE TABLE
SCHOOLBAKERY

mysql> select * from schoolbakery;


itemno item | pieces price | type
1 cheesecake 20 150 cake
2 blackforest 15 100 cake
3 butterscotch 15 125 cake
4 red velvet 200 cake
5 multi grain HH18 100 bread
6 croissant 15 250 bread
baguette 225 bread
chocolate donut 155 donut
9 vanilla 11
HHH 50 donut
10 frosted donut 15 75 donut
11 panini 12 245 sandwich
12 french toast 10 275 Sandwich

7| Page
PROPOSED SYSTEM
Today one cannot afford to rely on the fallible
human beings of be really wants to stand against
today'smerciless competition where not to wise
saying "to err is human'" no longer valid, it's out
dated to rationalize your mistake. So, to keep
pace with time, to bring about the best result
without malfunctioning and greater efficiency so
to replace the unending heaps of flies with a
much sophisticated hard disk of the computer.
One has to use the data management software.
Software has been an ascent in atomization
various organisations. Many software products
working are now in markets, which have helped
in making the organizations work easier and
efficiently. Data management initially had to
maintain a lot of ledgers and a lot of paperwork
has to be done but now software producton this
organization has made their work faster and
easier. Now onlythis software has to be loaded
on the computer and work can be done.
This prevents a lot of time and money. The work
becomes fully automated and any information
regarding the organization can be obtained by
clicking thebutton. Moreover, now it's an age of
computers of and automating such an
organization gives the better look.

6| Pa ge
HARDWARE AND SOFTWARE
REOUIREMENTS

I.OPERATING SYSTEM :WINDOWS 7 AND ABOVE


II. PROCESSOR :PENTIUM(ANY) OR AMD
ATHALON(3800+- 4200+ DUALCORE)
III. MOTHERB0ARD :1.845 OR 915,995 FOR
PENTIUM OR MSI K9MM-V VIAK8M800+8237R
PLUS CHIPSET FOR AMD ATHALON
IV. RAM :512MB+
V. Hard disk : SATA 40 GB OR ABOVE
VI. CD/DVD r/w multi drive combo: (If back up
required)
VII. FLOPPY DRIVE :1.44 MB (If Backup
required)
VIII. MONITOR :14.1 or 15 -17 inch
IX. Key board and mouse
X. Printer :(if print is required -
[Hard copyl)
SOFTWARE REQUIREMENTS:
I. Windows OS
II. Python
II, MySQL

5| Pa ge
PROJECT ON BAKERY BILLING
MANAGEMENT SYSTEM
INTRODUCTION
This programme helps user to generate a bill of
his/her bakery account.
It gives the whole menu of a bakery and ask user
to select one or more item and and then it shows
total bill with granted discount.
Allow user to add or delete item pieces from
menu and gives output.

OBJECTIVE OF THIS PROJECT


The objective of this project is to let the
students apply the programming knowledge into
a real- world situation/problem and exposed the
studentshow programming skills helps in
developing agood software.
1. Write programs utilizing modern software
tools
2. Write effective procedural code to solve
small to medium size projects.
3. Students will demonstrate ability to
conduct a research or applied Computer
Science project, requiring writing and
presentation skills which exemplify
scholarly style in computer science.
4 |Page
PROJECT ON BAKERY BILLING
MANAGEMENT SYSTEM
INTRODUCTION
This programme helps user to generate a bill of
his/her bakery account.
It gives the whole menu of a bakery and ask user
to select one or more item and and then it shows
total bill with granted discount.
Allow user to add or delete item pieces from
menu and gives output.

OBJECTIVE OF THIS PROJECT


The objective of this project is to let the
students apply the programming knowledge into
a real- world situation/problem and exposed the
studentshow programming skills helps in
developing agood software.
1. Write progranms utilizing modern software
tools
2. Write effective procedural code to solve
small to medium size projects.
3. Students will demonstrate ability to
conduct a research or applied Computer
Science project, requiring writing and
presentation skills which exemplify
scholarly style in computer science.
4 | Page
INDEX

S NO. DESCRIPTION PAGE NO.

1 ACKNOWLEDGEMENT 4

2 INTRODUCTION AND 5
OBJECTIVE OFTHE
PROJECT

3 HARDNARE AMD 6
SOFTWARE
REQUIREMENTS

4 PROPOSED SYSTEM 7

5 MY SQL DATABASE 8
TABLE- SCHOOLBAKERY

6 SOURCE CODE AND 9-21


OUTPUT

7 BIBLIOGRAPHY 22

2| Page
ACKNOWLEDGEMENT

Apart from the efforts of me, the success of any


project depends largely on the encouragement and
guidelines of many others. I take this opportunity to
express my gratitude to the people who have been
instrumnental in the successful completion of this
project.
Iexpress deep sense of gratitude to almighty God for
giving me strength for the successful completion of
the project.
Iexpress my heartfelt gratitude to my parents for
constant encouragement while carrying outthis
project.
Igratefully acknowledge the contribution of the
individuals who contributed in bringing this project up
tothis level, wh0 continues to look after me despite
my flaws,
My sincere thanks to Master In-charge, A guide,
Mentor all the above a friend, who crititily reviewed
my project and helped in solving each and every
problem, occurred during implementation of the
project
The guidance and support received from all the
members who contributed and who are contributing to
this project, was vital for the success of the project. I
am grateful for their constant support and help.

3| Pa ge
Item Number: 1, Item: cheesecake, Pieces: 20, Price: $150, Type: cake
Item Number: 2, Item: blackforest, Pieces: 15, Price: $100, Type: cake
Item Number: 3, Item: butterscotch, Pieces: 15, Price: $125, Type: cake
Item Number: 4, Item: red velvet, Pieces: 4, Price: $200, Type: cake
Item Number: 5, Item: multi grain, Pieces: 18, Price: $100, Type: bread
Item Number: 6, Item: croissant, Pieces: 8, Price: $250, Type: bread
Item Number: 7, Item: baguette, Pieces: 5, Price: $225, Type : bread
Item Number: 8, Item: ch0 colate donut, Pieces: 5, Price: $155, Type: donut
Item Number: 9, Item: vanilla, Pieces: 11, Price: $50, Type: donut
Item Number: 10, Item: frosted donut, Pieces: 15, Price: $75, Type: donut
Item Number: 11, Item: panini, Pieces: 12, Price: $245, Type: sandwich
Item Number: 12, Item: french toast, Pieces: 10, Price: $275, Type: sandwich
Enter the item name: vanilla
The type of vanilla is donut
Do you want to select more items? (yes/no): yes
Enter the item name: panini
The type of panini is sandwich
Do you want to select more items? (yes/no): yes
Enter the item name: baguette
The type of baguette is bread
Do you want to select more items? (yes/no): no

# Close the cursor and the connection

cursor.close()
cnx.close()

20| P a ge
else:

print(f"ltem not found in the database")


#Ask the user if they want to select more items
choice = input("Do you want to select more items?
(yes/no):")
if choice.lower() != "yes":
break

19| Pa ge
IF USER BUYS MORE THAN 3ITEM HE GETS DISCOUNT
OF 20%

cursor.execute("SELECT * FROM schoolbakery")

for (itemno, item, pieces, price,type) in cursor:


print(f"Item Number: {itemno}, Item: {item}, Pieces:
{pieces}, Price: ${price), Type: (type}")

cart_items = [)
total_price = 0

while True:
# Ask the user if they want to add an item to the cart
action = input("Do you want to add an item to the
cart? (yes/no): ")

if action.lower()== "yes":
# Get the item name and quantity from the user
item = input("Enter the item name: ")

14 | Pa ge
quantity =int(input("Enter the number of pieces:
"))

# Get the price of the item from the database

cursor.execute("SELECT price FROM schoolbakery


WHERE item = %s", (item,))
price = cursor.fetchone()[0]

# Add the item and its price to the cart


cart_items.append(item, quantity, price))
total_price += quantity * price

print(f"{quantity} pieces of {item} added to the


cart.")
elif action.lower() == "no":
break

else:

print("Invalid input. Please enter 'yes' or 'no'.")

# check if the user has added more than 3 items

if len(cart_items) >3:
15| Pa ge
#Apply a 20% discount on the total price
total price = total price * 0.8
print("You have added more than 3 items, so you get
a 20% discount.")

#Print the items in the cart and the total price


print("\nltems in the cart:")
for item in cart_items:
print(f"(iten[0]} ({item[1]} pieces)")
print(f"\nTotal price: ${total_price}")

16| Page

You might also like

pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy