Computer Science Project
Computer Science Project
PRIYANSHU PRASAD
Hardware & Software Requirement
#Software Specifications:
Operating System: - Windows 10 or up
Platform: - Python IDLE 3.12 64 bit
Database: - MySQL
Language: - Python
#Hardware Specifications:
Processor: - Intel i5 10th Generation
Hard Disk: - 512 GB
RAM: - 20gb
Content:
2 Acknowledge
3 Hardware &
Software
Requirement
4 Content
5 Introduction
9 Source code
11 Outputs
12 Mysql outputs
13 References
Introduction
In today’s fast-paced world, the hospitality
industry is increasingly relying on technology to
enhance customer experience and streamline
operations. The Hotel Booking Management
System is a comprehensive solution designed to
automate and simplify the process of booking
hotel rooms. This system aims to provide a
seamless experience for both hotel administrators
and guests by integrating various functionalities
such as room availability checks, booking
confirmations, and payment processing.
The primary objective of this project is to develop
a user-friendly, web-based application that allows
hotel managers to efficiently manage room
reservations, track occupancy rates, and handle
customer inquiries. Guests can easily browse
available rooms, make reservations, and receive
instant confirmations, all from the comfort of their
homes. By leveraging modern web technologies,
this system ensures real-time updates and secure
transactions, thereby enhancing the overall
efficiency and reliability of hotel operations.
This project not only aims to improve the booking
process but also to provide valuable insights
through data analytics, helping hotel management
make informed decisions. With features like
automated reminders, feedback collection, and
personalized services, the Hotel Booking
Management System is poised to revolutionize the
way hotels operate, ensuring a superior
experience for guests and a streamlined workflow
for staff.
Problem Definition for Hotel Reservation System
Hotels require efficient reservation systems to manage guest
bookings, room availability, and customer information.
Traditional manual booking processes are often time-
consuming, prone to errors, and inconvenient for both hotel
staff and customers.
Problem Statement
Develop a comprehensive hotel reservation system that
automates and streamlines the process of booking rooms,
registering users, managing room availability, and viewing
reservations.
Key Functionalities
User Registration and Login:
Room Management:
Add Room: Admins can add new rooms with specific details
like room number, type, and price.
View Available Rooms: Users can view the list of rooms that
are available for booking.
Booking System:
Reservation Management:
Problems Identified
Indentation Errors: Some parts of the code have improper
indentation, which can cause syntax errors and unexpected
behavior.
Proposed Solutions
Fix Indentation: Ensure all functions and control structures
have proper indentation to avoid syntax errors.
Step 8: Exit
Exit the Program: Choose the “Exit” option to safely
terminate the program.
Source Code:
#database connection
import mysql.connector
def create_connection():
return mysql.connector.connect(
host="localhost",
user="root",
password="123456789",
database="hotel_reservation"
)
#user registration and login
def register_user(username, password, email):
conn = create_connection()
cursor = conn.cursor()
cursor.execute("INSERT INTO users (username, password, email)
VALUES (%s, %s, %s)", (username, password, email))
conn.commit()
cursor.close()
conn.close()
def login_user(username, password):
conn = create_connection()
cursor = conn.cursor()
cursor.execute("SELECT * FROM users WHERE username = %s AND
password = %s", (username, password))
user = cursor.fetchone()
cursor.close()
conn.close()
return user
#Room management
def add_room(room_number, room_type, price):
conn = create_connection()
cursor = conn.cursor()
cursor.execute("INSERT INTO rooms (room_number, room_type,
price) VALUES (%s, %s, %s)", (room_number, room_type, price))
conn.commit()
cursor.close()
conn.close()
def view_rooms():
conn = create_connection()
cursor = conn.cursor()
cursor.execute("SELECT * FROM rooms WHERE availability = TRUE")
rooms = cursor.fetchall()
cursor.close()
conn.close()
return rooms
#booking a room
def book_room(user_id, room_id, check_in, check_out):
conn = create_connection()
cursor = conn.cursor()
cursor.execute("INSERT INTO reservations (user_id, room_id,
check_in, check_out) VALUES (%s, %s, %s, %s)", (user_id, room_id,
check_in, check_out))
cursor.execute("UPDATE rooms SET availability = FALSE WHERE
room_id = %s", (room_id,))
conn.commit()
cursor.close()
conn.close()
#viewing reservations
def view_reservations(user_id):
conn = create_connection()
cursor = conn.cursor()
cursor.execute("SELECT * FROM reservations WHERE user_id =
%s", (user_id,))
reservations = cursor.fetchall()
cursor.close()
conn.close()
return reservations
#Main program
def main():
while True:
print("1. Register")
print("2. Login")
print("3. View Rooms")
print("4. Book Room")
print("5. View Reservations")
print("6. Exit")
choice = input("Enter choice: ")
if choice == '1':
username = input("Enter username: ")
password = input("Enter password: ")
email = input("Enter email: ")
register_user(username, password, email)
print("User registered successfully!")
if __name__ == "__main__":
main()
note * (we have to create a database and structure tables in sql in order to use it in python)
Creating a table in sql:
USE hotel_reservation;
OUTPUTS:
#main program
Output:
View rooms:
Mysql outputs:
Reference
Computer Science with Python Class XI by
Sumita Arora
Computer Science with Python Textbook for Class 11 : Sumita Arora: Amazon.in:
Books
Computer Science with Python Class XII by
Sumita Arora
Progress In Computer Science With Python... by Sumita Arora (amazon.in)
Python IDLE
Download Python | Python.org
MySQL
MySQL :: MySQL Downloads