SYNOPSIS

You might also like

Download as docx, pdf, or txt
Download as docx, pdf, or txt
You are on page 1of 29

SYNOPSIS

 The following code is a Hotel Management


System which is used for booking and managing
hotel rooms.

- The code provides a menu of different


operations that can be performed on the hotel
rooms. The user has to enter a choice i.e. 1 to 12.
Each choice is associated with a certain action.

- The code first defines three dictionaries -


hotel_stays, hotel_rates and hotel_charges.

 The hotel_stays dictionary stores the details of


the guests such as their name, address, phone
number, check-in date and check-out date.

 The hotel_rates dictionary stores the rates of the


rooms.
 The hotel_charges dictionary stores the
additional charges that the guests may have to
pay.

- The first choice is to book a room.

The user is asked to enter the room number and


other details such as the name, address and
phone number of the guest.
The check-in and check-out dates of the guest
are also stored in the hotel_stays dictionary.
The room number and the rate of the room are
stored in the hotel_rates dictionary.
The additional charge for the room is set to 0
and stored in the hotel_charges dictionary.

- The second choice is to check out a room.

The user is asked to enter the room number.


The details of the guest and the additional
charge for the room are removed from the
hotel_stays and hotel_charges dictionaries
respectively.
- The third choice is to display all the rooms
and their rates.

This is done by looping through the hotel_rates


dictionary and printing out the room number
and rate for each room.

- The fourth choice is to display the occupied


rooms.

This is done by looping through the hotel_stays


dictionary and printing out the room number
and details for each room.

- The fifth choice is to display the empty


rooms.

This is done by looping through the hotel_rates


dictionary and printing out the room number
and rate for each room that is not in the
hotel_stays dictionary.
- The sixth choice is to display the
information of a particular room.

The user is asked to enter the room number.


The details of the guest and the rate of the room
are printed out from the hotel_stays and
hotel_rates dictionaries respectively.
The additional charge for the room is printed out
from the hotel_charges dictionary.

- The seventh choice is to delete the


information of a particular room.

The user is asked to enter the room number.


The room number and rate are removed from
the hotel_rates dictionary.

- The eighth choice is to update the rate of a


particular room.

The user is asked to enter the room number and


the new rate.
The new rate is stored in the hotel_rates
dictionary.
- The ninth choice is to add an additional
charge for a particular room.

The user is asked to enter the room number and


the additional charge.
The additional charge is added to the
hotel_charges dictionary.

- The tenth choice is to generate a bill for a


particular room.

The user is asked to enter the room number.


The rate and additional charge for the room are
printed out from the hotel_rates and
hotel_charges dictionaries respectively.
The total bill is calculated by adding the rate
and the additional charge for the room.

- The eleventh choice is to display the total


revenue.
The total revenue is calculated by looping
through the hotel_rates dictionary and adding
the rate and additional charge for each room
that is in the hotel_stays dictionary.

-
PROJECT CODE
hotel_stays = {}
hotel_rates = {}
hotel_charges = {}

while True:
print("Hotel Management System")
print("1. Book a room")
print("2. Check out")
print("3. Display all rooms")
print("4. Display occupied rooms")
print("5. Display empty rooms")
print("6. Display room information")
print("7. Delete room information")
print("7. Update rate")
print("8. Update stay")
print("9. Add additional charge")
print("10. Generate bill")
print("11. Display total revenue")
print("12. Quit")
choice = int(input("Enter your choice: "))

