C++ Hotel Management System Class 12th
Sure! I can help you with a basic implementation of a hotel management system in C++. Here's an example code that demonstrates the basic functionality:
#include <iostream>
#include <string>
using namespace std;
class Hotel {
private:
string hotelName;
int roomCount;
int* roomNumbers;
string* guestNames;
public:
Hotel(string name, int count) {
hotelName = name;
roomCount = count;
roomNumbers = new int[roomCount];
guestNames = new string[roomCount];
}
~Hotel() {
delete[] roomNumbers;
delete[] guestNames;
}
void checkIn(int roomNumber, string guestName) {
for (int i = 0; i < roomCount; i++) {
if (roomNumbers[i] == 0) {
roomNumbers[i] = roomNumber;
guestNames[i] = guestName;
cout << "Guest " << guestName << " checked into room " << roomNumber << "." << endl;
return;
}
}
cout << "No available rooms." << endl;
}
void checkOut(int roomNumber) {
for (int i = 0; i < roomCount; i++) {
if (roomNumbers[i] == roomNumber) {
cout << "Guest " << guestNames[i] << " checked out of room " << roomNumber << "." << endl;
roomNumbers[i] = 0;
guestNames[i] = "";
return;
}
}
cout << "Room " << roomNumber << " is not occupied." << endl;
}
void displayGuests() {
cout << "Guests currently checked in:" << endl;
for (int i = 0; i < roomCount; i++) {
if (roomNumbers[i] != 0) {
cout << "Room " << roomNumbers[i] << ": " << guestNames[i] << endl;
}
}
}
};
int main() {
Hotel hotel("Grand Hotel", 10);
hotel.checkIn(101, "John");
hotel.checkIn(102, "Alice");
hotel.checkIn(103, "Bob");
hotel.displayGuests();
hotel.checkOut(102);
hotel.displayGuests();
hotel.checkIn(104, "Jane");
hotel.displayGuests();
return 0;
}
#include <string>
using namespace std;
class Hotel {
private:
string hotelName;
int roomCount;
int* roomNumbers;
string* guestNames;
public:
Hotel(string name, int count) {
hotelName = name;
roomCount = count;
roomNumbers = new int[roomCount];
guestNames = new string[roomCount];
}
~Hotel() {
delete[] roomNumbers;
delete[] guestNames;
}
void checkIn(int roomNumber, string guestName) {
for (int i = 0; i < roomCount; i++) {
if (roomNumbers[i] == 0) {
roomNumbers[i] = roomNumber;
guestNames[i] = guestName;
cout << "Guest " << guestName << " checked into room " << roomNumber << "." << endl;
return;
}
}
cout << "No available rooms." << endl;
}
void checkOut(int roomNumber) {
for (int i = 0; i < roomCount; i++) {
if (roomNumbers[i] == roomNumber) {
cout << "Guest " << guestNames[i] << " checked out of room " << roomNumber << "." << endl;
roomNumbers[i] = 0;
guestNames[i] = "";
return;
}
}
cout << "Room " << roomNumber << " is not occupied." << endl;
}
void displayGuests() {
cout << "Guests currently checked in:" << endl;
for (int i = 0; i < roomCount; i++) {
if (roomNumbers[i] != 0) {
cout << "Room " << roomNumbers[i] << ": " << guestNames[i] << endl;
}
}
}
};
int main() {
Hotel hotel("Grand Hotel", 10);
hotel.checkIn(101, "John");
hotel.checkIn(102, "Alice");
hotel.checkIn(103, "Bob");
hotel.displayGuests();
hotel.checkOut(102);
hotel.displayGuests();
hotel.checkIn(104, "Jane");
hotel.displayGuests();
return 0;
}
In this example, we have a Hotel class that manages room occupancy. The Hotel class has private member variables for the hotel name, the number of rooms, an array to store room numbers, and an array to store guest names. The checkIn method allows guests to check into available rooms, the checkOut method allows guests to check out of their rooms, and the displayGuests method displays a list of currently occupied rooms along with the corresponding guest names.
In the main function, we create an instance of the Hotel class and demonstrate how to check guests in and out and display the current occupancy.
Please note that this is a basic implementation for demonstration purposes. In a real-world scenario, you would likely have additional functionality, such as handling multiple hotels, storing guest information, handling reservations, etc.
In the main function, we create an instance of the Hotel class and demonstrate how to check guests in and out and display the current occupancy.
Please note that this is a basic implementation for demonstration purposes. In a real-world scenario, you would likely have additional functionality, such as handling multiple hotels, storing guest information, handling reservations, etc.
The objective of this project is to understand the concept and theories clearly behind the hotel management system. It helps in gaining some practical knowledge and experience about various aspects of management.
Content and language used in this project is very easy. Emphasis is laid on comprehension of concepts and principles behind the project. I have taken care of clarity of expressions and logical organization of concepts.
This project is segmented into fairly short sections and is adequately illustrated with an introduction that establishes the context for the subject matter to be discovered. Important concepts, definitions, equations are either bold faced, italicized or highlighted to draw needed attention.
I remember with gratitude the encouragement provided by my teachers, parents and friends. I welcome suggestion for improvement.
Content and language used in this project is very easy. Emphasis is laid on comprehension of concepts and principles behind the project. I have taken care of clarity of expressions and logical organization of concepts.
This project is segmented into fairly short sections and is adequately illustrated with an introduction that establishes the context for the subject matter to be discovered. Important concepts, definitions, equations are either bold faced, italicized or highlighted to draw needed attention.
I remember with gratitude the encouragement provided by my teachers, parents and friends. I welcome suggestion for improvement.
HOTEL MANAGEMENT
Introduction
I hereby present a project on the topic hotel management. This project presents a way to track check-ins and check-outs of the hotel. It also shows the guest the features of the hotel and the hotel rooms. It calculates the bills of the guests, their expenditures concerning the hotel. Hence this serves as a powerful technological tool related to the comforts of the guests.
System Requirements:-
HOTEL MANAGEMENT//*********************************************** // PROJECT HOTEL-MANAGEMENT //*********************************************** //**************************** // INCLUDED HEADER FILES //**************************** #include"graf.cpp" #include<iostream .h> #include<conio .h> #include<string .h> #include<graphics .h> #include<dos .h> #include<stdio .h> #include<fstream .h> #include<iomanip .h> #include<stdlib .h> //******************************************** // THIS CLASS CONTAINS FUNTIONS FOR FOOD //******************************************** }; //***************************************************** // FUNCTION FOR DISPLAYING FOOD MENU //***************************************************** //***************************** // FUNCTION FOR FOOD BILL //***************************** void food::food_bill() { double bill=-1; char c_name[20],f_name[20]; int dt; cleardevice(); setfillstyle(7,1); floodfill(0,0,4); setfillstyle(7,10); bar(17,40,605,420); rectangle(17,40,605,420); setfillstyle(1,7); bar(24,47,598,413); rectangle(24,47,598,413); setcolor(4); settextstyle(7,0,1); outtextxy(30,70,"ENTER CUSTOMER NAME "); gotoxy(50,6); cin>>c_name; outtextxy(30,120,"ENTER ITEM NAME TAKEN"); gotoxy(50,9); cin>>f_name; outtextxy(30,170,"ENTER THE QUANTITY"); gotoxy(50,12); cin>>dt; p1.close(); p1.open("food.txt",ios::in|ios::binary); while(p1.read((char*)&f,sizeof(f))) |
Download html file
|