Computer Science
Investigatory Project
Hotel Management
AISSCE 2015-16
- Yash [Link]
- XII-A
- Kendriya Vidyalaya INS
Hamla
- Roll No. :
Certificate
This is to certify that YASH [Link] of Class XII-A has prepared the
investigatory project entitled
HOTEL MANAGEMENT. The project is the result of his efforts &
endeavors. This is accepted as final project for the subject Computer
Science for Class XII.
Internal Examiner
Examiner
Principal
External
Contents
Acknowledgement
Abstract
Class and data members
Source code
Output
Bibliography
Acknowledgement
I place my sincere thanks to my Computer Science
teacher
Mr. Sumit Sahu for his guidance and advices to complete
my
work successfully. He provided me the software for
programs
and helped me in rectification of errors.
I would also like to thank my parents for their
encouragement
and support in my humble venture.
Abstract
The project is aimed to create a program in C++ for
carrying out effective management of records of
customers for efficient hotel management using concept
of data file handling.
The program allows the user to book rooms, input, modify
and delete customer details, display records and generate
bill based upon type of room and no. of days occupied .
Class & Data
Members
Class : hotel
Data
TYPE
Members
Purpose
room_no
signed int
name[30]
char
For booking and identification
of any customer.
For storing name of any
customer.
For storing address of any
customer.
For storing phone number of
any customer.
address[50] char
phone[20]
char
Source
Code
/********************************
* HEADER FILES USED IN THE
PROJECT
*********************************/
#include<iostream.h>
#include<conio.h>
#include<fstream.h>
#include<dos.h>
#include<stdio.h>
#include<iomanip.h>
#include<string.h>
/********************************
* CLASS USED IN THE PROJECT *
*********************************/
class hotel
{signed int room_no;
char name[30];
char address[50];
char phone[20];
public:
void main_menu();//to dispay the main
menu
void add();
//to book a room
void display(); //to display the
customer record
void rooms();//to display alloted rooms
void edit();
//to edit the customer
record
int check(int);
//to check room status
void modify(int); //to modify the record
void delete_rec(int);
//to delete the record
void bill();
//to generate bill
}; hotel h;
/*******************************
* FUNCTION TO DISPLAY THE MAIN MENU *
*******************************/
void ho[Link]
{
int choice;
while(choice!=6)
{
clrscr();
cout<<"\n\n";
cout<<" \t
----------------------------------------------------------- \n";
cout<<" \t|| *
*
* * * * ** * *
* * * * || \n";
cout<<" \t|| * *
*
* *
** * *
* *
|| \n";
cout<<" \t|| * * *
* *
***
* * * *
* ***
|| \n";
cout<<" \t|| *
*
**
*
* ** *
* *
|| \n";
cout<<" \t||*
*
*
* * * * **
**** * * * || \n";
cout<<" \t
----------------------------------------------------------- ";
cout<<"\n\n";
cout<<"\n\t\t\t\t*************";
cout<<"\n\t\t\t\t* MAIN MENU *";
cout<<"\n\t\t\t\t*************";
cout<<"\n\n\n\t\t\[Link] A Room";
cout<<"\n\t\t\[Link] Record";
cout<<"\n\t\t\[Link] Allotted";
cout<<"\n\t\t\[Link] Record";
cout<<"\n\t\t\[Link]";
cout<<"\n\t\t\[Link]";
cout<<"\n\n\t\t\tEnter Your Choice: ";
cin>>choice;
switch(choice)
{case 1: add();
break;
case 2: display();
break;
case 3: rooms();
break;
case 4: edit();
break;
case 5: bill();
break;
case 6: break;
default: cout<<"\n\n\t\t\tWrong choice.....!!!";
cout<<"\n\t\t\tPress any key to continue....!!";
getch();
}}}
/************************
* FUNCTION TO BOOK A ROOM *
*************************/
void ho[Link]
{clrscr();
int r, flag=0;
ofstream fout("[Link]",ios::app);
cout<<"\n Enter Customer Details";
cout<<"\n ----------------------";
cout<<"\n\n Room no: ";
cin>>r;
flag=check(r);
if(flag==1)
cout<<"\n Sorry..!!!Room is already booked";
else
{room_no=r;
cout<<" Name: ";
gets(name);
cout<<" Address: ";
gets(address);
cout<<" Phone No: ";
gets(phone);
[Link]((char*)this,sizeof(hotel));
cout<<"\n Room is booked...!!!";
}
cout<<"\n Press any key to continue.....!!";
getch();
[Link]();
}
/************************
* FUNTION TO CHECK ROOM STATUS *
************************/
int ho[Link] r)
{
int flag=0;
ifstream fin("[Link]",ios::in);
while(![Link]())
{
[Link]((char*)this,sizeof(hotel));
if(room_no==r)
{flag=1;
break;
}}
[Link]();
return flag;
}
/*****************************
* FUNCTION TO DISPLAY CUSTOMER
RECORD
******************************/
void ho[Link]
{clrscr();
ifstream fin("[Link]",ios::in);
int r,flag=0;
cout<<"\n Enter room no: ";
cin>>r;
while(![Link]())
{[Link]((char*)this,sizeof(hotel));
if(room_no==r)
{
clrscr();
cout<<"\n Customer Details";
cout<<"\n ----------------";
cout<<"\n\n Room no: "<<room_no;
cout<<"\n Name: "<<name;
cout<<"\n Address: "<<address;
cout<<"\n Phone no: "<<phone;
flag=1;
break;
}}
if(flag==0)
cout<<"\n Sorry Room no. not found or
vacant....!!";
cout<<"\n\n Press any key to continue....!!";
getch();
[Link]();
}
/***********************
* FUNCTION TO DISPLAY ALLOTED
ROOM
*
***********************/
void ho[Link]
{clrscr();
ifstream fin("[Link]",ios::in);
cout<<"\n\t\t\t List Of Rooms Allotted";
cout<<"\n\t\t\t ----------------------";
cout<<"\n\n Room No. Name\t\t
Address\t\t\t Phone No.\n";
while([Link]((char*)this,sizeof(hotel)))
{cout<<"\n\n "<<"
"<<room_no<<"
"<<name;
cout<<"\t"<<address<<"\t"<<phone;}
cout<<"\n\n\n\t\t\tPress any key to
continue.....!!";
[Link]();
}
getch();
/**************************
* FUNCTION TO EDIT CUSTOMER RECORD
************************/
void ho[Link]
{clrscr();
int choice,r;
cout<<"\n EDIT MENU";
cout<<"\n ---------";
cout<<"\n\n [Link] Customer Record";
cout<<"\n [Link] Customer Record";
cout<<"\n Enter your choice: ";
cin>>choice;
clrscr();
cout<<"\n Enter room
no: " ;
cin>>r;
switch(choice)
{
case2:
1:delete_rec(r);
modify(r); break;
case
break;
default: cout<<"\n Wrong Choice.....!!";
}
cout<<"\n Press any key to
continue....!!!";getch();
}/****************************
* FUNTION TO MODIFY RECORD
***************************/
void ho[Link] r)
{
long pos,flag=0;
*
fstream file("[Link]",ios::in|ios::out|
ios::binary);
while(![Link]())
{pos=[Link]();
[Link]((char*)this,sizeof(hotel));
if(room_no==r)
{cout<<"\n Enter New Details";
cout<<"\n -----------------";
cout<<"\n Name: ";
gets(name);
cout<<" Address: ";
gets(address);
cout<<" Phone no: ";
gets(phone);
[Link](pos);
[Link]((char*)this,sizeof(hotel));
cout<<"\n Record is modified....!!";
flag=1;
break;
}}
if(flag==0)
cout<<"\n Sorry Room no. not found or
vacant...!!";
[Link]();
}
/****************************
* FUNTION TO DELETE RECORD
*
****************************/
void ho[Link] r)
{
int flag=0;
char ch;
ifstream fin("[Link]",ios::in);
ofstream fout("[Link]",ios::out);
while([Link]((char*)this,sizeof(hotel)))
{if(room_no==r)
{
cout<<"\n Name: "<<name;
cout<<"\n Address: "<<address;
cout<<"\n Phone No: "<<phone;
cout<<"\n\n Do you want to delete this
cin>>ch;
if(ch=='n')
[Link]((char*)this,sizeof(hotel));
flag=1; } else
[Link]((char*)this,sizeof(hotel));}
[Link]();
[Link]();
if(flag==0)
cout<<"\n Sorry room no. not found or
vacant...!!";
else
{remove("[Link]");
rename("[Link]","[Link]"); }}
/*************************
* FUNTION TO GENERATE BILL *
**************************/
void ho[Link]
{int days, r, flag;
float price;
char fullname[30];
start:
clrscr();
cout<<"BILL GENERATION MENU";
cout<<"\n\nRoom no. :";
cin>>r;
flag=check(r);
if(flag==1)
{cout<<"\nEnter no. days :";
cin>>days;
cout<<"\nChoose type of room from the
following:";
cout<<"\n\[Link] AC Ordinary \[Link] Ordinary
int opt;
cin>>opt;
ifstream fi("[Link]",ios::in|ios::binary);
while(![Link]())
{out<<"\nGenerating bill...";
sleep(2);
if(room_no==r)
{int pos=-1*sizeof(h);
[Link](pos,ios::cur);
[Link]((char*)this,sizeof(h));
strcpy(fullname,name);}
break; }
price= opt * 500 * days;
cout<<"\n**********************";
cout<<"\n*
HOTEL AVENUE
*";
cout<<"\n*
Charkop Sec. No.6,
Kandivali(W), *";
cout<<"\n\n
*
INVOICE
*";
cout<<"\n
*
*";
cout<<"\n
Customer Name :
"<<fullname;
cout<<"\n
Days : "<<days;
cout<<"\n
Amount
be paid for
:
cout<<"Room
not found
to be to
occupied
"<<price;
biling";
cout<<"\n**********************";
cout<<"\n\nEnter
1. To go back to Main Menu";
getch();
}
cout<<"
2. To back to billing menu";
else
int ch;
cin>>ch;
if(ch==1)
/**************************
THE MAIN FUNTION OF THE PROGRAM
****************************/
void main()
{
textmode(C80);
textbackground(WHITE);
textcolor(RED);
clrscr();
cout<<"\n\t\t\t****************************
";
cout<<"\n\t\t\t* HOTEL MANAGEMENT
PROJECT
*";cout<<"\n\t\t\t*************************
***;
sleep(2);
cout<<"\n\n\n\n\t\tPrepared By :";
sleep(0.5);
cout<<"\t Divesh Shukla";
sleep(1);
cout<<"\n\n\t\tStd. :";
cout<<"\n\n\t\tSchool
Name :";
sleep(0.5);
sleep(0.5);cout<<"\t
cout<<"\t
XII-A"; KV INS HAMLA";
sleep(1);
sleep(1);
cout<<"\n\n\t\tSubmitted To :";
sleep(0.5);
cout<<"\t Mr. SUMIT SAHU";
sleep(1);
cout<<"\n\n\n\t\t\t\t\tPress any key to
continue....!!";
getch(); h.main_menu();}
Outputs
Main menu
Adding New
Customer
Record
Viewing
Customer Details
Edit Menu:
Modifying and deleting
records
Display of all
records
Billing
Bibliography
[Link]
[Link]
[Link]
[Link]