0% found this document useful (0 votes)
67 views71 pages

Sandhya Pras..

This document describes a hotel management system project created in C++. It includes a class called hotel that stores customer and booking details. The project uses object-oriented programming concepts like encapsulation, inheritance and polymorphism. It has functions for adding, displaying, editing and deleting customer records from the system.

Uploaded by

hafsa
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
67 views71 pages

Sandhya Pras..

This document describes a hotel management system project created in C++. It includes a class called hotel that stores customer and booking details. The project uses object-oriented programming concepts like encapsulation, inheritance and polymorphism. It has functions for adding, displaying, editing and deleting customer records from the system.

Uploaded by

hafsa
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 71

HOTEL

MANAGEMENT
Page | 1
TILAK PUBLIC SCHOOL
COMPUTER SCIENCE
PROJECT

2018-2019

Page | 2
Name: Sandhya Prasad

Class: XII

Section: Commerce.

Registration No: M219450330096


Board Roll no:

Page | 3
CERTIFICATE
This is to certify that this computer project on HOTELMANAGEMENT
SYSTEM has been completed by SHAKIRA KHAN of class XII
COMMERCE, in partial fulfillment of the curriculum of the Central
Board of Secondary Education leading to the award of All India Senior
School Certificate for the year 2018-19.

Registration No.: M219450330096


Board Roll No:

_______________ _______________
External Examiner Internal Examiner
Date: Date:
_______________ _________
SCHOOL SEAL PRINCIPAL
Date:

Page | 4
DECLARATION
I hereby declare that the project entitled
“HOTELMANAGEMENT SYSTEM” submitted to
“Tilak Public School” for subject computer science
under the guidance of Mrs. Amrita Dutta is a record of
original done by us and there is no copy or project
related to it has been submitted to any other school or
educational institute by us.

Page | 5
ACKNOWLEDGEMENT
I wish to express my deep gratitude and sincere thanks to the
principal, Mrs. Prabhavathy Ajithkumar, Tilak Public School for
the encouragement and for all the facilities that she has
provided for this project work. I sincerely appreciate this
magnanimity by taking me into her fold for which I shall remain
indebted to her. I extend my hearty thanks to Mrs. Amrita
Dutta, Computer science teacher who guided me throughout
the project. I take this opportunity to express my deep sense of
gratitude for her in valuable guidance, constant encouragement,
immense motivation, which has sustained my efforts at all the
stages of this project work. I can’t forget to offer my sincere
thanks to my parents who helped me to carry out this project
work successfully and their valuable advice and support that I
received time to time. Above all I thank The Almighty God for
making this project a success.

Page | 6
INDEX
Sr. No CONTENTS PAGE NO.
1] Hardware and software 8

2] Introduction to C++ 10

3] Introduction to project 16

4] Flow chart 17

5] File Structure 19

6] Source Code 22

7] Output 63

8] Limitations 67

9] Conclusions 68

10] Bibliography 69

Page | 7
HARDWARE
AND
SOFTWARE
INFORMATION

HARDWARE
Page | 8
Laptop: HP Envy 220
th
Processor: Intel i5 5 Gen
Hard Disk: 1 TB
Ram: 8 GB
SOFTWARE
OS: Windows 10 Enterprise
Software: Turbo C++
MS Word 2010

INTRODUCTION TO C++
Page | 9
C++ was developed by Bjarne Stroustrup. It was
originally named as C with classes, was renamed
as C ++ in 1983.
The features of C++ as a language:
 C++ is an open source ISO standardized
language.
 C++ is standardized by a committee of the
ISO.
 C++ is a compiled language. C++ compiles
directly to a machine’s native code.
 C++ supports both static and dynamic type
checking.

Page | 10
 C++ allows type conversions to be checked
either at compile time or at run time, again
offering another degree of flexibility.
C++ support OOP (object oriented
programming) which support features like:

 OBJECT: Object is a collection of number


of entities. Objects take up space in the
memory. Objects are instances of classes.
When a program is executed, the objects
interact by sending messages to one
another. Each object contains data and
code to manipulate the data. Objects can
interact without having known details of
each other’s data or code.

Page | 11
 CLASS: Class is a collection of objects of
similar type. Objects are variables of the
type class. Once a class has been defined,
we can create any number of objects
belonging to that class. E.g.: grapes
bananas and orange are the member of
class fruit.

