Project Work: My SQL
Project Work: My SQL
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]
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
# 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":
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":
9| Page
print("Invalid action, please enter 'add' or 'delete'")
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
cnx = mysql.connector.connect(user='root',
password='Eren@mikasa',
host='localhost',
database='project')
# Create acursor
cursor = cnx.cursor()
while True:
8| Page
MY SQL DATABASE TABLE
SCHOOLBAKERY
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
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.
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
7 BIBLIOGRAPHY 22
2| Page
ACKNOWLEDGEMENT
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
cursor.close()
cnx.close()
20| P a ge
else:
19| Pa ge
IF USER BUYS MORE THAN 3ITEM HE GETS DISCOUNT
OF 20%
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:
"))
else:
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.")
16| Page