You are on page 1of 22

COMPUTER PROJECT

WORK ON
C++

HOTEL
MANAGEMENT

PRESENTED BY-
NIWESH GUPTA
XII A
13
PREFACE
The overwhelming response to the previous programs
gives me an immense feeling of satisfaction and I take
an opportunity to thank all the teachers and the whole
student community who have found this project really
beneficial.

Comments and criticism from readers will be highly


appreciated and incorporated in the subsequent
projects.

NIWESH GUPTA
ACKNOWLEDGEMENT

I would like to thank my Computer Science teacher Mr.


Subhashish Dey for all his guidance and contribution to
this project. Without him, this would not have been
possible. I would also like to thank my parents for all
their support that continues to motivate me to work
towards my betterment. Moreover, I would like to
thank all the teacher and staff of my school who made
me capable of doing such projects.

Thank You Everyone


Niwesh
SOURCE CODE
#include<iostream.h>
#include<conio.h>
#include<string.h>
void type1();
void type2();
void type3();
void type4();
void type5();

class room
{
public:
int r_no,r_charge,c_mem,r_per,no,charge,per;
char
r_cust[20],c_city[20],c_nat[20],r_avail,type[20],cust[20],avail,r_ty
pe[20];

char getavail()
{
return(r_avail);
}
void getr1()
{
r_no=1;
strcpy(r_type,"Sp Type2");
r_charge=1500;
r_avail='Y';
strcpy(r_cust,"N.A");
r_per=0;
}
void getr2()
{
r_no=2;
strcpy(r_type,"Type2");
r_charge=1000;
r_avail='Y';
strcpy(r_cust,"N.A");
r_per=0;
}
void getr3()
{
r_no=3;
strcpy(r_type,"Type3");
r_charge=750;
r_avail='Y';
strcpy(r_cust,"N.A");
r_per=0;
}
void getr4()
{
r_no=4;
strcpy(r_type,"Type4l");
r_charge=1250;
r_avail='Y';
strcpy(r_cust,"N.A");
r_per=0;
}
void getr5()
{
r_no=5;
strcpy(r_type,"C Type2");
r_charge=1500;
r_avail='Y';
strcpy(r_cust,"N.A");
r_per=0;
}
void putinfo()
{
cout<<"\n"<<r_no<<"\t "<<r_type<<"\t "<<r_charge<<"\t
"<<r_avail<<"\t "<<r_cust<<"\t "<<r_per;
}

void allocate()
{
if(r_avail=='Y')
{
cout<<"\n Enter Name of Customer to be printed on bill
:";
cin >>cust;
cout<<"\n For how many days you want the room :";
cin>>per;
cout<<"\n Enter the name of state you belong to :";
cin>>c_city;
cout<<"\n Enter your nationality :";
cin>>c_nat;
cout<<"\n Enter no. of people who want to stay :";
cin>>c_mem;
cout<<"\n--------------”;
cout<<"\n Room is allocated to "<<cust<<" for "<<per<<"
days.";
strcpy(r_cust,cust);
r_per=per;
r_avail='N';
}
else
{
cout<<"\n ERROR : Room cannot be allocated ...";
cout<<"\n Room is not available...";
}
}
void putcust()
{
int j;
j=strcmp(r_cust,"N.A");
if(j==0)
{
cout<<"\n Data not available ";
}
else
{
cout<<"\n Room No :"<<r_no;
cout<<"\n Customer Name :"<<r_cust;
cout<<"\n Days :"<<r_per;
cout<<"\n City :"<<c_city;
cout<<"\n Nationality :"<<c_nat;
cout<<"\n No of member :"<<c_mem;
}
}
};

class bill: public room