Page | 12
DATA ABSTRACTION AND
ENCAPSULATION:

Combining data and functions into a single


unit called class and the process is known as
Encapsulation. Data encapsulation is
important feature of a class. The insulation of
the data from direct access by the program is
called data hiding or information hiding.
Hiding the complexity of program is called
Abstraction and only essential features are
represented. In short we can say that internal
working is hidden.

Page | 13
INHERITANCE:
It is the process by which object of one class
acquire the properties or features of objects of
another class. The concept of inheritance provide
the idea of reusability means we can add
additional features to an existing class without
modifying it. This is possible by driving a new
class from the existing one. The new class will
have the combined features of both the classes.

Page | 14
POLYMORPHISM:
A Greek term means ability to take more than
one form. An operation may exhibit different
behavior in different instances. The behavior
depends upon the types of data used in the
operation.
Example: Operator Overloading, Function
Overloading etc.

Page | 15
INTRODUCTION TO
PROJECT
This program is very useful in real life
situation for providing instant information of
Hotel Management Program. It also stores
information about personal details, travel
details of customers.
In this C++ program we can modify, add,
delete, recall and list the records. Being OOP
concept available, we can add or remove
function anytime we need and even add
classes and derived classes for further
improvement of the program without
recording.

Page | 16
FLOW CHART

Page | 17
Page | 18
FILE
STRUCTURE

Page | 19
LIST OF HEADER FILE

Sr no. Header File Purpose

fstream.h For file handling,


1 cin & cout
iostream.h

2 process.h For exit ()unction

For clrscr() and


3 conio.h getch() functions

For standard input,


4 stdio.h output operations.

For strcmp() and


5 string.h strcpy()Etc.

For text color(),


6 dos.h delay(),
textbackground ()

Page | 20
LIST OF FUNCTIONS
Functions
Sr no. Purpose
For displaying
1 Main_menu() main menu.

For adding
2 Add() records.
Display() For displaying
3
records.

4 Rooms() For

Edit()
5 For editing details.

For modifying
6 Modify() details.
Check() For checking
7
details.
For deleting
8 Delete_rec() records.

Page | 21
SOURCE
CODE

