Professional Documents
Culture Documents
Project Documentation 4
Project Documentation 4
Project Documentation 4
HOTEL
MANAGEMENT
SYSTEM
Name of candidate
Roll No. of Candidate
Class: XI A
Certificate
Department of Information & Technology
Global Indian International School (GIIS) SMART Campus
Singapore
\
Signature
Ms. Ravneet Kaur
1
ACKNOWLEDGEMENT
Candidate Name
2
CONTENTS
1. Introduction ………………………………………………………………………….4
3. Problem definition……………………………………………………………………5
4. Design requirements………………………………………………………………….6
5. System requirements………………………………………………………………….9
7. Code listing…………………………………………………………………………..10
8. User documentation………………………………………………………………….19
9. Bibliography…………………………………………………………………………23
3
PROJECT DOCUMENTATION
4
1. INTRODUCTION
With the development and diversification of the Indian economy, tourism will surely be
one of the economy boosters in the times ahead. For tourism to flourish in India, being
competent in accommodation and lodging services is necessary. In light of this fact, I felt
that preparing myself to meet the needs of our economy was important and therefore
chose to develop a Hotel Management System (HMS), which will help computerize
records and automate common hotel procedures.
1) Addition of Records
2) Updation of Records
3) Deletion of Records
4) Display of Records
The HMS prevents record duplicity by ensuring that the primary key does not repeat
itself in the database.
5
2. ABOUT THE PROGRAMMING TOOL USED
C++ is a general purpose programming language. Its core application domain is in system
programming. It successfully used in many application areas that are not covered at this
complexity level.
C++ uses basic OOP’s concept and hence is nearer to the real world. The key features of
C++ are user-defined types, data hiding, guaranteed initialization of data, implicit type
conversions for user defined types, dynamic typing, user controlled memory management
and mechanics for overloading operators.
6
3. PROBLEM DEFINITION
Existing HMS are based on a lot of administrative staff and paperwork which results in
inefficiency and eventually paves way to corruption. A paradigm shift of the human
administration methods to the digital administration methods will add a new and
corruption-free dimension to the process of administration. The computer operator has
user rights which prevent unauthorized access to database records.
In order to improve upon the drawbacks of the current system, I have analyzed the system
thoroughly.
Hotels have receptionists at the front desk to take care of the needs of the customers. The
receptionists have to handle a lot of administrative tasks. They also have the
responsibility of attending to the calls made to the hotel. This may overtax them and
thereby cause confusion in them and result in administrative havoc. There is a lot of
paperwork involved in this. From another perspective, office stationery spending is
relatively high.
Hotels use a pigeon hole system to store the documents related to a particular room.
There is a wall of pigeon holes with room numbers on them. Documents are put into
them by the receptionist. There is a fundamental drawback in this: the receptionist has to
walk over the pigeon hole to get documents in case a customer wants to perform some
transaction. Imagining the same situation during a peak time, leaves only one word in the
mind: INEFFICIENCY.
The room service personnel have to refer to the dining requirements of the customers
before they can provide for their necessities. They will also have to access documents
from the pigeon hole. As the number of customers increase, this process becomes very
tedious.
7
The computation of the bill is done by the accountant of the hotel. The accountant takes
into account the number of days of stay, the type of dining during the stay and damage
evaluation report which is given by the cleaners. If many customers are checking out in a
particular time, the accountant literally has to punch numbers into the calculator to ensure
that the customers do not get tensed up.
New customers are accepted into the hotel by creating the required documents and
putting them in a free pigeon hole. This prevents two customers from being allocated to
the same room. During peak times, the hotel is fully occupied. Customers seeking a place
in the hotel are sometimes disappointed at the unavailability of a place in the hotel. They
are willing to wait for sometime till some customer checks out. But, the accountant is
unable to tell if some customer will ever check out.
8
4. DESIGN REQUIREMENTS
The time taken for the common procedures of the hotel administration should take less
than a minute to complete. E.g. Creation of a new record, Deletion of a new record.
It also has to able to search the database to display a particular record and perform
modifications.
A database requires a primary key (unique identifier) for a particular record. This
condition has to be met for each record in the database. Hence, HMS requires a
mechanism to assign the private key automatically.
HMS has to store the CUSTOMER records in files. HMS has to be able to search for
particular records and be able to modify them.
9
4.1 Data Structures
I have chosen a data structure known as class in C++ as the data structure to store the
records of the customers. This is the common data structure that is chosen for database
management systems. I have chosen this to facilitate integration of data file handling into
the project as C++ provides functions like read( ),write( ) to cast structures into ASCII
or binary form.
*1.7976931348623158×10308
Status:
1: Registering
2: Registered
3: Checked out
Dining Type:
1: Normal
2: Special
3: Extra Special
10
4.2 Files
A binary file is used to store the customer records. It is named CUSTOMER.DAT.
4.3 Functions
This function checks whether the string pass already exists in the database of records. If it
exists, the function returns a value as 0. Else, it returns a value of 1.
int getlastcustcode()
This function returns the last customer code present in the CUSTOMER.DAT file.
void addrecord(customer c)
This function deletes a record having passport number matching with pass.
This function updates a record present in the file CUSTOMER.DAT which has a passport
number matching with pass.
void showrecords()
11
A user-defined header file has been developed to facilitate execution of common display
functions required for orderly and attractive screen output. The header file is included in
the code listing section for reference (see page 15).
5. SYSTEM REQUIREMENTS
1. Computer
Minimum Requirements:
Microsoft Windows 98
300 Mhz Processor
64MB RAM
2. Printer
3. Computer Operator
Literacy:
Basic Operations in Microsoft Windows Environment
12
6. ALGORITHM AND FLOWCHART
START
DELETE
RECOR
D
No Yes
EXIT ? STOP
13
7. CODE LISTING
#include<iostream.h>
#include<conio.h>
#include<dos.h>
#include<stdlib.h>
#include<fstream.h>
#include<stdio.h>
#include<string.h>
#include<iomanip.h>
#include<dispfunc.h>
class customer;
void addrecord(customer);
void delrecord(char*);
void updaterecord(char*);
void showrecords();
int getlastcustcode();
int validatepass(char*);
class customer
{
char name[25];
char pass[10];//passport number
char phone[15];
int days;
int roomcode;
int custcode;
int roomtype;
int diningtype;
int status;
double charge;
public:
customer()
{
void init()
{
cout<<"\n\n";
print("Enter the name:",CYAN);gets(name);
14
a:print("Enter the passport number:",CYAN);
char* temppass;gets(temppass);
if(!validatepass(temppass))
{
print("ERROR:PASSPORT NUMBER EXISTS IN DATABASE",RED);
cout<<'\n';
goto a;
}
else
{
strcpy(pass,temppass);
}
print("Enter the phone number:",CYAN);cin>>phone;
custcode=getlastcustcode();
roomcode=custcode+100;
status=-1;
charge=0;
cout<<'\n';
print("Available Room Types:",CYAN);cout<<'\n';
print("1.TYPE A",BLUE);cout<<'\n';
print("2.TYPE B",BLUE);cout<<'\n';
print("3.TYPE C",BLUE);cout<<'\n';
print("Enter room type:",CYAN);
cin>>roomtype;cout<<'\n';
}
void show()
{
textcolor(YELLOW);
cout<<name<<"\t"<<pass<<"\t"<<phone<<'\t'<<roomtype<<'\t'<<diningtype<<'\t'<<custcode<<'\t'<<
roomcode<<'\t'<<charge<<'\t'<<status<<'\n';
textcolor(WHITE);
}
char* getname()
{
return name;
}
15
char* getpass()
{
return pass;
}
char* getphone()
{
return phone;
}
int getdays()
{
return days;
}
int getrmcode()
{
return roomcode;
}
int getcustcode()
{
return custcode;
}
int getrmtype()
{
return roomtype;
}
int getdntype()
{
return diningtype;
}
double getcharge()
{
return charge;
}
int getstat()
{
return status;
}
void setname(char* nme)
{
strcpy(name,nme);
}
void setpass(char* ps)
{
strcpy(pass,ps);
}
void setdays(int noofdays)
{
days=noofdays;
}
void setphone(char* ph)
{
16
strcpy(phone,ph);
}
void setrmcode(int rc)
{
roomcode=rc;
}
void setcustcode(int cc)
{
custcode=cc;
}
void setstat(int st)
{
status=st;
}
void calccharge()
{
int rate=1500+(roomtype)*300+(diningtype)*200;
charge=rate*days;
}
};
int validatepass(char* pass)
{
fstream f("custom.dat",ios::nocreate|ios::in);
int flag=1;
f.seekg(0,ios::beg);
customer c;
while(f)
{
f.read((char*)&c,sizeof(customer));
if(!f) break;
if(!strcmp(c.getpass(),pass)) flag=0;
}
f.close();
return flag;
}
int getlastcustcode()
{
int lastcode,maxcode;
fstream f("custom.dat",ios::nocreate|ios::in);
if(!f)
{
lastcode=0;
f.close();
}
else
{
f.seekg(0,ios::beg);
customer lastcust;
lastcode=0;maxcode=0;
17
while(f)
{
f.read((char*)&lastcust,sizeof(customer));
if(!f) break;
lastcust.show();
lastcode=lastcust.getcustcode()+1;
if(lastcode>maxcode) maxcode=lastcode;
}
f.close();
}
return maxcode;
}
void addrecord(customer c)
{
fstream f("custom.dat",ios::out|ios::binary|ios::ate);
if(f)
{
c.setstat(1);
clrscr();
print_at_c("ADDING RECORD...PLEASE
WAIT...",12,YELLOW+BLINK);
delay(2000);
f.write((char*)&c,sizeof(customer));
clrscr();
print_at_c("RECORD ADDED",12,GREEN);
}
else
{
print("I/O ERROR WHILE ACCESSING CUSTOM.DAT",RED);
}
f.close();
}
void delrecord(char* pass)
{
customer c;
int flag=0;
fstream newf("ncustom.dat",ios::out|ios::binary);
if(!newf) print("I/O ERROR WHILE CREATING NCUSTOM.DAT",RED);
fstream f("custom.dat",ios::in|ios::binary|ios::nocreate|ios::beg);
if(!f) print("I/O ERROR WHILE ACCESSING CUSTOM.DAT",RED);
while(f)
{
f.read((char*)&c,sizeof(customer));
if(!f) break;
if(!strcmp(c.getpass(),pass))
{
flag=1;
cout<<"\n\n";
clrscr();
18
print_at_c("DELETING...PLEASE
WAIT...",12,YELLOW+BLINK);
cout<<"\n\n";
delay(2000);
clrscr();
}
else
{
newf.write((char*)&c,sizeof(customer));
}
}
if(!flag)
{
clrscr();
print_at_c("RECORD NOT FOUND",12,RED);
}
else
{
print_at_c("DELETION SUCCESSFUL",12,GREEN);
}
newf.close();
f.close();
remove("custom.dat");
rename("ncustom.dat","custom.dat");
}
void updaterecord(char* pass)
{
customer c;
int flag=0;
fstream f("custom.dat",ios::in|ios::binary|ios::nocreate|ios::beg);
if(!f) print("I/O ERROR WHILE ACCESSING CUSTOM.DAT",RED);
fstream newf("ncustom.dat",ios::out|ios::binary);
if(!newf) print("I/O ERROR WHILE CREATING NCUSTOM.DAT",RED);
while(f)
{
f.read((char*)&c,sizeof(customer));
if(!f) break;
if(!strcmp(c.getpass(),pass))
{
flag=1;
customer newc;
newc.init();
newc.setstat(1);
newf.write((char*)&newc,sizeof(customer));
clrscr();
cout<<"\n\n";
print_at_c("UPDATING...PLEASE
19
WAIT...",12,YELLOW+BLINK);
cout<<"\n\n";
delay(2000);
clrscr();
}
else
{
newf.write((char*)&c,sizeof(customer));
}
}
if(!flag)
{
clrscr();
print_at_c("RECORD NOT FOUND",12,RED);
}
else
{
print_at_c("UPDATION SUCCESSFUL",12,GREEN);
}
newf.close();
f.close();
remove("custom.dat");
rename("ncustom.dat","custom.dat");
}
void showrecords()
{
fstream f("custom.dat",ios::in|ios::binary|ios::nocreate|ios::beg);
if(!f)
{
clrscr();
print_at_c("I/O ERROR WHILE ACCESSING
CUSTOM.DAT",12,RED);cout<<'\n';
}
else
{
customer c;
cout<<"NAME\tPASSNUM\tPHONE\tRM\tDN\tCCODE\tRCODE\tCHRG\tSTAT\n";
cout<<"------------------------------------------------------------------------\n";
while(f)
{
f.read((char*)&c,sizeof(customer));
if(!f) break;
c.show();
}
}
}
class hotel
20
{
public:
void menu()
{
int row=5;
char ch;
print_at_c("HOTEL MANAGEMENT SYSTEM",row,YELLOW);
row=7;
print_at_c("1.ADD RECORD\n",row,BLUE);
print_at_c("2.DELETE RECORD\n",++row,BLUE);
print_at_c("3.UPDATE RECORD\n",++row,BLUE);
print_at_c("4.SHOW RECORDS\n",++row,BLUE);
print_at_c("5.QUIT\n",++row,BLUE);
row++;
print_at_c("ENTER CHOICE:",++row,CYAN);
cin>>ch;
switch(ch)
{
case '1':add();break;
case '2':del();break;
case '3':upd();break;
case '4':show();break;
case '5':quit();break;
}
}
void add()
{
clrscr();
print_at_c("*******ADD RECORD*******",5,YELLOW);
customer c;
c.init();
addrecord(c);
getch();
clrscr();
menu();
}
void del()
{
clrscr();
print_at_c("*******DELETE RECORD*******",5,YELLOW);
cout<<"\n\n";
print("Enter passport number:",CYAN);
char* targetpass;
gets(targetpass);
delrecord(targetpass);
getch();
clrscr();
menu();
}
void upd()
21
{
clrscr();
print_at_c("***********UPDATE RECORD***********",5,YELLOW);
cout<<"\n\n";
print("Enter passport number:",CYAN);
char* targetpass;
gets(targetpass);
updaterecord(targetpass);
getch();
clrscr();
menu();
}
void show()
{
clrscr();
print_at_c("***********CUSTOMER DETAILS***********",5,YELLOW);
cout<<"\n\n";
showrecords();
getch();
clrscr();
menu();
}
void quit()
{
exit(0);
}
};
void main()
{
clrscr();
hotel h;
h.menu();
getch();
}
void print_at_c(char[],int,int);
void print_at(char[],int,int,int);
22
void print_at_c(char txt[],int row,int color=(int)WHITE)
{
int col=0;
col=40-(0.5*strlen(txt));
gotoxy(col,row);
textcolor(color);
cprintf(txt);
textcolor(WHITE);
}
void print_at(char txt[],int row,int col,int color=(int)WHITE)
{
gotoxy(col,row);
textcolor(color);
cprintf(txt);
textcolor(WHITE);
}
void print(char txt[],int color=(int)WHITE)
{
textcolor(color);
cprintf(txt);
textcolor(WHITE);
}
void clear()
{
for (int i=0;i<50;i++)
{
cout<<'\n';
}
}
23
8. USER DOCUMENTATION
ADDITION OF RECORDS:
24
If the passport number exists in the database, the following screen occurs:
DELETION OF RECORDS:
25
1. Press 2 to delete a record.
2. Enter the passport number to delete.
If the passport number does not exist, the following screen appears:
26
UPDATION OF RECORDS:
27
If passport number does not exist, the following screen appears:
DISPLAY OF RECORDS:
28
1. Press 4 to show all records.
EXIT:
29
9. BIBLIOGRAPHY
1. P. Gehlot and C.Gupta, Computer Science CBSE XII, Oxford University Press
2006.
30