Jyotirmoy
Jyotirmoy
IY CR
DR P
EN
F
ri K
Am
PM Sh
erigog
A Project Report on
Submitted by:
PGT (Comp.Sc)
1|Page
CERTIFICATE
2|Page
ACKNOWLEDGEMENT
3|Page
INDEX
1. Introduction----------------------------------------------.6
2. Feature of Python & MySQL-------------------------.7
3. The features of MySQL are as follows:------------.9
4. System Requirements--------------------------------.10
5. Source Code----------------------------------------.11-32
6. Screen Shot---------------------------------------------.33
Sql database-
i. Main table--------------------------------------.33
ii. Customer table-------------------------------.34
iii. Employee table-------------------------------.35
iv. Feedback table-------------------------------.36
v. Food table-------------------------------------.37
vi. Orderfood table------------------------------.38
Python output-
i. Main menu-------------------------------------.39
ii. Employee menu------------------------------.40
iii. Customer menu-------------------------------.41
iv. Food menu-------------------------------------.42
v. Orderfood menu------------------------------.43
vi. view----------------------------------------------.44
4|Page
• Employee details-------------------44
• Customer details------------------.45
• Food details------------------------.46
• Orederfood details----------------.47
• Feedback details------------------.48
• Return to main manu-------------.49
vii. Feedback menu-------------------------.50
viii. Exit menu--------------------------------.51
7. Bibliography/Reference-----------------------------.52
5|Page
Introduction
This software, being simple in design and working, does not require much
of training to users, and can be used as a powerful tool for automating a Food
Hub.
During coding and design of the software Project, Python, a powerful tool is
used apart from this a powerful, open source RDBMS, My SQL is used as per
requirement of the CBSE curriculum of Computer Science Course.
6|Page
Feature of Python & MySQL
Python is a dynamic, high level, free open source and interpreted
programming language. It supports object-oriented programming as well as
procedural oriented programming.
There are many features in Python, some of which are discussed below –
2. Free and Open Source: Python language is freely available at official website
and you can download it from the given download link below click on the
Download Python kyeword.
7|Page
8. Python is Integrated language: Python is also an Integrated language because
we can easily integrated python with other language like c, c++ etc.
10. Large Standard Library: Python has a large standard library which provides rich
set of module and functions so you do not have to write your own code for every
single thing.There are many libraries present in python for such as regular
expressions, unit-testing, web browsers etc.
8|Page
The features of MySQL are
as follows:
1. Ease of Management – The software very easily gets downloaded and also uses
an event scheduler to schedule the tasks automatically.
2. Robust Transactional Support – Holds the ACID (Atomicity, Consistency,
Isolation, Durability) property, and also allows distributed multi-version
support.
3. Comprehensive Application Development – MySQL has plugin libraries to
embed the database into any application. It also supports stored procedures,
triggers, functions, views and many more for application development.
4. High Performance – Provides fast load utilities with distinct memory caches
and table index partitioning.
5. Low Total Cost Of Ownership – This reduces licensing costs and hardware
expenditures.
6. Open Source & 24 * 7 Support – This RDBMS can be used on any platform and
offers 24*7 support for open source and enterprise edition.
7. Secure Data Protection – MySQL supports powerful mechanisms to ensure
that only authorized users have access to the databases.
8. High Availability – MySQL can run high-speed master/slave replication
configurations and it offers cluster servers.
9. Scalability & Flexibility – With MySQL you can run deeply embedded
applications and create data warehouses holding a humongous amount of
data.
9|Page
System Requirement
Recommended System Requirements
Disk space: 2 to 3 GB
Disk space: 1 GB
CPU: Intel Core or Xeon 3GHz (or Dual Core 2GHz) or equal AMDCPU.
RAM: 4 GB (6 GB recommended)
10 | P a g e
Source Code
import os
import platform
import mysql.connector
import pandas as pd
mydb = mysql.connector.connect(host="localhost",
user="root", password="W7301@jqir#", database="food1")
mycursor = mydb.cursor()
mycursor.execute("""
emp_g VARCHAR(10),
11 | P a g e
eage INT,
emp_phone BIGINT,
pwd VARCHAR(255)
""")
mycursor.execute("""
cphone BIGINT,
payment INT,
pstatus VARCHAR(20),
email VARCHAR(255),
orderid INT,
date DATE
""")
12 | P a g e
mycursor.execute("""
Food_size VARCHAR(20),
prize INT
""")
mycursor.execute("""
C_id INT,
Emp_id INT,
Food_id INT,
Food_qty INT,
Total_price INT
""")
13 | P a g e
mycursor.execute("""
c_id INT,
feedback_text TEXT,
feedback_date DATE,
""")
def Feedback():
L = []
while True:
try:
14 | P a g e
mycursor.execute("SELECT c_id FROM Customer
WHERE c_id = %s", (c_id,))
break
else:
except ValueError:
L.append(c_id)
L.append(feedback_text)
feedback_date = date.today()
L.append(feedback_date)
feedback_data = tuple(L)
15 | P a g e
sql = "INSERT INTO Feedback (c_id, feedback_text,
feedback_date) VALUES (%s, %s, %s)"
mycursor.execute(sql, feedback_data)
mydb.commit()
def get_food_price(Food_id):
result = mycursor.fetchone()
def Customer():
L = []
L.append(name)
16 | P a g e
while True:
try:
if len(str(cphone)) == 10:
break
else:
except ValueError:
L.append(cphone)
17 | P a g e
payment = input("Enter payment method (1 for Credit
Card, 2 for Debit Card): ").strip()
L.append(int(payment))
L.append(pstatus)
L.append(email)
L.append(orderid)
L.append(date)
cust = tuple(L)
18 | P a g e
sql = "INSERT INTO Customer (name, cphone, payment,
pstatus, email, orderid, date) VALUES (%s, %s, %s, %s,
%s, %s, %s)"
mycursor.execute(sql, cust)
mydb.commit()
def Employee():
L = []
L.append(ename)
L.append(emp_g)
while True:
try:
19 | P a g e
eage = int(input("Enter Employee age: ").strip())
if eage > 0:
break
else:
except ValueError:
L.append(eage)
while True:
try:
if len(str(emp_phone)) == 10:
break
else:
except ValueError:
20 | P a g e
print("Invalid phone number. Please enter a valid
number.")
L.append(emp_phone)
L.append(pwd)
EMP = tuple(L)
mycursor.execute(sql, EMP)
mydb.commit()
def Food():
L = []
L.append(Foodname)
21 | P a g e
Food_size = input("Enter Food size
(Small/Medium/Large): ").strip().capitalize()
L.append(Food_size)
while True:
try:
if prize > 0:
break
else:
except ValueError:
L.append(prize)
Food_data = tuple(L)
22 | P a g e
sql = "INSERT INTO Food (Foodname, Food_size, prize)
VALUES (%s, %s, %s)"
mycursor.execute(sql, Food_data)
mydb.commit()
def OrderFood():
L = []
while True:
try:
break
except ValueError:
L.append(C_id)
while True:
23 | P a g e
try:
break
except ValueError:
L.append(Emp_id)
while True:
try:
break
else:
except ValueError:
24 | P a g e
L.append(Food_id)
while True:
try:
if Food_qty > 0:
break
else:
except ValueError:
L.append(Food_qty)
L.append(Total_price)
Order_data = tuple(L)
25 | P a g e
sql = "INSERT INTO OrderFood (C_id, Emp_id, Food_id,
Food_qty, Total_price) VALUES (%s, %s, %s, %s, %s)"
mycursor.execute(sql, Order_data)
mydb.commit()
def display_view_menu_box():
view_options = [
26 | P a g e
print("║" + " " * 38 + "║")
def View():
display_view_menu_box()
try:
if choice == 1:
27 | P a g e
records = mycursor.fetchall()
print("\nEmployee Details:")
print(record)
elif choice == 2:
records = mycursor.fetchall()
print("\nCustomer Details:")
print(record)
elif choice == 3:
records = mycursor.fetchall()
print("\nFood Details:")
print(record)
elif choice == 4:
records = mycursor.fetchall()
28 | P a g e
print("\nOrder Details:")
print(record)
elif choice == 5:
records = mycursor.fetchall()
print("\nFeedback:")
print(record)
elif choice == 6:
else:
except ValueError:
def display_menu_box():
29 | P a g e
options = [
"7. Exit"
30 | P a g e
print("╚" + "═" * 38 + "╝")
def MenuSet():
display_menu_box()
try:
if userInput == 1:
Employee()
elif userInput == 2:
Customer()
elif userInput == 3:
Food()
elif userInput == 4:
OrderFood()
elif userInput == 5:
View()
elif userInput == 6:
31 | P a g e
Feedback()
elif userInput == 7:
print("Exiting program.")
exit()
else:
except ValueError:
MenuSet()
32 | P a g e
------------------SQL DATABASE-------------
33 | P a g e
----------------------- CUSTOMER TABLE-----------------------
34 | P a g e
-----------------------EMPLOYEE TABLE-------------------------
35 | P a g e
---------------------FEEDBACK TABLE----------------------
36 | P a g e
--------------------------FOOD TABLE----------------------
37 | P a g e
---------------------ORDERFOOD TABLE------------------
38 | P a g e
----------------------- OUTPUT -----------------------
MAIN MENU
39 | P a g e
1.EMPLOYEE MENU-
40 | P a g e
2.CUSTOMER MENU-
41 | P a g e
3.FOOD MENU-
42 | P a g e
4.ORDER FOOD MENU-
43 | P a g e
5.VIEW MENU-
i.EMPLOYEE DETAILS-
44 | P a g e
ii.CUSTOMER DETAILS-
45 | P a g e
iii.FOOD DETAILS-
46 | P a g e
iv.ORDER FOOD DETAILS-
47 | P a g e
V.FEEDBACK MENU-
48 | P a g e
vi.RETURN TO MAIN MENU-
49 | P a g e
6.FEEDBACK MENU-
50 | P a g e
7.EXIT MENU-
51 | P a g e
Bibliography/Reference
In order to work on this project, the following books and literature are
referred by me during the various phases of development of the project:
Reference Book:
Computer Science by : Sumita Arora
Reference Websites:
www.google.com
www.python.org
www.w3schools.com
www.mysql.com
www.mysqltutorial.org
www.pythontrends.wordpress.com
52 | P a g e