COMPUTERS
INVESTIGATORY
PROJECT
NAME :-SagarAdhikary
CLASS :- XII
SECTION :- A
ROLL NO. :- 12
CERTIFICATE
Department of ComputerScience
THIS IS TO CERTIFY THAT SAGAR ADHIKARY, STUDENT OF
CLASS 12 SECTION-A HAS SUCCESSFULLY COMPLETED THEIR
COMPUTERS INVESTIGATORY PROJECT ON THE TOPIC “HOTEL
MANAGEMENT SYSTEM”UNDER THE GUIDANCE OF Ms.ANURADHA.
DURING THE ACADEMIC YEAR 2024-2025 IN PARTIAL FULFILLMENT
OF CHEMISTRY PRACTICAL EXAMINATION CONDUCTED BY CBSE ,
NEW DELHI.
___________ ___________
SIGNATURE OF SIGNATURE OF
INTERNAL EXAMINER EXTERNAL EXAMINER
ACKNOWLEDGEMENT
I WOULD LIKE TO EXPRESS MY SPECIAL THANKS OF
GRATITUDE TO MY RESPECTED PRINCIPAL MAM’M
DR. ESHWARI PRABHAKAR
AND ALSO TO MY COMPUTER TEACHER
Ms.ANURADHA
WHO HAVE GIVEN ME THE GOLDEN OPPORTUNITY TO DO
THIS WONDERFUL PROJECT OF COMPUTERS ON
“HOTEL MANAGEMENT SYSTEM”
I CAME TO KNOW ABOUT SO MANY NEW THINGS, I AM
REALLY THANKFUL TO THEM. SECONDLY I WOULD ALSO
LIKE TO THANK MY PARENTS AND MY FRIENDS WHO
HELPED ME A LOT IN FINALISING THIS PROJEST WITHIN
THE LIMITED TIME FRAME.
Index
i. Introduction
ii. Objective
iii. Technologies used
iv. System design
v. Python code implementation
vi. Results and discussions
vii. conclusions
Introduction
The Hotel Management System (HMS) is a
software application designed to automate and
streamline the management of hotel
operations. The system enables efficient
handling of check-ins, check-outs, guest
information, and room availability using Python
for the front-end and MySQL for the back-
end database. This system reduces the time
spent on manual record-keeping and enhances
the management of bookings, guest details,
and room assignments. The project uses
Python’s MySQL connector to establish a
connection between the Python application and
the MySQL database, ensuring seamless data
retrieval and manipulation.
Objective:
The primary objectives of this investigatory project are:
1. Automate Hotel Operations:
To reduce manual work in managing check-in’s, check-out’s and room
assignments.
2. Efficient Guest Information Management:
To store guest details, booking information, and payment records
systematically.
3. Room Availability Management:
To check and update room status(available or booked) automatically.
4. Data Integrity and Security:
Ensure that guest data is properly stored, with a relational database
ensuring consistency.
5. Provide Reports:
To generate simple reports for operations such as daily check-in’s,
check-out’s, and available rooms.
6. Learn about Integrating Python and MySQL:
To investigate how Python can be used to manage a database (MySQL)
effectively for a real-world application.
Technologies Used:
1. Python:
The primary programming language used for the
development of the system.
2. MySQL:
A relational database management system used for
storing hotel data (guest details, room statuses, etc.).
3. MySQL Connector for Python:
A Python library used to connect Python to a MySQL
database.
4.Command-Line Interface (CLI):
The user interface for interacting with the system (no
GUI).
System Design:
1. Database Design:
The system uses a MySQL relational database to store the following tables:
1. rooms: Contains details about hotel rooms, including room type, status (available or
booked), and price.
2. guests: Stores guest information, including personal details, check-in and check-out
dates, and room assignment.
3. payments: Records payment details for each guest, including the amount paid and
payment date.
Here are the table structures:
a. rooms table:
(sql)
CREATETABLE rooms (
room_idINT AUTO_INCREMENT PRIMARY KEY,
room_typeVARCHAR(20),
room_statusVARCHAR(10) DEFAULT'Available',
priceDECIMAL(10, 2)
);
b. guests table:
(sql)
CREATETABLE guests (
guest_idINT AUTO_INCREMENT PRIMARY KEY,
first_nameVARCHAR(50),
last_nameVARCHAR(50),
contact_numberVARCHAR(15),
emailVARCHAR(50),
check_in_dateDATE,
check_out_dateDATE,
room_idINT,
FOREIGN KEY (room_id) REFERENCESrooms(room_id)
);
c. payments table:
(sql)
CREATETABLE payments (
payment_idINT AUTO_INCREMENT PRIMARY KEY,
guest_idINT,
amountDECIMAL(10, 2),
payment_dateDATE,
FOREIGN KEY (guest_id) REFERENCESguests(guest_id)
);
2. System Workflow:
The Hotel Management System will include the following main functionalities:
Check-In: Register a new guest, assign them a room, and update the room status to
"Booked".
Check-Out: Remove guest details, update the room status back to "Available", and
record payment.
Room Availability: Check whether a room is available or booked.
Payment Handling: Store the payment details and link them to the respective guest.
Basic Reports: List available rooms and guest details.
Python Code Implementation:
1. Database Connection (db_connection.py)
To establish a connection between Python and MySQL, we use
the MySQL Connector library:
(python)
importmysql.connector
frommysql.connectorimport Error
defconnect():
try:
connection = mysql.connector.connect(
host='localhost',
database='hotel_management',
user='root',
password='yourpassword'# Use your MySQL root password
)
ifconnection.is_connected():
print("Connected to MySQL database")
return connection
except Error as e:
print("Error while connecting to MySQL:", e)
returnNone
2. Hotel Management (hotel_management.py)
The Hotel Management System handles the core operations such as
check-in, check-out, and room availability management.
Check-In Function:
(Python)
importdatetime
fromdb_connectionimport connect
defcheck_in():
connection = connect()
if connection:
cursor = connection.cursor()
first_name = input("Enter First Name: ")
last_name = input("Enter Last Name: ")
contact_number = input("Enter Contact Number: ")
email = input("Enter Email: ")
room_id = int(input("Enter Room ID: "))
check_in_date = datetime.date.today()
cursor.execute("SELECT room_status FROM rooms WHERE room_id = %s",
(room_id,))
room_status = cursor.fetchone()[0]
ifroom_status == 'Available':
check_out_date = input("Enter Check-out Date (YYYY-MM-DD): ")
cursor.execute(
"INSERT INTO guests (first_name, last_name, contact_number, email,
check_in_date, check_out_date, room_id) "
"VALUES (%s, %s, %s, %s, %s, %s, %s)",
(first_name, last_name, contact_number, email,
check_in_date, check_out_date, room_id)
)
cursor.execute("UPDATE rooms SET room_status = 'Booked' WHERE room_id =
%s", (room_id,))
connection.commit()
print(f"Check-in successful! Room {room_id} is now booked.")
else:
print(f"Room{room_id} is not available.")
cursor.close()
connection.close()
Check-Out Function:
(Python)
defcheck_out():
connection = connect()
if connection:
cursor = connection.cursor()
guest_id = int(input("Enter Guest ID for Check-out: "))
cursor.execute("SELECT room_id FROM guests WHERE guest_id =
%s", (guest_id,))
room_id = cursor.fetchone()[0]
cursor.execute("DELETE FROM guests WHERE guest_id = %s",
(guest_id,))
cursor.execute("UPDATE rooms SET room_status = 'Available'
WHERE room_id = %s", (room_id,))
connection.commit()
print(f"Check-out successful! Room {room_id} is now
available.")
cursor.close()
connection.close()
3. Main Program:
(Python)
defmain():
whileTrue:
print("\nHotel Management System")
print("1. Check In")
print("2. Check Out")
print("3. Exit")
choice = int(input("Enter your choice: "))
if choice == 1:
check_in()
elif choice == 2:
check_out()
elif choice == 3:
print("Exiting system...")
break
else:
print("Invalid choice. Please try again.")
if __name__ == "__main__":
main()
Results and Discussion:
Through this project, we learned how to manage hotel
operations through automation using Python and MySQL. The
system significantly reduces manual effort by handling check-
ins, check-outs, and room assignments efficiently.
1. Automation:
The system eliminates the need for manual room
management and guest record-keeping, ensuring that hotel
staff can focus on higher-level tasks.
2. Data Integrity:
Storing all guest and room details in MySQL ensures that
data is not lost and can be easily retrieved or updated.
3. Real-Time Updates:
When a room is booked or a guest checks out, the system
immediately reflects changes in the room status and guest
records.
Conclusion:
This investigatory project demonstrates the
effective integration of Python and MySQL to
develop a functional Hotel Management
System. It automates basic hotel operations
such as check-in and check-out, managing
guest details, and tracking room availability.
The project illustrates the importance of
database management in real-world
applications and showcases how
programming languages like Python can
simplify complex tasks in the hospitality
industry.
BIBILOGRAPHY
www.google.com
www.wikipedia.com
www.yahoo.com
SumitaArrora – computer science XII