if choice == 1:
room_number = int(input("Enter room
number: "))
if room_number in hotel_rates:
name = input("Enter name: ")
address = input("Enter address: ")
phone = input("Enter phone no.: ")
check_in_date = input("Enter check-in
date: ")
check_out_date = input("Enter check-
out date: ")
hotel_stays[room_number] = [name,
address, phone, check_in_date, check_out_date]
hotel_charges[room_number] = 0
print("Room booked successfully!")
else:
print("Room number not valid!")

elif choice == 2:
room_number = int(input("Enter room
number: "))
if room_number in hotel_stays:
hotel_stays.pop(room_number, None)
hotel_charges.pop(room_number, None)
print("Room checked out successfully!")
else:
print("Room number not valid!")

elif choice == 3:
if hotel_rates:
for room_number, rate in
hotel_rates.items():
print("Room number:
{room_number}, rate: {rate}")
else:
print("No rooms available!")

elif choice == 4:
if hotel_stays:
for room_number, details in
hotel_stays.items():
print("Room number:
{room_number}, details: {details}")
else:
print("No rooms occupied!")

elif choice == 5:
if hotel_rates:
for room_number, rate in
hotel_rates.items():
if room_number not in hotel_stays:
print("Room number:
{room_number}, rate: {rate}")
else:
print("No empty rooms!")

elif choice == 6:
room_number = int(input("Enter room
number: "))
if room_number in hotel_stays:
details = hotel_stays[room_number]
rate = hotel_rates[room_number]
charge = hotel_charges[room_number]
print("Room number:
{room_number}")
print("Details: {details}")
print("Rate: {rate}")
print("Additional charge: {charge}")
else:
print("Room number not valid!")
elif choice == 7:
room_number = int(input("Enter room
number: "))
if room_number in hotel_rates:
hotel_rates.pop(room_number, None)
print("Room information deleted
successfully!")
else:
print("Room number not valid!")

elif choice == 8:
room_number = int(input("Enter room
number: "))
if room_number in hotel_rates:
new_rate = int(input("Enter new rate:
"))
hotel_rates[room_number] = new_rate
print("Room rate updated
successfully!")
else:
print("Room number not valid!")
elif choice == 9:
room_number = int(input("Enter room
number: "))
if room_number in hotel_stays:
charge = int(input("Enter additional
charge: "))
hotel_charges[room_number] += charge
print("Additional charge added
successfully!")
else:
print("Room number not valid!")

elif choice == 10:


room_number = int(input("Enter room
number: "))
if room_number in hotel_stays:
rate = hotel_rates[room_number]
charge = hotel_charges[room_number]
total = rate + charge
print("Total bill: {total}")
else:
print("Room number not valid!")

elif choice == 11:


total_revenue = 0
flag = False
for room_number, rate in
hotel_rates.items():
if room_number in hotel_stays:
total_revenue += rate +
hotel_charges[room_number]
flag = True
if flag:
print(f"Total revenue: {total_revenue}")

if choice == 12:
print("Quitting...")
break
- The twelfth choice is to quit the program.

This code is an example of a simple hotel


management system. It provides basic functionalities
such as booking a room, checking out a room,
displaying room information and generating bills.
This code can be extended to provide more features
such as customer loyalty programs, discounts, room
upgrades and more.

…………………………………………………………
………..
OUTPUTS
OUTPUT 1-
Hotel Management System
1. Book a room
2. Check out
3. Display all rooms
4. Display occupied rooms
5. Display empty rooms
6. Display room information
7. Delete room information
7. Update rate
8. Update stay
9. Add additional charge
10. Generate bill
11. Display total revenue
12. Quit
Enter your choice: 1
Enter room number: 101
Enter name: John
Enter address: 123 Main Street
Enter phone no.: 555-123-4567
Enter check-in date: 01/01/2021
Enter check-out date: 01/02/2021
Room booked successfully!

OUTPUT 2-
Hotel Management System
1. Book a room
2. Check out
3. Display all rooms
4. Display occupied rooms
5. Display empty rooms
6. Display room information
7. Delete room information
7. Update rate
8. Update stay
9. Add additional charge
10. Generate bill
11. Display total revenue
12. Quit
Enter your choice: 3
Room number: 101, rate: 0
Room number: 102, rate: 0
Room number: 103, rate: 0

OUTPUT 3-
Hotel Management System
1. Book a room
2. Check out
3. Display all rooms
4. Display occupied rooms
5. Display empty rooms
6. Display room information
7. Delete room information
7. Update rate
8. Update stay
9. Add additional charge
10. Generate bill
11. Display total revenue
12. Quit
Enter your choice: 4
Room number: 101, details: ['John', '123 Main
Street', '555-123-4567', '01/01/2021', '01/02/2021']

OUTPUT 4-
Hotel Management System
1. Book a room
2. Check out
3. Display all rooms
4. Display occupied rooms
5. Display empty rooms
6. Display room information
7. Delete room information
7. Update rate
8. Update stay
9. Add additional charge
10. Generate bill
11. Display total revenue
12. Quit
Enter your choice: 5
Room number: 102, rate: 0
Room number: 103, rate: 0

OUTPUT 5-
Hotel Management System
1. Book a room
2. Check out
3. Display all rooms
4. Display occupied rooms
5. Display empty rooms
6. Display room information
7. Delete room information
7. Update rate
8. Update stay
9. Add additional charge
10. Generate bill
11. Display total revenue
12. Quit
Enter your choice: 6
Enter room number: 101
Room number: 101
Details: ['John', '123 Main Street', '555-123-4567',
'01/01/2021', '01/02/2021']
Rate: 0
Additional charge: 0

OUTPUT 6-
Hotel Management System
1. Book a room
2. Check out
3. Display all rooms
4. Display occupied rooms
5. Display empty rooms
6. Display room information
7. Delete room information
7. Update rate
8. Update stay
9. Add additional charge
10. Generate bill
11. Display total revenue
12. Quit
Enter your choice: 7
Enter room number: 102
Room information deleted successfully!

OUTPUT 7-
Hotel Management System
1. Book a room
2. Check out
3. Display all rooms
4. Display occupied rooms
5. Display empty rooms
6. Display room information
7. Delete room information
7. Update rate
8. Update stay
9. Add additional charge
10. Generate bill
11. Display total revenue
12. Quit
Enter your choice: 8
Enter room number: 101
Enter new rate: 250
Room rate updated successfully!

OUTPUT 8-
Hotel Management System
1. Book a room
2. Check out
3. Display all rooms
4. Display occupied rooms
5. Display empty rooms
6. Display room information
7. Delete room information
7. Update rate
8. Update stay
9. Add additional charge
10. Generate bill
11. Display total revenue
12. Quit
Enter your choice: 9
Enter room number: 101
Enter additional charge: 25
Additional charge added successfully!
OUTPUT 9-
Hotel Management System
1. Book a room
2. Check out
3. Display all rooms
4. Display occupied rooms
5. Display empty rooms
6. Display room information
7. Delete room information
7. Update rate
8. Update stay
9. Add additional charge
10. Generate bill
11. Display total revenue
12. Quit
Enter your choice: 10
Enter room number: 101
Total bill: 275
OUTPUT 10-
Hotel Management System
1. Book a room
2. Check out
3. Display all rooms
4. Display occupied rooms
5. Display empty rooms
6. Display room information
7. Delete room information
7. Update rate
8. Update stay
9. Add additional charge
10. Generate bill
11. Display total revenue
12. Quit
Enter your choice: 11
Total revenue: 275

Hotel Management System


1. Book a room
2. Check out
3. Display all rooms
4. Display occupied rooms
5. Display empty rooms
6. Display room information
7. Delete room information
7. Update rate
8. Update stay
9. Add additional charge
10. Generate bill
11. Display total revenue
12. Quit
Enter your choice: 12
Quitting...
COMPUTER
PROJECT

HOTEL MANAGEMENT SYSTEM

- Mohammad Raiyaan Zakaria


- XI (Science)-A

You might also like