SR No Topic Page No: Index
SR No Topic Page No: Index
Sr No Topic Page No
1 INTRODUCTION 2
2 SOURCE CODE 4
3 OUTPUT 8
4 CONCLUSION 11
5 REFERENCES 11
1
INTRODUCTION
Let us try to understand a little about all these, through a simple example. Human Beings are
living forms, broadly categorized into two types, Male and Female. Right? Its true. Every
Human being(Male or Female) has two legs, two hands, two eyes, one nose, one heart etc.
There are body parts that are common for Male and Female, but then there are some specific
body parts, present in a Male which are not present in a Female, and some body parts present
in Female but not in Males. All Human Beings walk, eat, see, talk, hear etc. Now again, both
Male and Female, performs some common functions, but there are some specifics to both,
which is not valid for the other. For example: A Female can give birth, while a Male cannot,
so this is only for the Female. Human Anatomy is interesting, isn't it? But let's see how all
this is related to C++ and OOPS. Here we will try to explain all the OOPS concepts through
this example and later we will have the technical definatons for all this.
2
There are a few principle concepts that form the foundation of object
oriented programming −
Object
This is the basic unit of object oriented programming. That is both data and function that
operate on data are bundled as a unit called as object.
Class
When you define a class, you define a blueprint for an object. This doesn't actually define any
data, but it does define what the class name means, that is, what an object of the class
will consist of and what operations can be performed on such an object.
Abstraction
Data abstraction refers to, providing only essential information to the outside world and
hiding their background details, i.e., to represent the needed information in program without
presenting the details. For example, a database system hides certain details of how data is
stored and created and maintained
Similar way, C++ classes provides different methods to the outside world without
giving internal detail about those methods and data.
Encapsulation
Encapsulation is placing the data and the functions that work on that data in the same place.
While working with procedural languages, it is not always clear which functions work on
which variables but object-oriented programming provides you framework to place the data
and the relevant functions together in the same object.
Inheritance
One of the most useful aspects of object-oriented programming is code reusability. As the
name suggests Inheritance is the process of forming a new class from an existing class that is
from the existing class called as base class, new class is formed called as derived class. This
is a very important concept of object-oriented programming since this feature helps to reduce
the code size.
Polymorphism
The ability to use an operator or function in different ways in other words giving different
meaning or functions to the operators or functions is called polymorphism. Poly refers to
many. That is a single function or an operator functioning in many ways different upon the
usage is called polymorphism.
Overloading
The concept of overloading is also a branch of polymorphism. When the exiting operator or
function ismade to operate on new data type, it is said to be overloaded
3
SOURCE CODE
#include<iostream.h>
#include<conio.h>
#include<string.h>
#include<stdio.h>
#include<process.h>
class hotel
{
public:
int mobile,rno;
char name[10],gen;
char bs[10],ds[10];
void accept()
{
cout<<"\n Enter your Name:";
cin>>name;
cout<<"\n Enter Your Mobile Number:";
cin>>mobile;
cout<<"\n Enter your Gender(M/F)";
cin>>gen;
cout<<"\n Enter a Type Of Room:";
cin>>bs;
cout<<"\n Enter Room Price To Have:";
cin>>ds;
}
void display()
{
cout<<"\n Name="<<name;
cout<<"\n mobile="<<mobile;
cout<<"\n Gender="<<gen;
cout<<"\n Type of Room="<<bs;
cout<<"\n Room Price To Have="<<ds;
}
};
void accept1()
{
cout<<"\n Ac Rooms";
cout<<"\n from 1-31";
cout<<"\n Starting from Rooms 10000rs";
cout<<"\n*****************************";
4
cout<<"\n Non-Ac Rooms";
cout<<"\n from 32-45";
cout<<"\n Starting from Rooms 5000rs";
cout<<"\n******************************";
cout<<"\n Luxury Rooms";
cout<<"\n from 46-60";
cout<<"\n Starting from Rooms 20000rs";
cout<<"\n******************************";
cout<<"\n Ordinary Rooms";
cout<<"\n from 61-75";
cout<<"\n Starting from Rooms 2000rs";
cout<<"\n******************************";
cout<<"\n regular rooms";
cout<<"\n from 76-100";
cout<<"\n Starting from Rooms 1000rs";
cout<<"\n******************************";
}
};
void main()
{
second s;
int ch,a[10],n,i,b,flag=0,acc,c,p;
char ch1,ch2,ch3;
do
{
clrscr();
cout<<"\n \n \t \t \t Taj Hotel";
cout<<"\n Main Menu:";
cout<<"\n 1.Room Details";
cout<<"\n 2.Booking A Room.";
cout<<"\n 3.Edit Records.";
cout<<"\n 4.Room Canceling.";
cout<<"\n 5.Exit.";
cout<<"\n Enter your Choice";
cin>>ch;
switch(ch)
{
case 1:
cout<<"\n \t \t\t ---Room Details---";
s.accept1();
break;
case 2:
cout<<"\n \t \t \t Booking a Room: ";
cout<<"\n \t Enter Number of Rooms To Reserve:";
cin>>n;
s.rno=1;
for(i=0;i<n;i++)
{
5
s.accept();
s.display();
cout<<"\n \t \t ---Your Room is Booked---";
6
}
else
{
flag=0;
p--;
}
}
if(flag==1)
{
cout<<"\n Your Room is Cancel.";
cout<<"\n Enter Your Bank Account Number:";
cin>>acc;
cout<<"\n --your Payment Transfer directly in your bank account.--";
}
else
{
cout<<"\n **Wrong Room Number**";
p--;
}
break;
case 5:
exit(0);
}
cout<<"\n Do you want to enter another Choice(y/n)";
ch3=getche();
}while(ch3=='y');
getch();
}
7
OUTPUT
8
9
10
CONCLUSION
In this project, we have covered how to build Hotel Management System Project and manage
information of rooms, guests etc.. using C++ programming language.
This hotel management has been developed to meet all the processing requirements which are
needed within the hotel industry. This system will allow the hotel reception department to
manage all the records of their customers and their payment in easy manner.
REFERENCES
Hotel Management System C++ Project | Code with C
Hotel Management System Project Using C++ Language (rrtutors.com)
11