Download as docx, pdf, or txt
Download as docx, pdf, or txt
You are on page 1of 13

BUDS INTERNATIONAL SCHOOL

Chikhali , Pune – 411062


Central Board Of Secondary
Education COMPUTER SCIENCE
INVESTIGATORY PROJECT

NAME :- Vansh Dhillon


STD :- XII
STREAM :-
ROLL NO. :-
BOARD ROLL NO. :- 11153819
SUBJECT :-Computer Science
GUIDED BY :- Mrs. Satyaseela Yagnamurthy
TOPIC :- Food Ordering System using Python
CERTIFICATE
This is to certify that this Computer Science
Investigatory Project belong to Vansh Dhillon of class
XII. He has developed this project successfully
completed under my guidance prescribed by AISSC
course during the academic year 2023-2024.

TEACHER INCHARGE
(Mrs .Satyseela Yagnamurthy)

EXTERNAL EXAMINER PRINCIPAL


(Mrs. Suvarna Khot)

DATE :-
ACKNOWLEDGE
MENT
I would like to express my special thanks of
gratitude to my Computer Science Teacher,
Mrs. Satyseela Yagnamurthy, as well as our
principal, Mrs. Suvarna Khot, for their
precious guidance and forgiving me this
golden opportunity to do this project which
also helped me in doing a lot of research and
learn new things.

I am really thankful to them

Secondly , I would like to thank my parents for


their undivided support and interest who
inspired me and encouraged me to go my
own way , also I would like to thank my
friends who helped me a lot in finalizing the
project.

FOOD ORDERING SYSTEM


by Vansh Dhillon

SOURCE CODE:
import os

import platform

import mysql.connector

import pandas as pd

mydb = mysql.connector.connect(host="localhost", user="root", password="admin")

#creating DB

mycursor = mydb.cursor()

mycursor.execute("create database if not exists food1")

mycursor.execute("use food1")

#creating Tables

# Define the Employee table

mycursor.execute("""

CREATE TABLE IF NOT EXISTS Employee (

Emp_id INT AUTO_INCREMENT PRIMARY KEY,

ename VARCHAR(255) NOT NULL,

emp_g VARCHAR(10),

eage INT,

emp_phone BIGINT,

pwd VARCHAR(255)

""")

# Define the Customer table

mycursor.execute("""

CREATE TABLE IF NOT EXISTS Customer (


c_id INT AUTO_INCREMENT PRIMARY KEY,

name VARCHAR(255) NOT NULL,

cphone BIGINT,

payment INT,

pstatus VARCHAR(20),

email VARCHAR(255),

orderid INT,

date DATE

""")

# Define the Food table

mycursor.execute("""

CREATE TABLE IF NOT EXISTS Food (

Food_id INT AUTO_INCREMENT PRIMARY KEY,

Foodname VARCHAR(255) NOT NULL,

Food_size VARCHAR(20),

prize INT

""")

# Define the OrderFood table

mycursor.execute("""

CREATE TABLE IF NOT EXISTS OrderFood (

Orderf_id INT AUTO_INCREMENT PRIMARY KEY,

C_id INT,

Emp_id INT,

Food_id INT,

Food_qty INT,

Total_price INT

""")

# Define the fee table


mycursor.execute("""

CREATE TABLE IF NOT EXISTS fee (

roll INT AUTO_INCREMENT PRIMARY KEY,

feedeposit INT,

month VARCHAR(10)

""")

# main COde

def Customer():

L = []

c_id = int(input("Enter the customer ID number: "))

L.append(c_id)

name = input("Enter the Customer Name: ")

L.append(name)

cphone = int(input("Enter customer phone number: "))

L.append(cphone)

payment = int(input("Enter payment method (1 for credit card, 2 for Debit Card): "))

L.append(payment)

pstatus = input("Enter the payment status: ")

L.append(pstatus)

email = input("Enter the email id: ")

L.append(email)

orderid = input("Enter orderid: ")

L.append(orderid)

date = input("Enter the Date: ")

L.append(date)

cust = (L,)

sql = "INSERT INTO customer (c_id, name, cphone, payment, pstatus, email, orderid, date) VALUES (%s, %s,

%s, %s, %s, %s, %s, %s)"

mycursor.execute(sql, cust)

mydb.commit()
def Employee():

L = []

Emp_id = int(input("Enter the Employee id: "))

L.append(Emp_id)

ename = input("Enter the Employee Name: ")

L.append(ename)

emp_g = input("Enter Employee Gender: ")

L.append(emp_g)

eage = int(input("Enter Employee age: "))

L.append(eage)

emp_phone = int(input("Enter employee phone number: "))