Page | 22
#include<iostream.h>
#include<conio.h>
#include<string.h>
#include<stdio.h>
#include<process.h>
#include<fstream.h>
class hotel
{
char id[20];
int rno;
int bil;
int ser;
int days;
int total;
int price;
char type[20];
char name[30];
char address[50];

Page | 23
char phone[10];
public:
void main_menu();
void add();
void display();
void rooms();
void available();
void edit();
int check(int);
void modify(int);
void bill();
void display_bill(int);
void pay_bill(int);
void delete_rec(int);
void r_type();
int test();
int getroomno()
{

Page | 24
return rno;
}
void r1()

{ clrscr();
textcolor(WHITE); textbackground(YELLOW);

cout<<"\n****************************************
*************************";
cout<<"\n\n\t\t\t\t\t GENERAL ";

cout<<"\n\n**************************************
*****************************";
cout<<"\n Room no.=1";
cout<<"\n\n Room charges=Rs.800 per day";
cout<<"\n\n 1. No. of Bed=2";
cout<<"\n\n 2.Capacity=3";

cout<<"\n****************************************
**************************";
Page | 25
cout<<"\n\t\t\t\t ADDITIONAL FEATURES";

cout<<"\n****************************************
**************************";
cout<<"\n\n 1.Geyser available";
getch();
}
void r2()
{ clrscr();
textcolor(WHITE); textbackground(YELLOW);

cout<<"\n****************************************
*************************";
cout<<"\n\n\t\t\t\t DELUXE ";

cout<<"\n\n**************************************
***************************";
cout<<"\n Room No.=2";
cout<<"\n\n Room charges=Rs.1500 per day";
cout<<"\n\n 1. No.of Bed=2";
Page | 26
cout<<"\n\n 2.Capacity=5";

cout<<"\n****************************************
***************************";
cout<<"\n ADDITIONAL FEATURES ";

cout<<"\n****************************************
***************************";
cout<<"\n\n 1.A/C available ";
cout<<"\n\n 3.Geyser available";
cout<<"\n\n 4.TV available ";
getch();
}
void r3()
{ clrscr();
textcolor(WHITE); textbackground(YELLOW);

cout<<"\n****************************************
**************************";
cout<<"\n\n\t\t\t COUPLE";
Page | 27
cout<<"\n\n**************************************
****************************";
cout<<"\n Room No.=3";
cout<<"\n\n Room charges= Rs.2500 per day";
cout<<"\n\n 1.No.of Bed=2";
cout<<"\n\n 2.Capacity=4";
cout<<"\n\n 3.Balcony available ";

cout<<"\n****************************************
**************************";
cout<<"\n ADDITIONAL FEATURES ";

cout<<"\n****************************************
**************************";
cout<<"\n\n 1.A/C available ";
cout<<"\n\n 2.Geyser available";
cout<<"\n\n 3.TV available ";
getch();
}
Page | 28
void r4()
{ clrscr();
textcolor(WHITE); textbackground(YELLOW);

cout<<"\n****************************************
**************************";
cout<<"\n\n\t\t\t\t LUXURY";

cout<<"\n\n**************************************
****************************";
cout<<"\nRoom No.=4";
cout<<"\n\n Room charges=Rs.3250 per day";
cout<<"\n\n 1. No. of Bed=2";
cout<<"\n\n 2. Capacity=2";
cout<<"\n\n 3.Balcony available ";

cout<<"\n****************************************
**************************";
cout<<"\n ADDITIONAL FEATURES ";

Page | 29
cout<<"\n****************************************
**************************";
cout<<"\n\n 1.Geyser available";
cout<<"\n\n 2.TV available ";
getch();
}
void r5()

{ clrscr();
textcolor(WHITE); textbackground(YELLOW);

cout<<"\n****************************************
**************************";
cout<<"\n\n\t\t\t\t COUPLE LUXURY";

cout<<"\n\n**************************************
****************************";
cout<<"\n Room No.=5";
cout<<"\n\n Room charges=Rs.4500 per day";

Page | 30
cout<<"\n\n 1.No. of Bed=2";
cout<<"\n\n 2.Capacity=2";
cout<<"\n\n 3.Balcony available ";

cout<<"\n****************************************
**************************";
cout<<"\n ADDITIONAL FEATURES ";

cout<<"\n****************************************
**************************";
cout<<"\n\n 1.A/C available ";
cout<<"\n\n 2.Geyser available";
cout<<"\n\n 3.TV available ";
getch();
}
}obj;
void hotel::main_menu()
{
int choice;

Page | 31
while(choice!=7)
{ clrscr();
textcolor(WHITE);

cout<<"\n****************************************
****************************************";
cout<<"\n\t\t\t\t MAIN MENU ";

cout<<"\n\n**************************************
******************************************";
cout<<"\n\n\n\t\t\t1.Book A Room";
cout<<"\n\t\t\t2.Customer Record";
cout<<"\n\t\t\t3.Rooms Allotted";
cout<<"\n\t\t\t4.Room Availability";
cout<<"\n\t\t\t5.Edit Records";
cout<<"\n\t\t\t6.Room Facilities";
cout<<"\n\t\t\t7.Customer Bill";
cout<<"\n\t\t\t8.Exit";
cout<<"\n\n\t\t\t Enter Your Choice: ";

Page | 32
cin>>choice;
switch(choice)
{ case 1: add();
break;
case 2: display();
break;
case 3: rooms();
break;
case 4: available();
break;
case 5: edit();
break;
case 6:r_type();
break;
case 7:bill();
break;
case 8: return;
default:

Page | 33
{
cout<<"\n\n\t\t\t Wrong choice.....";
cout<<"\n\t\t\t Press any key to
continue....";
getch();
}
}
}
}
void hotel::r_type()
{ int ch;textcolor(WHITE);
while(ch!=6)
{ clrscr();

cout<<"\n****************************************
****************************************";
cout<<"\n\t\t\t\t TYPES OF ROOMS";

Page | 34
cout<<"\n\n**************************************
******************************************";
cout<<"\n\n\n\t\t\t\t1.General";
cout<<"\n\t\t\t\t2.Deluxe";
cout<<"\n\t\t\t\t3.Luxury";
cout<<"\n\t\t\t\t4.Couple ";
cout<<"\n\t\t\t\t5.Couple Luxury";
cout<<"\n\t\t\t\t6.Back to main menu";
cout<<"\n\n Enter your choice to view the details
of the room....";
cin>>ch;
switch(ch)
{ case 1:
clrscr();
r1();
break;
case 2:
clrscr();

Page | 35
r2();
break;
case 3:
clrscr();
r3();
break;
case 4:
clrscr();
r4();
break;
case 5:
clrscr();
r5();
break;
case 6:
getch();
break;
default:

Page | 36
{ cout<<"\n Wrong choice";
getch();
}
}
}
}