{
private:
long total;
int food;
long room;
float ser;
int t;
int oc;
public:
void calculate()
{
room= r_charge * r_per;
cout<<"\n Enter the bill amount of restaurant:";
cin>>food;
cout<<"\n Enter other charges:";
cin>>oc;
t= room + food + oc;
ser=0.103*t;
total=t+ser;
}

void dispbill()
{
clrscr();

cout<<"\n___________________________________________________________
_____________________";
cout<<"\n********************* Hotel Management
System *******************";
cout<<"\n---------------------------------------------------
-------------”;
cout<<"\n Customer name : "<<r_cust;
cout<<"\n ";
cout<<"\n Stayed for "<<r_per<<" days";
cout<<"\n Room charges : "<<r_charge<<"(Per day)";
cout<<"\n Room charges : "<<room<<"(total)";
cout<<"\n Restaurant bill : "<<food;
cout<<"\n Other charges : "<<oc;
cout<<"\n Ser.tax % = 10.3%";
cout<<"\n Ser.tax ="<<ser;
cout<<"\n Bill Amount >>>>>> Rs "<<total;
cout<<"\n ";
cout<<"\n THANK YOU !!!!!";
cout<<"\n Do Visit Us Again !";
strcpy(r_cust,"N.A");
r_per=0;
r_avail='y';
strcpy(c_city,"N.A ");
strcpy(c_nat,"N.A ");
c_mem = 0;
}
void check();
};
void bill:: check()
{
if(r_avail=='y')
{
cout<<"\n"<<r_no<<"\t "<<r_type<<"\t"<<r_charge<<"\t
"<<r_avail<<"\t "<<r_cust<<"\t "<<r_per;
}
}
void main()
{
int i,ch;
bill R[5];
char c;
clrscr();
getch();
clrscr();
R[0].getr1();
R[1].getr2();
R[2].getr3();
R[3].getr4();
R[4].getr5();
clrscr();

cout<<"\n***********************************************************
*****";

cout<<"\n***********************************************************
*****";
cout<<"\n******************** WELCOME TO HOTEL BHH
************************";
cout<<"\n***********************************************************
*****";

cout<<"\n***********************************************************
*****";
gotoxy(35,35);
cout<<"Developed By:";
gotoxy(35,37);
cout<<"NIWESH GUPTA ";
gotoxy(5,35);
getch();
xyz:
clrscr();

cout<<"\n***********************************************************
*****";
cout<<"\n******************** Hotel “BLACK HAT HACKER”
*************************";
cout<<"\n ________________________________
";
cout<<"\n NIWESH GUPTA
";
cout<<"\n CHINMAYA VIDYALAYA
";

cout<<"\n***********************************************************
*****";
cout<<"\n
";
cout<<"\n 1.ROOM INFORMATION 5.CREATE
BILL ";
cout<<"\n
";
cout<<"\n 2.CUSTOMER INFO 6.ROOM
CANCELLATION ";
cout<<"\n
";
cout<<"\n 3.RESERVE ROOM 7.EXIT
";
cout<<"\n\n4.FEATURES OF ROOMS ";
cout<<"\n\n Enter your choice(1-7) : ";
cin >>ch;
if(ch>6)
{
clrscr();
cout<<"\n Wrong choice ....";
getch();
goto xyz;
}
if(ch==1)
{
clrscr();
cout<<"\n ROOM DETAILS
";
cout<<"\n **************
";
cout<<"\nRoom No| Type | Charge | Availability | Cust_Name |
Period |";
for(i=0; i<=4; i++)
{
R[i].putinfo();
}
getch();
clrscr();
cout<<"\n
";

cout<<"\n***********************************************************
*****";
cout<<"\n Do you want to exit (Y/N) :";
cin>>c;
if (c=='n')
{
goto xyz;
}
else
{
goto mno;
}
}
else if(ch==2)
{
abc:
clrscr();
int n;
cout<<"\n Enter room no. :";
cin>>n;
if(n>5)
{
cout<<"\n Wrong choice ....";
getch();
goto abc;
}
n=n-1;
clrscr();
cout<<"\n CUSTOMER DETAILS
";
cout<<"\n *****************
";
R[n].putcust();
getch();
clrscr();
cout<<"\n
";

cout<<"\n***********************************************************
*****";
cout<<"\n Do you want to exit :";
cin>>c;
if (c=='n')
{
goto xyz;
}
else
{
goto mno;
}
}
else if(ch==3)
{
int b;
def:
clrscr();
cout<<"\n Enter room no to be allocated (1-5):";
cin >>b;
if(b>5)
{
cout<<"\n SORRY, Room <<b<< is not available... Pls
enter b/w 1-5";
getch();
goto def;
}
b=b-1;
R[b].allocate();
getch();
clrscr();
cout<<"\n
";

cout<<"\n***********************************************************
*****";
cout<<"\n Do you want to exit(y/n) : ";
cin>>c;
if (c=='n')
{
goto xyz;
}
else
{
goto mno;
}
}
else if(ch==4)
{
ghi:
clrscr();
int a,d,e,f,g,h;
char c;
char b[5];
cout<<"\n Enter Room No:";
cin>>a;
if(a>5)
{
cout<<"\n Pls check your room number once again, as your
entered room number is invalid....";
getch();
goto ghi;
}
a=a-1;
strcpy(b,R[a].r_type);
d=stricmp(b,"Sp Type2");
e=stricmp(b,"Type2");
f=stricmp(b,"Type3");
g=stricmp(b,"Type4l");
h=stricmp(b,"C Type2");
if(d==0)
{
type1();
}
else if(e==0)
{
type2();
}
else if(f==0)
{
type3();
}
else if(g==0)
{
type5();
}
else if(h==0)
{
type4();
}
getch();
clrscr();
cout<<"\n
";

cout<<"\n***********************************************************
*****";
cout<<"\n Do you want to exit(y/n) :";
cin>>c;
if (c=='n')
{
goto xyz;
}
else
{
goto mno;
}
}
else if(ch==5)
{
stu:
clrscr();
int b;
cout<<"\n Enter Room no :";
cin>>b;
if(b>5)
{
cout<<"\n Pls check your room number once again, as the
number you entered is invalid...";
getch();
goto stu;
}
{
char av;
av=R[b-1].getavail();
if(av=='y')
{
cout<<"\n ERROR: Room is not allocated.";
cout<<"\n Bill cannot be created ";
getch();
goto stu;
}
else
{
R[b-1].calculate();
R[b-1].dispbill();
getch();
}
}
clrscr();
cout<<"\n
";

cout<<"\n***********************************************************
*****";
cout<<"\n Do you want to exit(y/n) :";
cin>>c;
if (c=='n')
{
goto xyz;
}
}
else if(ch==6)
{
u:
clrscr();
int b1;
cout<<"\n Enter Room no :";
cin>>b1;
if(b1>5)
{
cout<<"\n Pls check your room number once again, as your
entered room number is invalid ...";
getch();
goto u;
}
{
char av;
av=R[b1-1].getavail();
if(av=='Y')
{
cout<<"\n ERROR: Room is not allocated.";
getch();
goto u;
}
else
{
clrscr();
strcpy(R[b1-1].r_cust,"N.A");
R[b1-1].r_per=0;
R[b1-1].r_avail='y';
strcpy(R[b1-1].c_city,"N.A ");
strcpy(R[b1-1].c_nat,"N.A ");
R[b1-1].c_mem = 0;
}
cout<<"Room booking has been cancelled.....";
getch();
clrscr();
cout<<"\n
";

cout<<"\n***********************************************************
*****";
cout<<"\n Do you want to exit(y/n) :";
cin>>c;
if (c=='n')
{
goto xyz;
}
}
}
else if(ch==7)
{
goto mno;
}
mno:
}
void type1()
{
clrscr();
cout<<"\n FEATURES OF OUR ROOMS
";
cout<<"\n--------------------------------------------------”;
cout<<"\n\n Room Type >>> Deluxe
";
cout<<"\n\n Room charges >>> Rs.2000 per day";
cout<<"\n\n 1. Bed >>> 3";
cout<<"\n\n 2.Capacity >>> 6";
cout<<"\n\n 3.High speed Internet available ";
cout<<"\n--------------------------------------------------”;
cout<<"\n ADDITIONAL FEATURES
";
cout<<"\n--------------------------------------------------”;
cout<<"\n\n 1.A/C ";
cout<<"\n\n 2.Geyser";
cout<<"\n\n 3.22 inch TV ";
cout<<"\n--------------------------------------------------”;
}
void type2()
{
clrscr();
cout<<"\n FEATURES OF THIS ROOM
";
cout<<"\n---------------------------------------”;
cout<<"\n\n Room Type >>> Deluxe
";
cout<<"\n\n Room charges >>>Rs.1500 per day";
cout<<"\n\n 1. Bed >>> 2";
cout<<"\n\n 2.Capacity >>> 5";
cout<<"\n---------------------------------------------------”;
cout<<"\n ADDITIONAL FEATURES
";
cout<<"\n---------------------------------------------------”;
cout<<"\n\n 1.A/C ";
cout<<"\n\n 3.Geyser ";
cout<<"\n\n 4.TV ";
cout<<"\n---------------------------------------------------”;
}
void type3()
{
clrscr();
cout<<"\n FEATURES OF THIS ROOM
";
cout<<"\n--------------------------------------------------”;
cout<<"\n\n Room Type >>> General ";
cout<<"\n\n Room charges >>>Rs.1000 per day";
cout<<"\n\n 1. Bed >>> 2";
cout<<"\n\n 2.Capacity >>> 5";
cout<<"\n--------------------------------------------------”;
cout<<"\n ADDITIONAL FEATURES ";
cout<<"\n--------------------------------------------------”;
cout<<"\n\n 1.Geyser ";
cout<<"\n--------------------------------------------------”;
}
void type4()
{
clrscr();
cout<<"\n FEATURES OF THIS ROOM ";
cout<<"\n--------------------------------------------------”;
cout<<"\n\n Room Type >>> Type4le ";
cout<<"\n\n Room charges >>>Rs.1250 per day";
cout<<"\n\n 1. Bed >>> 1";
cout<<"\n\n 2. Capacity >>> 2";
cout<<"\n\n 3.Balcony ";
cout<<"\n--------------------------------------------------”;
cout<<"\n ADDITIONAL FEATURES ";
cout<<"\n--------------------------------------------------”;
cout<<"\n\n 2.Geyser ";
cout<<"\n\n 3.TV ";
cout<<"\n--------------------------------------------------”;
}
void type5()
{
clrscr();
cout<<"\n FEATURES OF THIS ROOM
";
cout<<"\n--------------------------------------------------”;
cout<<"\n\n Room Type >>> Type4le delux
";
cout<<"\n\n Room charges >>> Rs.1500 per day";
cout<<"\n\n 1. Bed >>> 1";
cout<<"\n\n 2.Capacity >>> 2";
cout<<"\n\n 3.Balcony ";
cout<<"\n--------------------------------------------------”;
cout<<"\n ADDITIONAL FEATURES
";
cout<<"\n--------------------------------------------------”;
cout<<"\n\n 1.A/C ";
cout<<"\n\n 2.Geyser ";
cout<<"\n\n 3.TV ";
cout<<"\n--------------------------------------------------”;
}
BIBLIOGRAPHY
I have referred to following sources for references
during this project:
1. Computer Science with C++ - Sumita Arora
2. Microsoft C++ - Robert Lafore
3. Cppreference.com

I would like to thank publishers and maintainers


of the above.

Thank You Everyone


Niwesh

You might also like