0% found this document useful (0 votes)
10 views

Cs Project

Uploaded by

NAMAN
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
10 views

Cs Project

Uploaded by

NAMAN
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 22

PROJECT WORK OF COMPUTER SCIENCE

“RESTAURANT TABLE RESERVATION SYSTEM”

SUBMITTED TO SUBMITTED BY
Mr. Manoj Joshi Harsh Pandey
PGT CS Class 12 th
Roll Number - 2
CERTIFICATE

This is to certify that Harsh Pandey of class 12th A has


successfully completed his Computer Science project on the
topic “Restaurant Table Reservation System” assigned by MR.
Manoj Joshi (PGT CS) during the academic session 2024-2025
as per the guidelines issues by CBSE Delhi.

EXTERNAL EXAMINER’S SIGN INTERNAL EXAMINER’S SIGN


ACKNOWLEDGEMENT

I would like to express my gratitude my subject


teacher Mr. Manoj Joshi(PGT CS) who have me the
golden opportunity to do this wonderful project of
COMPUTER SCIENCE
“Restaurant Table Reservation System”

Harsh Pandey
12th A
INDEX

1. Certificate
2. Acknowledgement
3. Introduction
4. Objective
5. Coding
6. Output
INTRODUCTION
The project is titled "Restaurant Table Reservation
System". This system aims to efficiently manage
customer reservations and table availability in a
restaurant setting. It provides various
functionalities to maintain customer information,
record reservations, view menu details, and
perform essential operations such as searching for
customers and cancelling reservations.

Key Features of the Project:


1. Customer Information Management
2. Table Reservation Management
3. Menu Display
4. Customer Search
5. Table Availability Check
OBJECTIVE
The objective of the "Restaurant Table Reservation
System" project is to develop an effective and
reliable software solution for managing restaurant
reservations and customer information. This
system aims to enhance the operational efficiency
of restaurant staff by streamlining essential tasks,
thus creating a more seamless experience for both
employees and customers. The specific objectives
of this project are:
1. Streamlining Reservation Management:
The system aims to automate the process of
booking tables in the restaurant, reducing the
need for manual data entry and minimizing
human errors. By recording all necessary
details such as reservation IDs, customer IDs,
reservation dates, and times, the system
ensures that the staff can efficiently handle
multiple reservations and avoid double
bookings.
2. Maintaining Customer Information:
The system provides a structured way to store
and manage customer information, including
customer IDs, names, phone numbers, and
email addresses. By having easy access to
customer details, restaurant staff can improve
customer relations, offer personalized services,
and quickly identify returning customers.
3. Ensuring Real-Time Table Availability:
One of the core objectives of this project is to
implement a real-time checking mechanism to
verify table availability for specific dates and
times. This feature helps in optimizing table
utilization and preventing overbooking, leading
to a smoother experience for the customers.
4. Displaying and Managing Menu Information:
The project aims to provide an organized way
to display the restaurant’s menu. By
maintaining details such as item ID, name,
description, price, and availability status, the
system makes it easy for the staff to access and
update the menu. This feature ensures that the
restaurant can keep customers informed about
the latest menu offerings and prices.
5. Facilitating Efficient Data Retrieval and Search:
A key objective of this project is to make it easy
for users to search and retrieve specific
customer and reservation details. By
incorporating search functionalities based on
criteria such as customer ID or name, the
system enhances the staff’s ability to quickly
access and update information, thereby
improving overall service efficiency.
6. Enabling Easy Reservation Cancellations:
The system provides functionality to cancel
reservations efficiently. By allowing staff to
quickly remove bookings from the database
when needed, the system helps in managing
unexpected changes and maintaining up-to-
date records.
CODING
import mysql.connector
from mysql.connector import Error

DATABASE = "restaurant_system"
CUSTOMER_INFO_TABLE = "customer_info"
TABLE_RESERVATION_TABLE = "table_rev"
MENU_TABLE = "menu"