void hotel::add()
{ clrscr();textcolor(WHITE);
int rn,e;
ofstream fout("rooms.dat",ios::app);
cout<<"\t\t\t DETAILS OF ROOM";
cout<<"\n\t\t\t********************";
cout<<"\n\n Room No.\t\t\t\t Room Type";
cout<<"\n\n\n1\t\t\t\t\t General";
cout<<"\n2\t\t\t\t\t Delux";
cout<<"\n3\t\t\t\t\t Luxury";
cout<<"\n4\t\t\t\t\t Couple";

Page | 37
cout<<"\n5\t\t\t\t\t Couple Luxury";

cout<<"\n****************************************
**************************";
cout<<"\n\n\t\t\t REGISTER";
cout<<"\n\n Enter the Room no. you want to book: ";
cin>>rn;
if((rn<1)||(rn>5))
{ cout<<"\n Invalid room number....Please Try
Again";
getch();
return;
}
e=check(rn);
if(e)
{ cout<<"\n Sorry...\nThe Room is already booked";
cout<<"\n Note :*To check the room availablity, go
to 'Room Available' in the MAIN MENU";
}
else
Page | 38
{ clrscr();
rno=rn;textcolor(WHITE);
textbackground(YELLOW);
cout<<"\n\n\t\t\t Room Available";
cout<<"\n Enter room Type Displayed Above :";
gets(type);
cout<<"\n\n Enter your Name: ";
gets(name);
cout<<"\n Enter your Address: ";
gets(address);
cout<<"\n Enter your Contact Number: ";
cin>>phone;
cout<<"\n Enter your Email ID: ";
gets(id);
cout<<"\n How many days do you want to live ?
\n";
cin>>days;
if(rno==1)
{ r1();
Page | 39
price=800;
}
else if(rno==2)
{ r2();
price=1500;
}
else if(rno==3)
{ r3();
price=2500;
}
else if(rno==4)
{ r4();
price=3250;
}
else if(rno==5)
{ r5();
price=4500;
}

Page | 40
else
getch();
fout.write((char*)this,sizeof(hotel));
cout<<"\n Your Room is booked...\n\n\t\tThank
You";
}
cout<<"\n\n\n Press any key to continue.....!!";
getch();
fout.close();
}

void hotel::display()
{ clrscr();
ifstream fin("rooms.dat",ios::in);
int rn,e;
cout<<"\n Enter Your room no: ";
cin>>rn;
while(!fin.eof())
{ fin.read((char*)this,sizeof(hotel));
Page | 41
if(rno==rn)
{
cout<<"\n\t\t\t\tRoom Details";
cout<<"\n\nRoom no: "<<rno;
cout<<"\nRoom Type:"<<type;
cout<<"\nCustomer Name:"<<name;
cout<<"\nCustomer Address:"<<address;
cout<<"\nContact Number:"<<phone;
cout<<"\nEmail ID:"<<id;
cout<<"\nNumber of days living:"<<days;
cout<<"\nRoom Charge:Rs."<<price<<" \\*";
e=1;
break;
}
}

if(e==0)
{ cout<<"\n Sorry Room no. not found or vacant....";

Page | 42
cout<<"\n\n Press any key to continue....";
getch();
fin.close();
}
}
int hotel::test()
{ ifstream fin;
fin.open("rooms.dat");
fin.seekg(0,ios::end);
int n;
n=fin.tellg()/sizeof(obj);
cout<<" \n NUMBER OF RECORDS = "<<n ;
return n ;
}

