Computer Science Project
Computer Science Project
HOTEL MANAGEMENT
A Project Report
Submitted by
Shinjini Koshti
12 A
At
Jabalpur, MP
CERTIFICATE
Shinjini Koshti
12th A
CONTENTS
1.Introduction
2. Key Features
3. Python Codes
4. Output
5. MYSQL tables
6. Bibliography
INTRODUCTION
1. Guest Management
It involves handling guest reservations, check-ins, check-outs,
and billing for smooth operations and improved guest
experience.
2.Room management
It involves organising and maintaining a space to ensure it is
functional, comfortable, and conducive to its intended purpose.
3. Reservation management
Process of organising and tracking bookings to ensure smooth
scheduling and customer communication.
5. Feedback
Leave reviews and ratings after their stay, which the hotel can
use to improve its services and address customer concerns
import sqlite3
def create_db():
conn = sqlite3.connect('hotel_management.db')
cursor = conn.cursor()
cursor.execute('''
CREATE TABLE IF NOT EXISTS Rooms (
room_id INTEGER PRIMARY KEY AUTOINCREMENT,
room_number INTEGER UNIQUE,
room_type TEXT,
price REAL,
status TEXT -- 'Available', 'Occupied', 'Under Maintenance'
)''')
cursor.execute('''
CREATE TABLE IF NOT EXISTS Reservations (
reservation_id INTEGER PRIMARY KEY AUTOINCREMENT,
guest_id INTEGER,
room_id INTEGER,
check_in_date TEXT,
check_out_date TEXT,
status TEXT, -- 'Confirmed', 'Checked-In', 'Checked-Out'
FOREIGN KEY (guest_id) REFERENCES Guests (guest_id),
FOREIGN KEY (room_id) REFERENCES Rooms (room_id)
)''')
cursor.execute('''
CREATE TABLE IF NOT EXISTS Billing (
bill_id INTEGER PRIMARY KEY AUTOINCREMENT,
reservation_id INTEGER,
amount REAL,
payment_status TEXT, -- 'Paid', 'Pending'
FOREIGN KEY (reservation_id) REFERENCES Reservations
(reservation_id)
)''')
cursor.execute('''
CREATE TABLE IF NOT EXISTS Inventory (
item_id INTEGER PRIMARY KEY AUTOINCREMENT,
item_name TEXT,
quantity INTEGER,
price REAL
)''')
cursor.execute('''
CREATE TABLE IF NOT EXISTS Housekeeping (
room_id INTEGER,
status TEXT, -- 'Clean', 'Dirty', 'Under Maintenance'
FOREIGN KEY (room_id) REFERENCES Rooms (room_id)
)''')
cursor.execute('''
CREATE TABLE IF NOT EXISTS Reports (
report_id INTEGER PRIMARY KEY AUTOINCREMENT,
report_type TEXT,
report_date TEXT,
content TEXT
)''')
cursor.execute('''
CREATE TABLE IF NOT EXISTS Feedback (
feedback_id INTEGER PRIMARY KEY AUTOINCREMENT,
guest_id INTEGER,
feedback_text TEXT,
FOREIGN KEY (guest_id) REFERENCES Guests (guest_id)
)''')
cursor.execute('''
CREATE TABLE IF NOT EXISTS Users (
user_id INTEGER PRIMARY KEY AUTOINCREMENT,
username TEXT,
password TEXT,
role TEXT -- 'Admin', 'Front Desk', 'Housekeeping', 'Manager'
)''')
cursor.execute('''
CREATE TABLE IF NOT EXISTS Menu (
menu_id INTEGER PRIMARY KEY AUTOINCREMENT,
item_name TEXT,
price REAL
)''')
conn.commit()
conn.close()
2. Guest Management
Output:
class Guest:
def __init__(self, name, contact, email, address):
self.name = name
self.contact = contact
self.email = email
self.address = address
def add_guest(self):
conn = sqlite3.connect('hotel_management.db')
cursor = conn.cursor()
cursor.execute('''INSERT INTO Guests (name, contact, email, address)
VALUES (?, ?, ?, ?)''', (self.name, self.contact, self.email,
self.address))
conn.commit()
print(f"Guest {self.name} added successfully.")
conn.close()
@staticmethod
def view_guests():
conn = sqlite3.connect('hotel_management.db')
cursor = conn.cursor()
cursor.execute('''SELECT guest_id, name, contact, email FROM
Guests''')
guests = cursor.fetchall()
for guest in guests:
print(f"ID: {guest[0]}, Name: {guest[1]}, Contact: {guest[2]}, Email:
{guest[3]}")
conn.close()
3. Room Management
Output:
classRoom:
def __init__(self, room_number, room_type, price):
self.room_number = room_number
self.room_type = room_type
self.price = price
def add_room(self):
conn = sqlite3.connect('hotel_management.db')
cursor = conn.cursor()
cursor.execute('''INSERT INTO Rooms (room_number, room_type,
price, status)
VALUES (?, ?, ?, 'Available')''', (self.room_number,
self.room_type, self.price))
conn.commit()
print(f"Room {self.room_number} added successfully.")
conn.close()
@staticmethod
def view_rooms():
conn = sqlite3.connect('hotel_management.db')
cursor = conn.cursor()
cursor.execute('''SELECT room_number, room_type, price, status
FROM Rooms''')
rooms = cursor.fetchall()
conn.close()
@staticmethod
def update_room_status(room_number, status):
conn = sqlite3.connect('hotel_management.db')
cursor = conn.cursor()
cursor.execute('''UPDATE Rooms SET status = ? WHERE
room_number = ?''', (status, room_number))
conn.commit()
print(f"Room {room_number} status updated to {status}.")
conn.close()
4. Reservation Management
Output:
class Reservation:
self.guest_id = guest_id
self.room_id = room_id
self.check_in_date = check_in_date
self.check_out_date = check_out_date
self.status = 'Confirmed'
def create_reservation(self):
conn = sqlite3.connect('hotel_management.db')
cursor = conn.cursor()
conn.commit()
@staticmethod
def view_reservations():
conn = sqlite3.connect('hotel_management.db')
cursor = conn.cursor()
reservations = cursor.fetchall()
conn.close()
self.reservation_id = reservation_id
self.amount = amount
self.payment_status = 'Pending'
def generate_bill(self):
conn = sqlite3.connect('hotel_management.db')
cursor = conn.cursor()
conn.commit()
conn.close()
@staticmethod
def view_bills():
conn = sqlite3.connect('hotel_management.db')
cursor = conn.cursor()
FROM Billing b
bills = cursor.fetchall()
6. Hotel Feedback
Output:
class HotelFeedback:
def _init_(self):
self.feedbacks = []
def collect_feedback(self):
print("Feedback received!")
else:
print("Invalid rating!")
def show_feedback(self):
if not self.feedbacks:
# Example usage
hotel = HotelFeedback()
hotel.collect_feedback()
hotel.show_feedback()
7. Housekeeping Feedback
Output:
class HousekeepingFeedback:
def _init_(self):
self.feedbacks = []
def collect_feedback(self):
print("Feedback received!")
def show_feedback(self):
if not self.feedbacks:
housekeeping = HousekeepingFeedback()
housekeeping.collect_feedback()
housekeeping.show_feedback()
8. Inventory
Output:
class Inventory:
def _init_(self):
self.items = {}
def add_item(self):
def show_inventory(self):
if not self.items:
print("Inventory is empty.")
inventory = Inventory()
inventory.add_item()
inventory.add_item()
inventory.show_inventory()
9. Menu
Order:
def display_menu():
print("6. Exit")
def get_order():
order = []
total = 0
while True:
display_menu()
break
order.append(item)
total += price
else:
print(f"- {item}")
print(f"\nTotal: ₹{total}")
# Main program
print_receipt(order, total)
OUTPUTS
2. Guest Management
USAGE EXAMPLE:
EXPECTED OUTPUT:
3. Room Management
USAGE EXAMPLE:
EXPECTED OUTPUT:
4. Reservation Management
USAGE EXAMPLE:
EXPECTED OUTPUT:
5. Billing and Invoicing
USAGE EXAMPLE:
EXPECTED OUTPUT:
6. Hotel Feedback
USAGE EXAMPLE:
7. Housekeeping Feedback
USAGE EXAMPLE:
8. Inventory
USAGE EXAMPLE:
9. Menu
USAGE EXAMPLE:
MYSQL TABLES USED IN THIS
PROJECT
1. Billing
2. Users
3. Reservation
4. Rooms
5. Menu
6. Housekeeping
7. Inventory
8. Guests
9. Reports
10. Feedback
Bibliography
1. python.org
2. Code Academy
3.tutorialsPoint.com
4. PythonChallenge.com
5. Google’s Python Class
6. LearnPython.org