try:
connection = mysql.connector.connect(
host="localhost",
user="root",
password="naman*007"
)
if connection.is_connected():
cursor = connection.cursor()
print("Connected to the database successfully")
except Error as e:
print("Error:", e)

def create_database():
try:
cursor.execute(f"CREATE DATABASE {DATABASE}")
print("Database created")
cursor.execute(f"USE {DATABASE}")
print("Database in use!")
except Error as e:
print("Failed to create or use database:", e)

def create_customer_info():
try:
cursor.execute(f"USE {DATABASE}")
customer_table = f'''CREATE TABLE {CUSTOMER_INFO_TABLE} (
customer_id INT PRIMARY KEY,
customer_name VARCHAR(100),
phone_number VARCHAR(15),
email VARCHAR(100)
)'''
chc = input("Are you sure you want to create the table? Y/N: ").lower()
if chc == "y":
cursor.execute(customer_table)
print("Table created")
else:
print("Command aborted")
except Error as e:
print("Failed to create customer information table:", e)

def create_table_reservation():
try:
cursor.execute(f"USE {DATABASE}")
table_reserve = f'''CREATE TABLE {TABLE_RESERVATION_TABLE} (
reservation_id INT PRIMARY KEY,
reservation_time TIME,
reservation_date DATE,
customer_id INT
)'''
chc = input("Are you sure you want to create the table? Y/N: ").lower()
if chc == "y":
cursor.execute(table_reserve)
print("Table created")
else:
print("Command aborted")
except Error as e:
print("Failed to create reservation table:", e)

def insert_reservation():
try:
cursor.execute(f"USE {DATABASE}")
reservation_id = input("Enter reservation ID: ")
customer_id = input("Enter customer ID: ")
reservation_time = input("Enter reservation time (HH:MM:SS): ")
reservation_date = input("Enter reservation date (YYYY-MM-DD): ")
insert_query = f'''INSERT INTO {TABLE_RESERVATION_TABLE}
(reservation_id, customer_id, reservation_time, reservation_date)
VALUES (%s, %s, %s, %s)'''
cursor.execute(insert_query, (reservation_id, customer_id,
reservation_time, reservation_date))
connection.commit()
print("Reservation inserted successfully!")
except Error as e:
print("Failed to insert reservation:", e)

