Professional Documents
Culture Documents
Computer Hotel Managment
Computer Hotel Managment
ABUDHABI -UAE
STUDENT PARTICULARS
Name
: Don Ignatius
Class
: XII - A
Year: 2015-16
Exam No :
School: Sunrise English PrivateSchool
Project: Hotel Management System
Teacher: Mrs. K. Deepa
ACKNOWLEDGEMENT
I would like to express my gratitude to my teacher Mrs. K.
Deepa, as well as our principal Dr. Thakur Mulchandani who
gave me an opportunity to do this wonderful project . Being a
part of this project showcasing and expanding my knowledge on
the subject . I was also able to create an application which can
be used in reality as well .
INDEX
S.no.
Title
Page
No.
1.
Aim
2.
Program Definition
3.
Algorithm
4.
Program
10
5.
Sample Output
33
6.
Conclusion
38
7.
Bibliography
39
AIM
The basic aim of this project are as follows :
To make a program by using the C++ compiler on the
topic Hotel Management System .
To understand the day to day usage of programming.
To study the various concepts of C++.
4
PROGRAM DEFINITION
The following program is based on a frequently used application
Hotel Management System . In this program, a user can select
an option and to his work .the options are booking a room,
checking in, editing the profile of the user, using the gym and
swimming pool and availing the wifi services and checking out .
First, the user has to book a room . While booking , he will need
to enter his personal informations and select the type of room he
5
ALGORITHM
Start
Declare a class Hotel with data members in introom_no, char
name[50], char address[50], long telno, char roomtype[50] and float
rent .
In the public section, define a function getdata().
Read the details of the user.
Define another function showdata().
Display the details of the customer.
Declare functions booking(), checkin(), checkout(), gym() and
swimming() and wifi() in public section.
6
PROGRAM
//computer project
//HOTEL MANAGMENT SYSTEM
//by Zubin and Don
#include<fstream.h>
#include<conio.h>
#include<process.h>
#include<stdio.h>
#include<stdlib.h>
9
#include<string.h>
class Hotel
{ private :
int room_no;
char name[50];
char address[50];
long telno;
char roomtype[50];
float rent;
public :
void getdata()
{ cout<<"\n\t\t\t ENTER YOUR NAME : ";
gets(name);
cout<<"\n\t\t\t ENTER YOUR ADDRESS : ";
gets(address);
cout<<"\n\t\t\t ENTER YOUR TELEPHONE
NUMBER : ";
cin>>telno;
}
10
void showdata()
{
void booking();
void checkout();
void checkin();
void gym();
void swimming();
void wifi();
int retroom()
{return room_no;
}
11
char* retname()
{return name;
}
char* retaddress()
{return address;
}
long rettel()
{return telno;
}
};
Hotel hp;
void Hotel::booking()
{ randomize();
fstream file1;
file1.open("hotel",ios::out|ios::binary);
hp.getdata();
12
cout<<"\n";
clrscr();
REDO:
cout<<"\n\n\n";cout<<"\tROOM TYPE
"<<"\t"<<"CODE
"<<"\t"<<"CHARGES PER DAY
"<<"\n";
cout<<"\tROYAL SUITE "<<"\t"<<"1."<<"\t"<<"
AED 1500 "<<"\n";
cout<<"\tSUPER DELUXE "<<"\t"<<"2."<<"\t"<<"
AED 1200 "<<"\n";
cout<<"\tDELUXE
AED 800 "<<"\n";
"<<"\t"<<"3."<<"\t"<<"
int ch;
cout<<"\n\t\t\t ENTER YOUR CHOICE : ";
cin>>ch;
switch(ch)
13
case 3 : strcpy(hp.roomtype,"DELUXE");
hp.rent=800;
break;
14
hp.room_no=random(10000-5000+1);
file1.write((char*)&hp,sizeof(hp));
cout<<"\n\n\t\t\t --------------------------";
cout<<"\n\t\t\t YOUR ROOM NUMBER IS ";
cout<<hp.room_no;
cout<<"\n\t\t\t PLEASE DO NOT FORGET YOUR
ROOM NUMBER ";
15
cout<<"\n\t\t\t --------------------------";
file1.close();
cout<<"\n\n\n";
16
while(file2.read((char*)&hp,sizeof(hp)))
{ if(hp.retroom()==r)
{ cout<<"\n\t\t\t ENTER YOUR NAME : ";
gets(n);
if (strcmpi(hp.retname(),n)==0)
{ cout<<"\n\t\t\t YOU HAVE SUCCCESFULLY
CHECKED-IN ";
cout<<"\n\t\t\t ENJOY YOUR STAY ";
flag=1;
}
}
if(flag==0)
{ cout<<"\n\t\t\t OOPS!!! YOU HAVE ENTERD A
WRONG OPTION .";
cout<<"\n\t\t\tTRY AGAIN ";
goto CHECKIN;
}
17
cout<<"\n\n\n";
}
void edit()
{ clrscr();
int r;
int flag=0;
fstream file3,t;
file3.open("hotel",ios::in|ios::out|ios::binary);
t.open("temp",ios::in|ios::out|ios::binary);
file3.seekg(0);
EDIT:
while(file3.read((char*)&hp,sizeof(hp)))
18
{ if(hp.retroom()==r)
{ hp.getdata();
t.write((char*)&hp,sizeof(hp));
flag=1;
}
if (flag==0)
{ cout<<"\n\t\t\t OOPS!!! YOU HAVE ENTERD A
WRONG OPTION .";
cout<<"\n\t\t\tTRY AGAIN ";
goto EDIT;
}
file3.close();
t.close();
19
remove("hotel");
rename("temp","hotel");
cout<<"\n\n\n";
}
while(file4.read((char*)&hp,sizeof(hp)))
{ if (hp.retroom()==room_no)
{ hp.showdata();
}
}
file4.close();
20
while(file5.read((char*)&hp,sizeof(hp)))
{ if (hp.retroom()!=room_no)
t.write((char*)&hp,sizeof(hp));
file5.close();
t.close();
remove("hotel");
rename("temp","hotel");
21
fstream file6;
file6.open("hotel",ios::in|ios::binary);
file6.seekg(0);
TRY:
while(file6.read((char*)&hp,sizeof(hp)))
{ if(hp.retroom()==r)
22
if (flag==1)
remove(r);
23
file6.close();
cout<<"\n\n\n";
}
fstream file8;
file8.open("hotel",ios::in|ios::binary);
file8.seekg(0);
GYM:
cout<<"\n\t\t\t ENTER YOUR ROOM NUMBER : ";
cin>>r;
while(file8.read((char*)&hp,sizeof(hp)))
24
{ if(hp.retroom()==r)
{ cout<<"\n\t\t\t YOU CAN USE THE GYM ";
cout<<"\n\t\t\t PLEASE GO TO THE GYM AND AVAIL
THE SERVICE ";
flag=1;
}
}
if(flag==0)
{ cout<<"\n\t\t\t OOPS!!! YOU HAVE ENTERD A WRONG
OPTION .";
cout<<"\n\t\t\tTRY AGAIN ";
goto GYM;
}
file8.close();
cout<<"\n\n\n";
}
int r;
int flag=0;
fstream file9;
file9.open("hotel",ios::in|ios::binary);
file9.seekg(0);
SWIMMING:
cout<<"\n\t\t\t ENTER YOUR ROOM NUMBER : ";
cin>>r;
while(file9.read((char*)&hp,sizeof(hp)))
{ if(hp.retroom()==r)
{ cout<<"\n\t\t\t YOU CAN USE THE SWIMMING
POOL ";
cout<<"\n\t\t\t PLEASE GO TO THE SWIMMING
POOL AND AVAIL THE SERVICE ";
flag=1;
}
}
26
if(flag==0)
{ cout<<"\n\t\t\t OOPS!!! YOU HAVE ENTERD A WRONG
OPTION .";
cout<<"\n\t\t\tTRY AGAIN ";
goto SWIMMING;
}
file9.close();
cout<<"\n\n\n";
}
27
while(file10.read((char*)&hp,sizeof(hp)))
{ if(hp.retroom()==r)
{ cout<<"\n\t\t\t ENTER YOUR NAME : ";
gets(n);
if (strcmpi(hp.retname(),n)==0)
{ cout<<"\n\t\t\t YOU ARE
CONNECTED TO THE WIFI 'RADISSON_WIFI' ";
flag=1;
}
}
if(flag==0)
{ cout<<"\n\t\t\t OOPS!!! YOU HAVE ENTERD A
WRONG OPTION .";
cout<<"\n\t\t\tTRY AGAIN ";
goto WIFI;
}
28
cout<<"\n\n\n";
}
void main()
{ int choice;
char ch;
Hotel customer;
cout<<"\n\t\t\t ***************************** ";
cout<<"\n\t\t\t WELCOME TO RADDISON BLU HOTEL
";
cout<<"\n\t\t\t ***************************** ";
MENU:
cout<<"\n\t\t\t PLEASE SELECT YOUR OPTIONS ";
cout<<"\n\t\t\t 1. BOOK A ROOM ";
cout<<"\n\t\t\t 2. CHECK-IN ";
29
switch(choice)
{ case 1 : customer.booking();
goto MENU;
case 2 : customer.checkin();
goto MENU;
case 3 : edit();
goto MENU;
30
case 4 : customer.gym();
goto MENU;
case 5 : customer.swimming();
goto MENU;
case 6 : customer.wifi();
goto MENU;
case 7 : customer.checkout();
break;
31
SAMPLE OUTPUT
32
33
34
35
CONCLUSION
The program is found to be running successfully after correction
of all the errors , which were found when the program was being
executed .
The making of this program brought me immense pleasure .
Making this program, which has a universal appeal, was
honourable and was a very good challenge for me . The
opportunity to do such a program was very good and I am quite
happy that I have successfully completed the project . With the
help of this project , I understood how to make a user-friendly
program , which in turn helped me to understand the various
programming methodologies .
BIBLIOGRAPHY
36
37
38
39
40