You are on page 1of 10

/*HOTEL MANAGEMENT*/

#include<fstream.h>
#include<conio.h>
#include<stdio.h>
#include<iomanip.h>
#include<process.h>
fstream f1,f2,f3;
void book_hotel();
void Check_in();
void Checking_out();
void Cancel();
void viewhotel();
void viewpool();
void viewout();
void viewcancel();
void viewbook();
class Swim
{
int memno;
char name[30];
char addr[40];
int telno;
int date_ofmem;
public:
void display()
{
cout<<"The membership mumber"<<endl;
cin>>memno;cout<<endl;
cout<<"The name is"<<endl;
puts(name);
cout<<"The address is"<<endl;
puts(addr);
cout<<"Telephone number is"<<endl;
cin>>telno;cout<<endl;
cout<<"Date of membership"<<endl;
cout<<date_ofmem;
}
void guest()
{
cout<<"Enter the membership number given to you"<<endl;
cin>>memno; cout<<endl;
cout<<"Enter your name"<<endl;
gets(name);
cout<<"Enter your address"<<endl;
gets(addr);
cout<<"Enter your telephone number"<<endl;
cin>>telno;
cout<<"Enter the date of membership"<<endl;
cin>>date_ofmem;
cout<<"It is to be noted that the validity of this is only for one day..Enjoy yo
ur time!"<<endl;
}
void newmem()
{
cout<<"Enter the membership number in the card"<<endl;
cin>>memno; cout<<endl;
cout<<"Enter your name"<<endl;
gets(name);

cout<<"Enter your address"<<endl;


gets(addr);
cout<<"Enter your telephone number"<<endl;
cin>>telno;cout<<endl;
cout<<"Enter the date of membership"<<endl;
cin>>date_ofmem;
cout<<"ENJOY YOUR DAY.. ;)"<<endl;
}
int rtrm()
{ return memno;}
}s1;
class Hotel
{
int roomno;
char addr[50];
long int telno;
int in_date;
int out_date;
char room_type;
char name[30];
float total_bill;//with all other facilities
public:
Hotel()
{
total_bill=0.0;}
void in_room()
{
cout<<"Enter the name of the customer"<<endl;
gets(name);
cout<<"Enter the address"<<endl;
gets(addr);
cout<<"Enter the check-in date"<<endl;
cin>>in_date;cout<<endl;
cout<<"Enter the telephone no"<<endl;
cin>>telno;
cout<<"Room type"<<endl;
cout<<"Press s for single bed room"<<endl;
cout<<"Press d for double bed room"<<endl;
cout<<"Press k for king size bed room"<<endl;
cin>>room_type;
cout<<"Enter the room no alloted"<<endl;
cin>>roomno;
if(room_type=='s')
total_bill=5000;
else
if(room_type=='d')
total_bill=10000;
else
if(room_type=='k')
total_bill=15000;
return;
}
void insout()
{cin>>out_date;}

void displaydat()
{cout<<"The name of the customer is"<<" ";puts(name);
cout<<" The address is"<<" ";puts(addr);
cout<<"The check-in date is"<< " "<<in_date<<endl;
cout<<"The telephone number is"<<" "<<telno;
cout<<"The room type is "<<room_type<<endl;
cout<<"The room number alloted is "<< roomno;
cout<<"The total bill is"<<total_bill;
}

void modifytot(float x)
{total_bill=x;}
int rtrn()
{ return roomno;}
float rtrk()
{return total_bill;}
}pos,trans;//end of class