def insert_customer():
try:
cursor.execute(f"USE {DATABASE}")
customer_id = input("Enter customer ID: ")
customer_name = input("Enter customer name: ")
phone = input("Enter phone number of the customer: ")
email = input("Enter the email ID: ")
insert_query = f'''INSERT INTO {CUSTOMER_INFO_TABLE} (customer_id,
customer_name, phone_number, email)
VALUES (%s, %s, %s, %s)'''
cursor.execute(insert_query, (customer_id, customer_name, phone, email))
connection.commit()
print("Customer inserted successfully!", customer_id)
except Error as e:
print("Failed to insert customer:", e)
def show_reservations():
try:
cursor.execute(f"USE {DATABASE}")
show = f"SELECT * FROM {TABLE_RESERVATION_TABLE}"
cursor.execute(show)
reservations = cursor.fetchall()
if reservations:
print(f"{'Reservation ID':<15} {'Customer ID':<15} {'Reservation Time':<20}
{'Reservation Date':<20}")
print("="*70)
for reservation in reservations:
print(f"{reservation[0]:<15} {reservation[1]:<15} {reservation[2]:<20}
{reservation[3]:<20}")
else:
print("No reservations found.")
except Error as e:
print("Failed to retrieve reservations:", e)

def show_customers():
try:
cursor.execute(f"USE {DATABASE}")
show = f"SELECT * FROM {CUSTOMER_INFO_TABLE}"
cursor.execute(show)
customers = cursor.fetchall()
if customers:
print(f"{'Customer ID':<15} {'Customer Name':<20} {'Phone Number':<15}
{'Email':<25}")
print("="*75)
for customer in customers:
print(f"{customer[0]:<15} {customer[1]:<20} {customer[2]:<15}
{customer[3]:<25}")
else:
print("No customers found.")
except Error as e:
print("Failed to retrieve customers:", e)

def display_menu():
try:
cursor.execute(f"USE {DATABASE}")
cursor.execute(f"SELECT * FROM {MENU_TABLE}")
menu_items = cursor.fetchall()

if menu_items:
print(f"{'ID':<5} {'Name':<25} {'Description':<50} {'Price (INR)':<15}
{'Available':<10}")
print("="*100)
for item in menu_items:
print(f"{item[0]:<5} {item[1]:<25} {item[2]:<50} {item[3]:<15} {'Yes' if
item[4] else 'No':<10}")
else:
print("The menu is empty.")
except Error as e:
print("Failed to retrieve menu items:",e)

def cancel_reservation():
try:
cursor.execute(f"USE {DATABASE}")
reservation_id = input("Enter reservation ID to cancel: ")
delete_query = f"DELETE FROM {TABLE_RESERVATION_TABLE} WHERE
reservation_id = %s"
cursor.execute(delete_query, (reservation_id,))
connection.commit()
print("Reservation cancelled successfully!")
except Error as e:
print("Failed to cancel reservation:", e)

def search_customer():
try:
cursor.execute(f"USE {DATABASE}")
search_type = input("Search by ID (1) or name (2): ")
if search_type == "1":
customer_id = input("Enter customer ID: ")
search_query = f"SELECT * FROM {CUSTOMER_INFO_TABLE} WHERE
customer_id = %s"
cursor.execute(search_query, (customer_id,))
elif search_type == "2":
customer_name = input("Enter customer name: ")
search_query = f"SELECT * FROM {CUSTOMER_INFO_TABLE} WHERE
customer_name LIKE %s"
cursor.execute(search_query, (f"%{customer_name}%",))
customers = cursor.fetchall()
if customers:
print(f"{'Customer ID':<15} {'Customer Name':<20} {'Phone Number':<15}
{'Email':<25}")
print("="*75)
for customer in customers:
print(f"{customer[0]:<15} {customer[1]:<20} {customer[2]:<15}
{customer[3]:<25}")
else:
print("Customer not found.")
except Error as e:
print("Failed to search customer:", e)

def check_table_availability():
try:
cursor.execute(f"USE {DATABASE}")
date = input("Enter reservation date (YYYY-MM-DD): ")
time = input("Enter reservation time (HH:MM:SS): ")
check_query = f"SELECT * FROM {TABLE_RESERVATION_TABLE} WHERE
reservation_date = %s AND reservation_time = %s"
cursor.execute(check_query, (date, time))
reservations = cursor.fetchall()
if reservations:
print("No tables available for the specified date and time.")
else:
print("Tables are available for the specified date and time.")
except Error as e:
print("Failed to check table availability:", e)

def menu_choice():
print('''
/////////////////////////////////////
// Welcome to Restaurant Table //
// Reservation System //
///////////////////////////////////
''')
create_database()

while True:
try:
choice = int(input('''
1 > Create new table for customer information
2 > Create new table for reservation information
3 > Insert customer information
4 > Insert new table reservation information
5 > Show existing reservations
6 > Show customer information of all customers
7 > Show menu
8 > Search a customer
9 > Cancel a reservation
10 > Check Table Availibility
11 > Exit
Enter your choice: '''))
if choice == 1:
create_customer_info()
elif choice == 2:
create_table_reservation()
elif choice == 3:
insert_customer()
elif choice == 4:
insert_reservation()
elif choice == 5:
show_reservations()
elif choice == 6:
show_customers()
elif choice == 7:
display_menu()
elif choice == 8:
search_customer()
elif choice == 9:
cancel_reservation()
elif choice == 10:
check_table_availability()
elif choice == 11:
print("Exiting the system.")
break
else:
print("Incorrect choice")
except ValueError:
print("Invalid input. Please enter a number.")
except Error as e:
print("An error occurred:", e)

# Start the menu


menu_choice()
OUTPUTS

You might also like