Dsa Postlab
Dsa Postlab
On
“ HOTEL MANAGEMENT ”
[DSA Post-Lab]
Submitted By
Sahil S.
Chaple
(CS23010)
Guided By:-
2024-2025
1
© S.B.J.I.T.M.R Nagpur 2024
2
S.B. JAIN INSTITUTE OF TECHNOLOGY MANAGEMENT AND
RESEARCH, NAGPUR
(An Autonomous Institute, Affiliated to RTMNU, Nagpur)
SESSION 2024-2025
CERTIFICATE
This is to certify that the Mini Project titled “Hotel Management” is a bonafide work of Sahil S.
Chaple carried out for the partial fulfillment of course work of “Data Structure & Algorithm Lab”, 3 rd
3
INDEX
CERTIFICATE i
INDEX ii
CHAPTER 1 INTRODUCTION 1
CHAPTER 3 TOOLS/PLATFORMS 4
4.1 ALGORITHM
4.2 FLOWCHART
5.2 DISCUSSION
5.3 APPLICATION
CHAPTER 6 CONCLUSION 12
4
LIST OF FIGURES
5
CHAPTER 1
INTRODUCTION:
The provided code is part of a C program that simulates a restaurant and lodge system, including
functionalities for booking rooms, ordering food, and managing customer details. Here’s an
introduction to the code:
This C program represents a basic management system for a restaurant and lodge. The primary
functionalities include:
1. Customer Details Management: Collects and validates customer information such as name,
email, and mobile number.
2. Menu Initialization and Display: Initializes a food menu with various categories and
items, and displays the menu to the customer.
3. Room Booking: Allows customers to book rooms and manage room-related details.
4. Food Ordering: Enables customers to order food items from the menu and calculates the
total food bill.
5. Bill Calculation and Display: Computes and displays the total bill, including room and
food charges.
7. Navigation and User Interaction: Provides a menu-driven interface for the user to interact
with various features of the system.
The program makes use of structures to manage different aspects like food items, orders, and
room bookings.
It also includes validation functions to ensure correct input formats for email and mobile numbers.
6
CHAPTER 2
METHODOLOGY
Major Libraries :
1. <stdio.h>: Standard Input/Output library. It is used for input and output functions, such as
printf and scanf, which handle user interaction.
2. <stdlib.h>: Standard library for general utilities. Functions from this library are often used
for memory allocation, process control, and conversions. In this code, it's included but not
actively used.
3. <string.h>: String handling functions. Functions like strcpy and strchr are used for
manipulating and examining strings.
4. <ctype.h>: Character handling functions. Used here to check if characters are digits.
Key Functions:
3. void initialize_menu(void)
- Purpose: Initializes the food menu with predefined items and categories.
7
- Method: Uses strcpy to set names and assign prices and categories to food items in a
global menu array.
4. void print_menu(void)
- Purpose: Displays the menu to the user.
- Method: Iterates through categories and food items, printing each item’s details in a
formatted manner.
5. void begin(void)
- Purpose: Displays the main menu and handles user choices.
- Method: Uses a switch statement to call different functions based on user input (e.g.,
booking a room, ordering food, etc.).
6. void food_items(void)
- Purpose: Manages the process of ordering food items.
- Method: Displays the menu, takes user input for item choices and quantities, and
updates the ordered_items array and person.food_bill.
7. void show_details(void)
- Purpose: Shows the details of the guest and their bills.
- Method: Prints out the guest’s name, email ID, mobile number, and various bills.
8. void complaints_suggestions(void)
- Purpose: Collects feedback from the user.
- Method: Reads a line of feedback input from the user and stores it in a feedback array.
9. void book_room(void)
- Purpose: Manages room booking.
- Method: Displays room booking options, takes user input for room type and quantity, and
updates the booking information and person.room_bill.
8
CHAPTER 3
TOOLS/PLATFORMS
Dev-C++: A lightweight IDE for C/C++ development. It includes a compiler and a debugger,
making it suitable for small to medium-sized projects.
GDB : Another popular C/C++ IDE that offers more features and is highly configurable.
Visual Studio Code: A versatile code editor with support for C/C++ through extensions.
2. Compiler:
GCC (GNU Compiler Collection): A widely-used compiler for C/C++. It can be used through
command-line interfaces or integrated into an IDE like Dev-C++ or Code::Blocks.
MinGW (Minimalist GNU for Windows): A distribution of GCC for Windows. It includes a set
of open-source programming tools.
Git: Useful for tracking changes in your code and collaborating with others. Platforms like
GitHub or GitLab can be used to host repositories.
Standard C Library: This project mainly relies on the standard C library, which is included with the
compiler.
9
Additional libraries may be needed if you plan to expand the project with features like a graphical
user interface (GUI) or database connectivity.
Operating System
Windows 10/11: Suitable for running the development environment and tools mentioned.
-Linux: Offers a great environment for C/C++ development with built-in support for GCC.
- If you plan to extend the project to include persistent storage of data, consider using a
lightweight database like SQLite.
2. Debugging Tools:
-GDB (GNU Debugger): Comes with GCC and helps debug C/C++ applications.
- Make: Automates the build process, useful for managing project dependencies and compiling
code.
4. Text Editors:
Notepad++ or Sublime Text: Lightweight text editors that can be used for editing code and
configuration file
10
CHAPTER 4
4.1 ALGORITHM
Initialization
1. Initialize Menu
- Call initialize_menu() to set up the food menu with predefined items, categories, and prices.
User Interaction
3. User Input
- Collect Personal Details: Prompt the user for their name, email, and mobile number.
- Validate email using is_valid_email().
- Validate mobile number using is_valid_mobile().
- Choose Options: Display main menu options (e.g., book a room, order food, provide
feedback).
Room Booking
4. Book Room
- If the user selects to book a room:
- Call book_room() to display room options and take input for room type and quantity.
- Update the booking information and calculate the room bill.
11
Food Ordering
5. Order Food
- If the user selects to order food:
- Call food_items() to display the food menu.
- Take input for food items and quantities.
- Update the order information and calculate the food bill.
7. Provide Feedback
- If the user selects to provide feedback:
- Call complaints_suggestions() to collect feedback.
Bill Calculation
8. Calculate Total Bill
- Call bill() to compute the total bill by summing up room and food bills.
End Program
9. Exit
- End the program after displaying the details and calculating the bill.
12
4.2 FLOWCHART:
START
Initialize Person
Details
Display Welcome
Message
Get
Person`s
Name
Validate
Email
Validate
Mobile
Number
Call begin
Function
Display Options
Get User
Choice
Handle User
Choice
Show Details Complaints Suggestions Book Room Food Items Bill Function
Function Function Function Function
13
Show Details Function ComplaintsSuggestionsFunction
START START
Exit Exit
START
Print Menu
Order Items
Exit
14
Bill Function
Start
End
Start
Get Room
Quantity
No Yes
Check Room
Availability
Book Rooms
End
include <stdio.h>
include <stdlib.h>
include <string.h>
include <ctype.h>
void begin();
void show_details();
void complaints_suggestions();
void book_room();
void food_items(void);
void initialize_menu(void);
void print_menu(void);
void bill(void);
int is_valid_email(const char email);
int is_valid_mobile(const char mobile);
typedef struct
{
char name[50];
int price;
int category;
} FoodItem;
FoodItem menu[MAX_FOOD_ITEMS];
int total_food_items = 0;
typedef struct
{
char name[50];
int quantity;
int price;
} OrderedFoodItem;
OrderedFoodItem ordered_items[MAX_ORDER_ITEMS];
int total_order_items = 0;
typedef struct
{
int roomno;
char roomtype;
16
int price;
} RoomBooking;
RoomBooking bookings[MAX_ROOMS];
int total_bookings = 0;
typedef struct
{
char name[20];
char email_id[60];
char mobile_no[11];
int room_bill;
int food_bill;
int program_bill;
} Person;
Person person;
int main()
{
initialize_menu();
person.room_bill =
0;
person.food_bill = 0;
person.program_bill = 0;
printf(".............WELCOME TO ROYAL ARENA RESTAURANT AND
LODGE..............\n\n");
printf("Please enter your details before moving to the main page!\n");
do {
printf("Enter your email_id: ");
scanf(" %[^\n]", person.email_id);
if (!is_valid_email(person.email_id)) {
printf("!!!!!!!!!!!!!!!!!!!````Invalid email format`````!!!!!!!!!!!!!!!!!!!\nPlease enter a valid
email address.\n");
}
} while (!is_valid_email(person.email_id));
do {
printf("Enter your mobile number:
"); scanf(" %[^\n]",
person.mobile_no);
if (!is_valid_mobile(person.mobile_no)) {
17
printf("!!!!!!!!!!!!!!!!!!!````Invalid mobile number`````!!!!!!!!!!!!!!!!!!!\nPlease enter a 10-
digit mobile number.\n");
18
}
} while (!is_valid_mobile(person.mobile_no));
begin();
return 0;
}
void initialize_menu(void)
{
strcpy(menu[0].name, "French Fries");
menu[0].price = 106;
menu[0].category = 1;
strcpy(menu[21].name, "Cheese");
menu[21].price = 55;
menu[21].category = 8;
21
menu[25].category = 10;
22
strcpy(menu[37].name, "Dahi Bhalla / Dahi Papri");
menu[37].price = 90;
menu[37].category = 13;
strcpy(menu[41].name, "Tea");
menu[41].price = 40;
menu[41].category = 14;
strcpy(menu[81].name, "Rajma");
menu[81].price = 141;
menu[81].category = 18;
strcpy(menu[82].name, "Chole");
menu[82].price = 141;
menu[82].category = 18;
strcpy(menu[83].name, "Shahi Paneer");
menu[83].price = 210;
menu[83].category = 19;
26
strcpy(menu[84].name, "Kadhai Paneer");
menu[84].price = 210;
menu[84].category = 19;
strcpy(menu[90].name, "Vanilla/Strawberry");
menu[90].price = 51;
menu[90].category = 20;
strcpy(menu[92].name, "Pineapple");
menu[92].price = 60;
menu[92].category = 20;
strcpy(menu[93].name, "Chocolate");
menu[93].price = 60;
menu[93].category = 20;
strcpy(menu[97].name, "Mango");
menu[97].price = 60;
menu[97].category = 20;
total_food_items = 100;
}
void print_menu(void)
{
const char categories[MAX_CATEGORIES] =
{ "All Time Favourite",
" Sandvich",
"Salads",
"Burgers",
"Bakes & Meals (Served with 3Pcs. of Garlic Bread)",
"Choice of Pasta's (Served with 3Pcs. of Garlic Bread)",
"Pizza's",
"Extra Toppings",
"Hearth Stone Special",
"Main Course",
"Noodles",
"Rice",
"Chats",
"Tea & Coffee ",
"Smoothies & Mocktails",
"Rice / Pulao / Biryanis / Raitas",
"Dals",
"Subziyan",
28
"Dessert",
"Ice Cream"
};
printf(" \n");
}
}
void begin(void)
{
int decide;
printf("\n HOW CAN WE HELP YOU?\n\n");
printf("\n1. Hotel Details\n2. Book a room\n3. Food items\n4. Separate Bill (Food+Room)\n5.
Total Bill\n6. Feedback\n7. Check out\
n"); scanf("%d", &decide);
while (getchar() != '\n')
;
switch (decide)
{
case 1:
printf("\nAbout Us\n\nWelcome to Royal Arena Restaurant and Lodge, where luxury meets
comfort…… severalspecial.\n\n");
printf("For more information, visit our website.\n");
begin();
break;
case 2:
book_room();
break;
case 3:
food_items();
29
break;
case 4:
bill();
break;
case 5:
show_details();
break;
case 6:
complaints_suggestions();
printf("Thank you for your valuable Feedback!\n");
begin();
break;
case 7:
printf("Visit again!\n");
printf("Thank you for trusting our service.\n");
return;
default:
printf("Invalid choice. Please enter a valid number.\n");
begin();
break;
}
}
void food_items(void)
{
int choice, quantity;
while (1)
{
printf("\nEnter the item number to order (0 to finish): ");
scanf("%d", &choice);
while (getchar() != '\n')
;
if (choice == 0)
break;
if (quantity <= 0)
{
printf("Invalid quantity! Please try again.\n");
continue;
}
begin();
}
void show_details(void)
{
printf("\n DETAILS \n");
printf(" \n");
printf("| Name: | %s\n", person.name);
printf(" \n");
printf("| Email ID: | %s\n", person.email_id);
printf(" \n");
printf("| Mobile Number: | %s\n", person.mobile_no);
printf(" \n");
printf("| Room Bill: | Rs %d\n", person.room_bill);
printf(" \n");
printf("| Food Bill: | Rs %d\n", person.food_bill);
printf(" \n");
printf("| Total Bill: | Rs %d\n", person.room_bill + person.food_bill +
person.program_bill);
printf(" \n");
begin();
}
void complaints_suggestions()
{
char feedback[500];
printf("Please enter your Feedback:\n");
31
scanf(" %[^\n]", feedback);
}
void book_room()
{
int type_of_rooms, quantity;
char c;
if (type_of_rooms == 1)
{
printf("\nDo you accept this room? (y/n)\n");
scanf("%c", &c);
while (getchar() != '\n');
if (c == 'y')
{
printf("\nYou chose the basic room. Enjoy your stay\n");
bookings[total_bookings].roomno = 121 + total_bookings;
bookings[total_bookings].roomtype = "basic";
bookings[total_bookings].price = 1000;
person.room_bill += 1000;
total_bookings++;
}
else
{
printf("\nBooking Cancelled.\n");
i--;
32
}
}
else if (type_of_rooms == 2)
{
printf("\nDo you accept this room? (y/n)\n");
scanf("%c", &c);
while (getchar() != '\n');
if (c == 'y')
{
printf("\nYou chose the medium room. Enjoy your stay\n");
bookings[total_bookings].roomno = 121 + total_bookings;
bookings[total_bookings].roomtype = "medium";
bookings[total_bookings].price = 2000;
person.room_bill += 2000;
total_bookings++;
}
else
{
printf("\nBooking Cancelled.\n");
i--;
}
}
else if (type_of_rooms == 3)
{
printf("\nDo you accept this room? (y/n)\n");
scanf("%c", &c);
while (getchar() != '\n');
if (c == 'y')
{
printf("\nYou chose the deluxe room. Enjoy your stay\n");
bookings[total_bookings].roomno = 121 + total_bookings;
bookings[total_bookings].roomtype = "deluxe";
bookings[total_bookings].price = 3000;
person.room_bill += 3000;
total_bookings++;
}
else
{
printf("\nBooking Cancelled.\n");
i--;
}
}
else if (type_of_rooms == 4)
{
printf("\nBooking Cancelled.\n");
i--;
33
}
else
{
printf("\nInvalid option. Please try again.\
n"); i--;
}
}
begin();
}
void bill(void)
{
int choice;
printf("\n BILL VIEW \n");
printf("\n1. Detailed Food Bill\n2. Room Bill\n");
scanf("%d", &choice);
while (getchar() != '\n');
if (choice == 1)
{
printf("\n FOOD BILL \n");
printf(" \n");
printf("| No | Item Name | Quantity | Price |\
n"); printf(" \n");
else if (choice == 2)
{
printf("\n ROOM BILL \n");
printf(" \n");
printf("| Room No | Room Type | Price |\n");
printf(" \n");
printf(" \n");
printf("| Total Room Bill: | Rs %5d |\n",
person.room_bill); printf(" \n");
}
begin();
}
34
CHAPTER 5
RESULT & DISCUSSION
5.1 OUTPUT
The above screenshot is about the details taken from the user. Details like name , email, phone number.
35
Fig.5.1.2. Display Hotel Details
The above screenshot is about displaying the hotel details like its information , its branches , facilities
guest experience etc.
The above screenshot is about room booking it shows how many rooms available and how many types
of room are available and here you can also book the room.
36
Fig.5.1.3.2. Room Booking
The above screenshot is about room booking it shows how many rooms available and how many
types of room are available and here you can also book the room.
The above screenshot is about the lists of food items in the hotel menu . That you can order its price also
mention there and divided in different section also.
37
Fig.5.1.4.2. Display food items
The above screenshot is about the lists of food items in the hotel menu . That you can order its price
also mention there and divided in different section also .
The above screenshot is about the ordering of food . From the given menu you can order it . It asks
about food number according to menu and the quantity.
38
Fig.5.1.6. Bill For food
The above screenshot is about Bill for food that you order . It gives you the detailed bill like which
food you order , how many quantity and its price . At last total food bill .
The above screenshot is about Bill for Room that you booked . It gives you the detailed bill like which
room you booked , how many quantity and its price . At last total Room bill.
39
Fig.5.1.8. Total Bill
The above screenshot is about Total Bill for food and Room that you order and booked . It gives you
the total food + room bill .
The above screenshot is about the feedback that users give and the checkout option to checkout.
40
5.2 DISCUSSION:
5.3 APPLICATION
Room Management
Registration of Rooms: Allows the hotel staff to add new rooms into the system with
details such as room number, type (single, double, suite), price per night, and availability
status.
Display and Update Room Status: Hotel staff can view all rooms along with their
availability status. They can also update the status of the rooms (available or unavailable).
Guest Management
Guest Registration: Allows the hotel to register guests with their details such as name,
41
contact information, and ID.
Display Guest Information: Hotel staff can view the list of all registered guests.
Reservation Management
Room Booking: Guests can book rooms by providing check-in and check-out dates. The
system will match available rooms and confirm reservations.
Reservation Confirmation: Provides a unique reservation ID for each booking and stores
reservation details such as check-in and check-out dates, guest information, and room
assigned.
Billing and Payment
Bill Calculation: Calculates the total bill based on the room price per night and the number
of nights stayed.
Payment Processing: Handles the payment process and updates the reservation status once
payment is made.
Reports and Analysis
Occupancy Reports: Provides reports on room occupancy, which helps in understanding
the room utilization.
Revenue Reports: Generates revenue reports based on room bookings and services provide
42
CHAPTER 6
CONCLUSION
In conclusion, the Hotel Management System developed in C significantly enhances the efficiency and
accuracy of hotel operations by automating critical processes such as room management, guest
registration, reservation handling, and billing. This system not only reduces manual workload but also
minimizes errors, thereby improving overall service quality. Key benefits include streamlined operations,
accurate billing, and improved guest experience.
References:
1. www.wikipedia.org/
2. www.Google.com
3. www.beginnersbook.com
4. https://youtube.com
43