void admin_menu()
{ int op;
clrscr();
cout<<"SUBMENU"<<endl;
cout<<"Choose 1 for booking"<<endl;
cout<<"Choose 2 for Checking in"<<endl;
cout<<"Choose 3 for Checking out"<<endl;
cout<<"Choose 4 for Cancellation"<<endl;
cout<<"Choose 5 for displaying data of those people who
cout<<"Choose 6 for displaying the data of those people
l;
cout<<"Choose 7 for displaying the data of those people
ndl;
cout<<"Choose 8 for displaying data of those people who
kings"<<endl;
cout<<"Choose 9 for displaying data of those people who
endl;
cin>>op;
switch(op)
{
case 1:book_hotel(); //Correct!
break;
case 2:Check_in(); //part 2 correct..part one not sure
break;
case 3: Checking_out(); //not working
break;
case 4:Cancel(); //not sure
break;
case 5:viewhotel();//working
break;
case 6:viewpool(); //not sure
break;
case 7:viewout();
//not sure
break;
case 8:viewcancel(); //not sure
break;
case 9:viewbook(); //not working

are in hotel"<<endl;
who have used pool"<<end
who have checked out"<<e
have cancelled their boo
have booked the rooms"<<

break;
default:cout<<"Try again!"<<endl;
}
}
void book_hotel()
{
f1.open("ADVBOOK.dat",ios::app|ios::out|ios::in|ios::binary);
pos.in_room();
f1.write((char*)&pos,sizeof(Hotel));
cout<<"Booking recorded successfully"<<endl;
f1.close();
return;
}
void Check_in()
{clrscr(); int rn;
char op;
f1.open("HOTELIN.dat",ios::app|ios::out|ios::in|ios::binary);
f2.open("ADVBOOK.dat",ios::app|ios::in|ios::out|ios::binary);
f3.open("Temp.dat",ios::app|ios::out|ios::in|ios::binary);
cout<<"Has the customer already booked a room?(Y/N)"<<endl;
cin>>op;
if(op==('Y'||'y'))
{cout<<"enter the roomno"<<endl;
cin>>rn;
while(f2.read((char*)&pos,sizeof(Hotel)))
{
if((pos.rtrn())==rn)
{
trans=pos;
//copying to other object and transfering to t
he file hotel from booking.dat
f1.write((char*)&trans,sizeof(Hotel));
}
if((pos.rtrn()!=rn))
f3.write((char*)&pos,sizeof(Hotel));
} //while
remove("ADVBOOK.dat");
rename("Temp.dat","ADVBOOK.dat");
cout<<"Record inserted"<<endl;
}//if
else
{ pos.in_room();
f1.write((char*)&pos,sizeof(Hotel));
cout<<"Record inserted "<<endl;
}
f1.close();
f2.close();
f3.close();
return;
}
void Checking_out()
{clrscr();
int rn; float ex;
f1.open("HOTELIN.dat",ios::app|ios::in|ios::binary);
f2.open("Temp.dat",ios::app|ios::out|ios::binary);

f3.open("Check_out.dat",ios::app|ios::out|ios::in|ios::binary);
cout<<"Enter the roomno"<<endl;
cin>>rn;
ex=pos.rtrk();
cout<<"Enter the checkout date"<<" ";
pos.insout();
cout<<"Total bill of the customer is"<<" "<<ex<<endl;
while(!f1.eof())
{
if((pos.rtrn())!=rn)
f2.write((char*)&pos,sizeof(Hotel));
else
f3.write((char*)&pos,sizeof(Hotel));
}
cout<<"Checking out process completed"<<endl;
remove("HOTELIN.dat");
rename("Temp.dat","HOTELIN.dat");
f1.close();
f2.close();
f3.close();
return;
}
void Cancel()
{ int rn;
cout<<"enter the room number booked"<<endl;
cin>>rn;
f2.open("temp.dat",ios::out|ios::in);
f1.open("ADVBOOK.dat",ios::out|ios::in);
f3.open("Cance_l.dat",ios::out);
while(!f1.eof())
{
f1.read((char*)&pos,sizeof(Hotel));
if(pos.rtrn()!=rn)
f2.write((char*)&pos,sizeof(Hotel));
else
f3.write((char*)&pos,sizeof(Hotel));
}
remove("ADVBOOK.dat");
rename("temp.dat","ADVBOOK.dat");
f1.close();
f2.close();
f3.close();
return;
}
void res_services()
{ clrscr(); int op,ok,rn, i=0;float mon; mon=pos.rtrk();
f1.open("HOTELIN.dat",ios::out|ios::in);
cout<<"enter the room no"<<endl;
cin>>rn;
cout<<"=========================================================================
="<<endl;
cout<<"
MENU
" <<endl;
cout<<"========================================================================"
<<endl;

cout<<"ITEMNO"<<setw(20)<<"ITEM"<<setw(20)<<"COST(Rs)"<<endl;
cout<<"
*****BREAKFAST***** "<<endl;
cout<<"1.Bread with jam"<<setw(20)<<" 100"<<endl;
cout<<"2.Oats"<<setw(20)<<"150"<<endl;
cout<<"3.Rava Dosa"<<setw(20)<<"80"<<endl;
cout<<"4.Idli with Sambar and Chutney"<<setw(20)<<"90"<<endl;
cout<<"5.Sheera"<<setw(20)<<"70"<<endl;
cout<<"6.Vada"<<setw(20)<<"50"<<endl;
cout<<"7.Chapathi with special vegetable"<<setw(20)<<"130"<<endl;
cout<<endl<<endl;
cout<<"
*****LUNCH*****"<<endl;
cout<<"8.Chicken Biryani"<<setw(20)<<"350"<<endl;
cout<<"9.Mutton Biryani"<<setw(20)<<"400"<<endl;
cout<<"10.Vegetable Biryani"<<setw(20)<<"350"<<endl;
cout<<"11.Curd rice"<<setw(20)<<"120"<<endl;
cout<<"12.South Indian Thalli"<<setw(20)<<"140"<<endl;
cout<<endl<<endl;
cout<<"
*****SNACKS*****"<<endl;
cout<<"13.Vada pav"<<setw(20)<<"70"<<endl;
cout<<"14.Pav Bhaji"<<setw(20)<<"100"<<endl;
cout<<"15.Pani Puri"<<setw(20)<<"20"<<endl;
cout<<"16.Bhel puri"<<setw(20)<<"30"<<endl;
cout<<"
******DINNER******
"<<endl;
cout<<"17.Chicken Biryani"<<setw(20)<<"350"<<endl;
cout<<"18.Mutton Biryani"<<setw(20)<<"400"<<endl;
cout<<"19.Vegetable Biryani"<<setw(20)<<"350"<<endl;
cout<<"20.Curd rice"<<setw(20)<<"120"<<endl;
cout<<endl<<endl;
cout<<"
******DRINKS******
"<<endl;
cout<<"21.Coffee"<<setw(20)<<"100"<<endl;
cout<<"22.Tea"<<setw(20)<<"100"<<endl;
cout<<"23.Plain Milk"<<setw(20)<<"90"<<endl;
cout<<"24.Fruit Juice"<<setw(20)<<"40"<<endl;
cout<<"========================================================================"
<<endl;
do
{ cout<<"enter the item number of the dish you want"<<endl;
cin>>op;
switch(op)
{case 1: mon+=100;break;
case 2: mon+=150;break;
case 3:mon+=80;break;
case 4:mon+=90;break;
case 5:mon+=70;break;
case 6:mon+=50;break;
case 7:mon+=130;break;
case 8:mon+=350;break;
case 9:mon+=400;break;
case 10:mon+=400;break;
case 11:mon+=120;break;
case 12:mon+=140;break;
case 13:mon+=70;break;
case 14:mon+=100;break;
case 15:mon+=20;break;
case 16:mon+=30;break;
case 17:mon+=350;break;
case 18:mon+=400;break;
case 19:mon+=400;break;
case 20:mon+=120;break;

case 21:mon+=100;break;
case 22:mon+=100;break;
case 23:mon+=90;break;
case 24:mon=+40;break;
default :cout<<"NOT IN MENU"<<endl; }
cout<<"Do you want to add more dishes in your list?(Y/N)"<<endl;
cin>>ok;
}while(ok=='Y');
while(!f1.eof())
{ if(pos.rtrn()==rn)
pos.modifytot(mon);
}
cout<<"ORDER PLACED.KINDLY WAIT FOR SOMETIME! GOOD MEAL :)"<<endl;
return;
}
void Cab_services()
{clrscr();int ch,rn; char op; float axe=pos.rtrk();
f1.open("HOTELIN.dat",ios::in|ios::out);
cout<<"Enter the room number"<<endl;
cin>>rn;
cout<<"VISITING SITES"<<setw(20)<<"COST(rs)"<<endl;
cout<<"1.MYSORE PALACE"<<setw(20)<<"200"<<endl;
cout<<"2.MYSORE ZOO"<<setw(20)<<"150"<<endl;
cout<<"3.BRIDAVAN GARDENS"<<setw(20)<<"500"<<endl;
cout<<"4.LALITHA MAHAL"<<setw(20)<<"600"<<endl;
cout<<"5.KRISHNA RAJA SAGAR"<<setw(20)<<"1000"<<endl;
do
{
cout<<"Enter the code of the place you want to visit"<<endl;
cin>>ch;
switch(ch)
{
case 1: axe+=200;break;
case 2: axe+=150;break;
case 3: axe+=500;break;
case 4: axe+=600;break;
case 5: axe+=1000;break;
default:cout<<"Wrong option."<<endl;
}
cout<<"Do you want to visit more places(Y/N)?"<<endl;
cin>>op;
}while(op=='Y');
while(!f1.eof())
{if(pos.rtrn()==rn)
pos.modifytot(axe);
}
cout<<"YOUR CAR WILL BE READY BY NEXT 10 MINUTES! THANKYOU FOR THE COOPERATION."
<<endl;
cout<<"HAVE A MEMORABLE AND A SAFE JOURNEY!!"<<endl;
return;
}
void swim_services()
{clrscr();
int op,rn,n;char ch; float num=pos.rtrk();
f1.open("SwimerS.dat",ios::out|ios::app);
f2.open("HOTELIN.dat",ios::in|ios::out);

cout<<"
MENU"<<endl;
cout<<"1.Press 1 if you are a Guest in the hotel"<<endl;
cout<<"2.Press 2 if you are a Member"<<endl;
cout<<"3.Press 3 if you want to be a member "<<endl;
cin>>op;
switch(op)
{
case 1: num+=50;
cout<<"Enter your room number"<<endl;cin>>rn;
s1.guest();
while (!f2.eof())
{if(pos.rtrn()==rn)
pos.modifytot(num);
}
f1.write((char*)&s1,sizeof(Swim));
break;
case 2: cout<<"Enter your membership number"<<endl;
cin>>n;
while(!f1.eof())
{ if(s1.rtrm()==n)
cout<<"ENJOY YOUR TIME!! GOOD DAY :)"<<endl;
}
break;
case 3: cout<<"To become a member deposit 1000 rupees in the counter"<<endl;
cout<<"Is the money deposited?(Y/N)"<<endl;
cin>>ch;
if(ch=='Y')
s1.newmem();
else
return;
break;
default:cout<<"Wrong option!"<<endl;
}
}
void viewhotel()
{
f1.open("HOTELIN.dat",ios::in);
cout<<"The details of the guests are as follows"<<endl;
while(f1.read((char*)&pos,sizeof(Hotel)))
{ pos.displaydat(); cout<<endl<<endl;}
return;
}
void viewpool()
{ f1.open("SwimerS.dat",ios::in);
cout<<"The details of those who have accessed the pools are as follows"<<endl;
while(f1.read((char*)&s1,sizeof(Swim)))
{ s1.display();cout<<endl<<endl;}
return;
}
void viewout()
{
f1.open("Check_out.dat",ios::in);
while(f1.read((char*)&pos,sizeof(Hotel)))
{pos.displaydat();cout<<endl<<endl;}

return;
}
void viewcancel()
{ f1.open("Cance_l.dat",ios::in);
while(f1.read((char*)&pos,sizeof(Hotel)))
{pos.displaydat();cout<<endl<<endl;}
return;
}
void viewbook()
{
f1.open("ADVBOOK.dat",ios::in);
while(f1.read((char*)&pos,sizeof(Hotel)))
{ pos.displaydat(); cout<<endl<<endl;}
f1.close();
return;
}