void hotel::rooms()
{ clrscr();textcolor(WHITE); textbackground(YELLOW);
int n;

Page | 43
ifstream fin("rooms.dat",ios::in);

cout<<"\n****************************************
****************************************";
cout<<"\n\t\t\t LIST OF ROOMS ALLOTED";

cout<<"\n\n**************************************
******************************************";
n=test();
cout<<"\n\nRoom
No.\t\tName\t\tType\t\tRoom_charge\n";
if(fin)
{ for(int i=0;i<n;i++)
{ fin.read((char*)this,sizeof(hotel));
cout<<"\n\n
"<<rno<<"\t\t"<<name<<"\t\t"<<type<<"\t\t"<<price;
}
}
cout<<"\n\n\nPress any key to continue.....";
getch();

Page | 44
fin.close();
}

void hotel::available()
{ clrscr();textcolor(WHITE); textbackground(YELLOW);
int n; int f1=0,f2=0,f3=0,f4=0,f5=0;
ifstream fin("rooms.dat",ios::in);

cout<<"\n****************************************
****************************************";
cout<<"\n\t\t\t LIST OF ROOMS AVAILABLE";

cout<<"\n\n**************************************
******************************************";
n=test();
cout<<"\n\nRoom No.\t\tType\t\t\tRoom Available\n";
if(fin)
{ for(int i=0;i<n;i++)
{ fin.read((char*)&obj,sizeof(obj));
if(obj.getroomno()==1)
Page | 45
{ cout<<"\n\n
"<<"1"<<"\t\t\t"<<"GENERAL"<<"\t\t\t\tNO";
f1=1;
}
if(obj.getroomno()==2)
{ f2=1;
cout<<"\n\n
"<<"2"<<"\t\t\t"<<"DELUX"<<"\t\t\t\tNO";
}
if(obj.getroomno()==3)
{ f3=1;
cout<<"\n\n
"<<"3"<<"\t\t\t"<<"LUXURY"<<"\t\t\t\tNO";
}
if(obj.getroomno()==4)
{ f4=1;
cout<<"\n\n
"<<"4"<<"\t\t\t"<<"COUPLE"<<"\t\t\t\tNO";
}

Page | 46
if(obj.getroomno()==5)
{ f5=1;
cout<<"\n\n "<<"5"<<"\t\t\t"<<"COUPLE
LUXURY"<<"\t\t\tNO";
}
}
if(f1==0)
cout<<"\n\n
"<<"1"<<"\t\t\t"<<"GENERAL"<<"\t\t\t\tYes";
if(f2==0)
cout<<"\n\n
"<<"2"<<"\t\t\t"<<"DELUX"<<"\t\t\t\tYes";
if(f3==0)
cout<<"\n\n
"<<"3"<<"\t\t\t"<<"LUXURY"<<"\t\t\t\tYes";
if(f4==0)
cout<<"\n\n
"<<"4"<<"\t\t\t"<<"COUPLE"<<"\t\t\t\tYes";
if(f5==0)

Page | 47
cout<<"\n\n "<<"5"<<"\t\t\t"<<"COUPLE
LUXURY"<<"\t\t\tYes";
}
cout<<"\n\n\nPress any key to continue.....";
getch();
fin.close();
}

void hotel::edit()
{ clrscr();textcolor(WHITE); textbackground(YELLOW);
int choice;
int rn;

cout<<"\n****************************************
****************************************";
cout<<"\n\n\t\t\t\t EDIT MENU";

cout<<"\n\n**************************************
******************************************";
cout<<"\n\n\t\t\t\t1.Modify Record";
Page | 48
cout<<"\n\t\t\t\t2.Delete Record";
cout<<"\n\n\t\t\t\tEnter your choice: ";
cin>>choice;
clrscr();
cout<<"\n Enter your Room no.*" ;
cin>>rn;;
switch(choice)
{ case 1: modify(rn);
break;
case 2: delete_rec(rn);
break;
default: cout<<"\n Wrong Choice.....!!";
}
cout<<"\n Press any key to continue....!!!";
getch();
}
int hotel::check(int rn)
{ int e=0;

Page | 49
ifstream fin("rooms.dat",ios::in);
while(!fin.eof())
{ fin.read((char*)this,sizeof(hotel));
if(rno==rn)
{ e=1;
break;
}
}
fin.close();
return(e);
}

void hotel::modify(int rn)


