Computer Science: Submitted By: Name
Computer Science: Submitted By: Name
SCIENCE
SUBMITTED BY:
NAME: AFHAAM MOHAMMED
ASHPAQ
CLASS: 12-C
Academic Year: 2024-2025
1
CERTIFICATE
Date :
ACKNOWLEDGEMENTS
2
I would firstly like to express my sincere thanks. and
gratitude to my Computer Science teacher, Mr. Yadav
Singh, who provided me with the opportunity to work
on this wonderful project on the topic, ‘HOTEL
MANAGEMENT SYSTEM’, which has helped me in the
process of researching and understanding new
concepts. Secondly, I would also like to thank my
parents. and friends who have helped me in finishing
this project within the given limited time
Last but not the least, I would like to thank those who
have contributed directly or indirectly. towards the
completion of this project.
3
INDEX
SN.NO CONTENTS PG.NO
1 Python Characteristics 5-8
3 Project Description 13
4 Aim/Objectives 14
5 Technical Documentation 15
7 Algorithm/Pseudocode 18-19
8 Flowchart 20-21
13 Bibliography 34
4
INTRODUCTION TO PYTHON
5
HISTORY OF PYTHON
6
FEATURES OF PYTHON
- Easy to Code:
Python is a high-level programming language. Python is extremely easy to learn the language as compared
to other languages like C, C#, JavaScript, Java, etc. It is very easy to code in python language and anybody
can learn python basics in a few hours or days. It is also a developer-friendly language.
- Extensible Language:
Python is an extensible language. We can write a Python code into C or C++ language and we can also compile that
cod in C/C++ language.
- Portable Language:
Python is also a portable language. For example, if we have python code for Windows and if we want to run this
code on other platforms such as Linux, Unix, and Mac then we do not need to change it, we can run this code on any
platform.
-Large Standard Library:
Python has a large standard library which provides a 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.
7
ADVANTAGES OF PYTHON
- Free and Open Source: Python comes under the OSI approved open-source
license. This makes it free to use and distribute.
You can download the source code, modify it and even distribute your version of
Python. This is useful for organizations that want to modify some specific behavior
and use their version for development.
- Dynamically Typed: Python does not know the type of variable until we run the
code. It automatically assigns the data type during execution.
The programmer doesn’t need to worry about declaring variables and their data
types.
- Portability: In many languages like C/C++, you need to change your code to run
the program on different platforms.
That is not the same with Python. You only write once and run it anywhere.
8
INTRODUCTION TO MYSQL
9
HISTORY OF MySQL
- Origin and Development of MySQL: MySQL is one of the most widely used open-
source relational database management systems in the world. With a total distribution
amounting to more than 100 million worldwide, the software has become the first choice
of large data management corporations spanning over a wide range of internet
technologies. Unireg, which is the code base of MySQL, was started in 1981. MySQL was
founded in 1995 in Sweden. In 2000, MySQL went open source, so it could be accessed and
used by all. In the year 2001, Marten Mickos was elected as the CEO of MySQL. In the year
2002, MySQL launched its headquarters in USA, in addition to Sweden headquarters. In
2003, MySQL entered into a partnership with SAP, and many features were developed in
MySQL keeping SAP in mind. In 2005, MySQL launched MySQL Network. Oracle purchased
Innobase, which is the backend of MySQL's InnoDB storage. In 2008, MySQL was acquired
by Sun Microsystems and later in 2009, Sun Microsystems and Oracle entered into a
definitive agreement under which Oracle acquired Sun Microsystems.
- Different Versions of MySQL: The first version of MySQL released in 1995, has since
developed from the initial version of MySQL 3.19 in 1996, to the most recent version of
MySQL 8.0 which was released in the April 2018, with a total of 12 other versions being
released over the years with different variations for Windows, Mac, Linux and others being
released alongside. MySQL 8.0 included changes such as the NoSQL Document Store,
atomic and crash safe DDL sentences and JSON extend
10
FEATURED OF MYSQL
MySQL stores data efficiently in the memory ensuring that data is consistent, and not
redundant. Hence, data access and manipulation using MySQL is quick.
- Scalable:
Scalability refers to the ability of systems to work easily with insignificant amounts of
data, large amounts of data, clusters of machines, and so on. MySQL server was
developed to work with large databases.
- Data Types:
It contains multiple data types such as unsigned integers, signed integers, float
(FLOAT), double (DOUBLE), character (CHAR), variable character (VARCHAR), text,
blob, date, time, datetime, timestamp, year, and so on.
- Character Sets:
It supports different character sets, and this includes latin1 (cp1252 character
encoding), German, Ujis, other Unicode character sets and so on.
- Secure:
It provides a secure interface since it has a password system which is flexible, and
ensures that it is verified based on the host before accessing the database. The
password is encrypted while connecting to the server.
It comes with support for large databases, which could contain about 40 to 50
million records, 150,000 to 200,000 tables and up to 5,000,000,000 rows.
11
ADVANTAGES OF MySQL
- Data Protection:
It is one of the most popular database management systems in terms of security and
dependability. For transactional processing, data support and security might be beneficial
to your organization.
- Scalability on Demand:
This platform’s incredible scalability can help with the management of embedded. The
benefit of this open-source platform is that it allows for complete customization, which is
very useful if you have an eCommerce store to manage.
- High Efficiency:
My SQL includes a unique storage engine that makes it easier to administer your system. -
24/7 Uptime: The MySQL system is unique in that it assures continuous uptime.
You may save a lot of money if you convert your existing database programs to this
platform. The simplicity of management and dependability might aid in troubleshooting. As
a result, you will not experience any downtime or performance difficulties.
12
PROJECT DESCRIPTION
The Hotel Management System is a software solution designed to enhance the efficiency of
hotel operations using Python and MySQL. Its primary goal is to streamline the
management of customer information, room availability, and booking processes, ensuring
smooth and organized administrative tasks and improving overall customer satisfaction.This
system allows hotel administrators to easily add new customers by capturing essential
details such as name, email, and phone number, which are then stored in a MySQL
database. This organized storage ensures that customer information is readily accessible for
future reference and communication.Room management is simplified by enabling real-time
checks on room availability. Administrators can query the database to retrieve a list of
available rooms, ensuring accurate information regarding accommodations and optimizing
room occupancy.
The booking management feature allows administrators to book rooms for customers by
entering details such as customer ID, room ID, check-in date, and check-out date. The
system then updates the room's availability status, preventing double-booking and
maintaining accurate room inventory. This automated process reduces human error and
enhances the reliability of the booking system.The technical foundation of the Hotel
Management System includes Python for application development and MySQL for database
management, with the MySQL Connector for Python facilitating efficient communication
between the application and the database. The system's modular design promotes code
organization and maintainability, with dedicated functions for adding customers, checking
room availability, booking rooms, and updating room statuses.
In summary, the Hotel Management System offers a comprehensive and reliable solution
for managing hotel operations. It simplifies customer management, improves room
availability tracking, and ensures efficient booking processes. The system's robust
functionality and scalable design make it a valuable tool for hotel administrators,
contributing to enhanced operational efficiency and customer satisfaction. Future
enhancements could include user authentication, enhanced reporting, a graphical user
interface, and online booking integration to further extend the system's capabilities.
13
AIM/OBJECTIVES
Aims:
Objectives:
1. Customer Management:
- Allow easy addition and storage of customer details.
2. Room Management:
- Enable real-time checking of room availability.
- Maintain accurate room inventory.
3. Booking Management:
- Facilitate efficient room booking for customers.
- Prevent double-booking through automated updates.
4. System Efficiency:
- Utilize Python and MySQL for robust and scalable system
performance.
- Ensure maintainability through a modular system design.
14
TECHNICAL DOCUMENTATION
Software Requirements:
1. Operating System:
- Windows 10 or higher
- macOS 10.15 or higher
- Linux (any modern distribution)
2. Programming Language:
- Python 3.6 or higher
3. Database:
- MySQL 5.7 or higher
4. Python Libraries:
- MySQL Connector for Python (`mysql-connector-python`): Install using `pip
install mysql-connector-python`
Hardware Requirements:
1. Processor:
- Intel i3 or higher
- AMD Ryzen 3 or higher
2. RAM:
- Minimum 4GB (8GB recommended for better performance)
3. Storage:
- Minimum 20GB of free disk space for software installation and data storage
15
USER DOCUMENTATION
This Hotel Management System can be used by anyone looking to streamline hotel
operations. The user must first download Python and paste the source code of the system
into a Python script. A Python IDE or interpreter, such as Python IDLE, is required to run the
code since the entire system is written in the Python programming language. Additionally,
the user must have MySQL downloaded and installed, as the database is managed through
Python-SQL connectivity.
The Hotel Management System integrates Python and SQL to manage hotel operations
effectively. Initially, a MySQL database is set up with relevant tables containing details
about customers, rooms, and bookings. The Python code provides the user with access to
the database, allowing for modifications, updates, and general management tasks.
Once the user pastes the code into Python and runs the script, a menu-driven program with
a list of options will appear. This menu-driven interface allows the user to choose from
various actions related to hotel management. The available options are as follows:
- Add Customer
- Check Room Availability
- Book Room
- Update Room Availability
- Exit
Upon presenting the list of options, the system will request an input from the user. Each
operation is assigned a number, and based on the number input by the user, the code will
proceed accordingly.
1. Add Customer
16
If the user selects the option to add a customer, the system will prompt for details such as
name, email, and phone number. These details will be added to the `Customers` table in
the MySQL database, and a confirmation message will be displayed.
3. Book Room
If the user selects the option to book a room, the system will prompt for the customer ID,
room ID, check-in date, and check-out date. These details will be used to create a booking
in the `Bookings` table, and the room's availability status will be updated to `FALSE`. A
confirmation message will be displayed.
5. Exit
If the user selects the option to exit, the program will terminate, and no further actions will
be taken until the user runs the program again.
ALGORITHM
17
PSEUDOCODE: -
FUNCTION InitializeSystem()
CONNECT to MySQL database
END FUNCTION
FUNCTION AddCustomer(name, email, phone)
CONNECT to database
SQL_QUERY = "INSERT INTO Customers (name, email, phone) VALUES
(name, email, phone)"
EXECUTE SQL_QUERY
COMMIT transaction
CLOSE database connection
RETURN "Customer added successfully"
END FUNCTION
FUNCTION CheckRoomAvailability()
CONNECT to database
SQL_QUERY = "SELECT * FROM Rooms WHERE availability = TRUE"
EXECUTE SQL_QUERY
rooms = FETCH_ALL results
CLOSE database connection
RETURN rooms
END FUNCTION
FUNCTION BookRoom(customer_id, room_id, check_in_date, check_out_date)
CONNECT to database
SQL_QUERY = "INSERT INTO Bookings (customer_id, room_id,
check_in_date, check_out_date) VALUES (customer_id, room_id,
check_in_date, check_out_date)"
EXECUTE SQL_QUERY
CALL UpdateRoomAvailability(room_id, FALSE)
COMMIT transaction
CLOSE database connection
18
RETURN "Room booked successfully"
END FUNCTION
FUNCTION UpdateRoomAvailability(room_id, availability)
CONNECT to database
SQL_QUERY = "UPDATE Rooms SET availability = availability WHERE
room_id = room_id"
EXECUTE SQL_QUERY
COMMIT transaction
CLOSE database connection
RETURN "Room availability updated successfully"
END FUNCTION
FUNCTION Main()
CALL InitializeSystem()
CALL AddCustomer('John Doe', '[email protected]', '1234567890')
available_rooms = CALL CheckRoomAvailability()
PRINT "Available Rooms: ", available_rooms
CALL BookRoom(1, 1, '2024-08-01', '2024-08-05')
END FUNCTION
FLOWCHART
19
START
GG
ESTABLISH MYSQL
CONNECTION
SHOW MENU
INPUT VALUE
FROM USER
IF MENU CHOICE
IS
20
DISPLAY CONFIRMATION RETURN TO
UPDATE ROOM STATUS
MESSAGE MENU
EXIT
END
PROGRAM CODE
Step 1: Setting Up the MySQL Database
CREATE DATABASE HotelManagement;
USE HotelManagement;
21
customer_id INT AUTO_INCREMENT PRIMARY KEY,
name VARCHAR(100),
email VARCHAR(100),
phone VARCHAR(15) );
22
Step 2: Connecting Python to MySQL
pip install mysql-connector-python
def create_connection():
try:
connection = mysql.connector.connect(
host='localhost',
user='your_username',
password='your_password',
database='HotelManagement'
)
return connection
except mysql.connector.Error as err:
if err.errno == errorcode.ER_ACCESS_DENIED_ERROR:
print("Something is wrong with your user name or
password")
elif err.errno == errorcode.ER_BAD_DB_ERROR:
print("Database does not exist")
else:
print(err)
return None
def main():
# Adding a new customer
add_customer('John Doe', '[email protected]', '1234567890')
rooms = check_room_availability()
print("Available Rooms:")
for room in rooms:
print(f"Room ID: {room[0]}, Room Number: {room[1]},
Room Type: {room[2]}")
book_room(1, 1, '2024-08-01', '2024-08-05')
if __name__ == "__main__":
main()
25
SAMPLE OUTPUTS
26
4. Update Room Availability
5. Exit
--------------------------------------
Enter your choice: 2
Available Rooms:
Room ID: 101, Room Type: Single, Price:
$100
Room ID: 102, Room Type: Double, Price:
$150
Room ID: 103, Room Type: Suite, Price:
$200
--------------------------------------
1. Add Customer
2. Check Room Availability
3. Book Room
4. Update Room Availability
5. Exit
--------------------------------------
Enter your choice: 3
29
FUNCTIONS USED
connect_db()
add_customer()
Prompts the user for customer details and inserts them into the Customers table.
check_room_availability()
Queries the Rooms table for available rooms and displays them.
book_room()
Prompts the user for booking details and inserts them into the Bookings table, updating the room's
availability status.
update_room_availability()
Prompts the user for a room ID and new availability status, and updates the room's status in the
Rooms table.
display_menu()
Displays the main menu with available options for the user.
main()
The main function that initializes the system, displays the menu, and processes user input
30
ADVANTAGES OF THE CODE
There are various advantages of an Hotel management system, which are listed
below:
1. Streamlined Operations:
- The system centralizes various hotel management tasks, such as customer
registration, room booking, and availability updates, making operations more
efficient and less prone to human error.
6. Increased Efficiency:
31
- The menu-driven interface allows users to quickly navigate through different
functions, reducing the time taken to perform tasks.
7. Scalability:
- The system can be easily scaled to accommodate more rooms, customers,
and additional functionalities as the hotel grows.
8. Security:
- With proper access controls, sensitive data can be protected, ensuring that
only authorized personnel can perform certain actions, such as updating room
availability or deleting records.
10. Cost-Effective:
- By reducing the need for manual record-keeping and minimizing errors, the
system can help save costs associated with labor and potential overbooking or
underbooking scenarios.
32
LIMITATIONS & SUGGESTIONS FOR
IMPROVEMENT
33
BIBLIOGRAPHY
3. GeeksforGeeks:
- "How to Connect Python with MySQL Database." GeeksforGeeks. Available at:
https://www.geeksforgeeks.org/how-to-connect-python-with-mysql-database/
4. Real Python:
- "Connecting to MySQL Databases with Python’s MySQL Connector." Real Python.
Available at: https://realpython.com/python-mysql/
5. W3Schools:
- "SQL Tutorial." W3Schools. Available at: https://www.w3schools.com/sql/
6. Stack Overflow:
- Various threads and discussions on Python and MySQL connectivity and best practices
for database management. Available at: https://stackoverflow.com/
7. Kroenke, David M:
- "Database Processing: Fundamentals, Design, and Implementation." Pearson Education,
2019.
34
THANK YOU
35