void main()
{ int ch;char pass[10]; static int count;
cout<<"HOTEL MANAGMENT SYSTEM"<<endl;
cout<<"Done by Jane"<<endl;
cout<<"================================================================"<<endl;
cout<<endl<<endl;
cout<<"WELCOME TO THE HOTEL ATLANTICA "<<endl;
cout<<endl<<setw(30)<<"----WHERE HEAVEN MEETS EARTH"<<endl;
cout<<setw(40)<<"-------MYSORE_INDIA"<<endl;
cout<<"
/_\\ /_\\ /_\\ /_\\
"<<endl;
gotoxy(6,0);
do
{cout<<"MENU"<<endl;
cout<<"Press 1 for Adminstrator Menu (only for the staff\'s members)"<<endl;
cout<<"Press 2 for Restaurant Sevices"<<endl;
cout<<"Press 3 for Taxi Services"<<endl;
cout<<"Press 4 for Swimming Pool"<<endl;
cout<<"Press 5 for Exit"<<endl;
cin>>ch;
switch(ch)
{
case 1:{ while(count!=3)
{
cout<<"Enter the password"<<endl;
gets(pass);
if(strcmp(pass,"ABC")==0)
{ clrscr();
he staff!!
admin_menu();
break;}
else

//password to be remembered by t

{cout<<"Wrong password! Kindly try again."<<endl;


count++;
}}
break;}
case 2: res_services();
break;
case 3: Cab_services();
break;
case 4: swim_services();
break;
case 5: exit(0);
default:cout<<"Wrong option.Try again!"<<endl; clrscr();
break;
}
}while(ch!=6);
clrscr();
getch();
}

You might also like