{ long posi,e=0;textcolor(YELLOW);
fstream file("rooms.dat",ios::in|ios::out|ios::binary);
while(!file.eof())
{ posi=file.tellg();
file.read((char*)this,sizeof(hotel));

Page | 50
if(rno==rn)
{ clrscr();
cout<<"\t\t\tDETAILS OF THE ROOM";
cout<<"\n\t\t\t********************";
cout<<"\n\nRoom No.\t\t\t\tRoom Type";
cout<<"\n\n\n1\t\t\t\t\tGeneral";
cout<<"\n2\t\t\t\t\tDelux";
cout<<"\n3\t\t\t\t\tLuxury";
cout<<"\n4\t\t\t\t\tCouple";
cout<<"\n5\t\t\t\t\tCouple Luxury";

cout<<"\n****************************************
**************************";
cout<<"\n\t\t\tCustomer Name:"<<name;
cout<<"\n Enter New Details";
cout<<"\n\nEnter New Room no.: ";
cin>>rno;
cout<<"\nEnter New room type displayed
above:";
Page | 51
gets(type);
cout<<"\nEnter New Address:";
cin>>address;
cout<<"\nEnter New phone number:";
cin>>phone;
cout<<"\nEnter New Email ID:";
cin>>id;
cout<<"How many days do you want to
live???\n";
cin>>days;
if(rno==1)
{ r1();
price=800;
}
else if(rno==2)
{ r2();
price=1500;
}
else if(rno==3)
Page | 52
{ r3();
price=2500;
}
else if(rno==4)
{ r4();
price=3250;
}
else if(rno==5)
{ r5();
price=4500;
}
file.seekg(posi);
file.write((char*)this,sizeof(hotel));
cout<<"\n Your Record is modified....";
e=1;
break;
}
}

Page | 53
if(e==0)
cout<<"\n Sorry!! not found...!!";
file.close();
}
void hotel::delete_rec(int rn)
{ int e=0;textcolor(YELLOW);
char ch;
ifstream fin("rooms.dat",ios::in);
ofstream fout("temp.dat",ios::out);
while(!fin.eof())
{ fin.read((char*)this,sizeof(hotel));
if(rno==rn)
{ clrscr();

cout<<"\n****************************************
****************************************";
cout<<"\n\n\t\t\t\tDELETE RECORD";

Page | 54
cout<<"\n\n**************************************
******************************************";
cout<<"\n Room no.= "<<rno;
cout<<"\nCustomer Name:"<<name;
cout<<"\nCustomer address:"<<address;
cout<<"\nCustomer Phone number:"<<phone;
cout<<"\nRoom Type:"<<type;
cout<<"\nRoom Charge:Rs. "<<price<<" \\*";
cout<<"\nEmail ID:"<<id;
cout<<"\nNumber of days living:"<<days;
cout<<"\n\nDo you want to delete this
record(y/n): ";
cin>>ch;
if(ch=='n')
fout.write((char*)this,sizeof(hotel));
e=1;
}
else

Page | 55
fout.write((char*)this,sizeof(hotel));
}
fin.close();
fout.close();
if(e==0)
cout<<"\n Sorry!! not found ...";
else
{ remove("rooms.dat");
rename("temp.dat","rooms.dat");
}
}
void hotel::bill()
{ clrscr();textcolor(YELLOW);
int choice;
int rn;

cout<<"\n****************************************
****************************************";
cout<<"\n\n\t\t\t\t CUSTOMER BILL";
Page | 56
cout<<"\n\n**************************************
******************************************";
cout<<"\n\n\t\t\t\t1.Print Bill";
cout<<"\n\t\t\t\t2.Pay Bill";
cout<<"\n\n\n\t\t\t\t Enter your choice: ";
cin>>choice;
clrscr();
cout<<"\n Enter your Room no. " ;
cin>>rn;
switch(choice)
{ case 1: display_bill(rn);
break;
case 2: pay_bill(rn);
break;
default: cout<<"\n Wrong Choice.....";
}
cout<<"\n Press any key to continue....";
getch();
}
Page | 57
void hotel::pay_bill(int rn)
{ int e=0;
char ch;
ifstream fin("rooms.dat",ios::in);
ofstream fout("temp.dat",ios::out);
while(!fin.eof())
{ fin.read((char*)this,sizeof(hotel));
if(rno==rn)
{ clrscr(); textcolor(YELLOW);
bil=price*days;
ser=0.103*bil;
total=bil+ser;

cout<<"\n****************************************
****************************************";
cout<<"\n\n\t\t\t\t PAY BILL";

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

Page | 58
cout<<"\n\n Room no: "<<rno;
cout<<"\n Room Type:"<<type;
cout<<"\n Customer Name:"<<name;
cout<<"\n Customer Address:"<<address;
cout<<"\n Phone number:"<<phone;
cout<<"\n Email ID:"<<id;
cout<<"\n Number of days living:"<<days;
cout<<"\n Room charge:Rs."<<price<<" \\*";
cout<<"\n Service tax % =14.5%";
cout<<"\n Service tax= Rs."<<ser<< "\\*";
cout<<"\n\n\n Total bill you have to pay is
Rs."<<total<<" \\*";
cout<<"\n\n Are you sure you Pay your bill???
(y/n): ";
cin>>ch;
if(ch=='n')
fout.write((char*)this,sizeof(hotel));
e=1;
}
Page | 59
else
fout.write((char*)this,sizeof(hotel));
}
fin.close();
fout.close();
if(e==0)
cout<<"\n Sorry!! not found ...!!";
else textcolor(YELLOW);
{ cout<<"\nBill Paid.....";
cout<<"\n\t\t\t\t****Thank You****";
cout<<"\n\n\t\t\t\tCome Again";
remove("rooms.dat");
rename("temp.dat","rooms.dat");
}
}