L.append(emp_phone)

pwd = input("Enter the password: ")

L.append(pwd)

EMP = tuple(L) # Convert the list to a tuple

sql = "INSERT INTO Employee (Emp_id, ename, emp_g, eage, emp_phone, pwd) VALUES (%s, %s, %s, %s,

%s, %s)"

mycursor.execute(sql, EMP)

mydb.commit()

def Food():

L = []

Food_id = int(input("Enter the Food id: "))

L.append(Food_id)

Foodname = input("Enter the Food Name: ")

L.append(Foodname)

Food_size = input("Enter Food size: ")

L.append(Food_size)

prize = int(input("Enter Prize of Food: "))

L.append(prize)

Food = (L,)

sql = "INSERT INTO Food (Food_id, Foodname, Food_size, prize) VALUES (%s, %s, %s, %s)"
mycursor.execute(sql, Food)

mydb.commit()

def OrderFood():

L = []

Orderf_id = int(input("Enter the Food Order id: "))

L.append(Orderf_id)

C_id = int(input("Enter the Customer id: "))

L.append(C_id)

Emp_id = int(input("Enter Employee id: "))

L.append(Emp_id)

Food_id = int(input("Enter Food id: "))

L.append(Food_id)

Food_qty = int(input("Enter Qty: "))

L.append(Food_qty)

Total_price = int(input("Enter Total_price: "))

L.append(Total_price)

OrderFood = tuple(L) # Convert the list to a tuple

sql = "INSERT INTO OrderFood (Orderf_id, C_id, Emp_id, Food_id, Food_qty, Total_price) VALUES (%s, %s,

%s, %s, %s, %s)"

mycursor.execute(sql, OrderFood)

mydb.commit()

def View():

print("Select the search criteria: ")

print("1. Employee")

print("2. Customer")

print("3. Food")

print("4. Order Food")

ch = int(input("Enter the choice 1 to 4: "))

if ch == 1:

Emp_id = int(input("Enter Employee ID: "))

sql = "SELECT * FROM Employee WHERE Emp_id = %s"


mycursor.execute(sql, (Emp_id,))

res = mycursor.fetchall()

for x in res:

print(x)

elif ch == 2:

c_name = input("Enter Customer Name: ")

sql = "SELECT * FROM Customer WHERE name = %s"

mycursor.execute(sql, (c_name,))

res = mycursor.fetchall()

for x in res:

print(x)

elif ch == 3:

sql = "SELECT * FROM Food"

mycursor.execute(sql)

res = mycursor.fetchall()

for x in res:

print(x)

elif ch == 4:

food_id = int(input("Enter Food ID: "))

sql = "SELECT * FROM OrderFood WHERE Food_id = %s"

mycursor.execute(sql, (food_id,))

res = mycursor.fetchall()

for x in res:

print(x)

def MenuSet():

print("Enter 1 to Add Employee")

print("Enter 2 to Add Customer details")

print("Enter 3 to Add Food Details")

print("Enter 4 for Food Order")

print("Enter 5 to view Food booking")


try:

userInput = int(input("Please Select an above option: "))

except ValueError:

exit("\nHey! That's Not A Number")

else:

print("\n")

if userInput == 1:

Employee()

elif userInput == 2:

Customer()

elif userInput == 3:

Food()

elif userInput == 4:

OrderFood()

elif userInput == 5:

View()

else:

print("Enter correct choice. . .")

def runAgain():

runAgn = input("\nWant to run again? (Y/N): ")

while runAgn.lower() == 'y':

if platform.system() == "Windows":

os.system("cls")

else:

os.system("clear")

MenuSet()

runAgn = input("\nWant to run again? (Y/N): ")

MenuSet()

print("Good Bye... HAVE A NICE DAY")


Sample Output:
Enter 1 to Add Employee

Enter 2 to Add Customer details

Enter 3 to Add Food Details

Enter 4 for Food Order

Enter 5 to view Food booking

Please Select an above option: 1

Enter the Employee id: 101

Enter the Employee Name: John Doe

Enter Employee Gender: Male

Enter Employee age: 30

Enter employee phone number: 1234567890

Enter the password: securepwd

Want to run again? (Y/N): Y


Enter 1 to Add Employee

Enter 2 to Add Customer details

Enter 3 to Add Food Details

Enter 4 for Food Order

Enter 5 to view Food booking

Please Select an above option: 5

Select the search criteria:

1. Employee

2. Customer

3. Food

4. Order Food

Enter the choice 1 to 4: 1

Enter Employee ID: 101

(101, 'John Doe', 'Male', 30, 1234567890, 'securepwd')


Want to run again? (Y/N): N

You might also like