void hotel::display_bill(int rn)


{ clrscr();textcolor(YELLOW);

Page | 60
ifstream fin("rooms.dat",ios::in);
int e;
while(!fin.eof())
{ fin.read((char*)this,sizeof(hotel));
if(rno==rn)
{ bil=price*days;
ser=0.103*bil;
total=bil+ser;
clrscr();

cout<<"\n****************************************
****************************************";
cout<<"\n\n\t\t\t\t PRINT BILL";

cout<<"\n\n**************************************
******************************************";
cout<<"\n\n Room no: "<<rno;
cout<<"\n Room Type: "<<type;
cout<<"\n Customer Name: "<<name;

Page | 61
cout<<"\n Customer Address: "<<address;
cout<<"\n Phone number: "<<phone;
cout<<"\n Email ID: "<<id;
cout<<"\n Number of days living: "<<days;
cout<<"\n Room Charge: Rs."<<price<<" \\*";
cout<<"\n Service tax % =14.5%";
cout<<"\n Service tax= Rs."<<ser<<" \\*";
cout<<"\n\n\n Total bill you have to pay is
Rs."<<total<<" \\*";
e=1;
break;
}
}
if(e==0)
cout<<"\n Sorry Room no. not found....\nPlease try
again";
getch();
fin.close();
}
Page | 62
void main()
{ textcolor(WHITE);
textbackground(YELLOW);
hotel h;
clrscr();

cout<<"******************************************
**************************************";
cout<<"\n>>>>>>>>>>>>>>>>>>>>> WELCOME TO
HOTEL MANAGEMENT PROGRAM
<<<<<<<<<<<<<<<<<<<<";

cout<<"\n****************************************
****************************************";
cout<<"\n\n\n\t\t\t\tTilak Public School";
cout<<"\n\n\n\n\n\n\n\t\t\tMade By Sandhya Prasad
cout<<"\n\n\n\t\t\t\t\t Press any key to continue....";
getch();
h.main_menu();
}

Page | 63
Page | 64
OUTPUT

Page | 65
Page | 66
Page | 67
LIMITATIONS

When there is a power cut


system cannot be used at that point.

It is slow compared to fast online booking.

Rooms cannot be book as per user’s


choice.

The room no. is not auto generated, it has


to be given from the admin login only via
vacant rooms.

Page | 68
IMPROVEMENT
The room no. can be auto
generated so that the admin
does not need to call the
function manually.

The type of room can be used for


different rates which allow the
user to have a variety of options,
the option should should be
given to the user to select from
the list.
Page | 69
CONCLUSION
Through this
program we can do
the basic of room
booking.
Although this may
prior to be a fault if there is a prier less
information or any power cut.
This is a user-friendly system. The coding
is down as per the need of the database
system. It is easy to operate and provides
information as in required. The user is
requested to follow the instructions
properly and not misuse it by providing
irrelevant information.

Page | 70
BIBLIOGRAPHY
BOOKS
• Computer science with C++ by
Sumita Arora.

WEB
programiz.com
 includehelp.com
 codescracker.com

Page | 71

You might also like