In: Computer Science
using c++ You have been contracted to build a hotel reservation system. This is the system that hotel desk clerks will use to take desk reservations.
Assumptions: This is acting as though the only reservations taken are at the desk. All reservations are for one night. The hotel is empty when you start the program.
First, this program will give the full inventory of rooms in the hotel.
Total rooms: 122
There are four types of rooms with these prices:
Second, the program will allow for a room to be reserved for one night. The program will keep track of the inventory as rooms are being reserved.
Third, the program will keep track of revenue brought in for the day from reserved rooms.
Fourth, the user can choose a getTotal() function that will display remaining room inventory, what was reserved and revenue generated for the day.
PLEASE NOTE: This project must incorporate a class friend or class inheritance structure.
#include<iostream>
using namespace std;
class hotel
{
public:
int totalrooms=112;
int Standard_Rooms_Courtyard = 70;
int Standard_Room_Scenic = 35;
int Deluxe_Suite = 15;
int Penthouse = 2;
void getTotal()
{
cout<<totalrooms<<": Total remaining rooms\n"<<Standard_Rooms_Courtyard
<<": Standard_Rooms_Courtyard \n"<<Standard_Room_Scenic<<": Standard_Room_Scenic \n"
<<Deluxe_Suite<<": Deluxe_Suite \n"<<Penthouse<<": Penthouse\n";
}
};
class price : public hotel
{
public:
float Standard_Rooms_Courtyard = 125;
float Standard_Room_Scenic = 145;
float Deluxe_Suite = 350;
float Penthouse = 1135;
float netprice=0;
void getTotal()
{
cout<<"\nnetprice: "<<netprice;
}
void booking()
{
cout<<"\nPlease enter your choice\n1. Standard Rooms, Courtyard - 70 - $125 a night\n2. Standard Room, Scenic - 35 - $145 a night\n3. Deluxe Suite - 15 - $350 a night\n4. Penthouse - 2 - $1135 a night\n";
int choice;
booking:
cin>>choice;
switch(choice)
{
case 1:hotel::Standard_Rooms_Courtyard--;
netprice+=Standard_Rooms_Courtyard;
hotel::totalrooms--;
break;
case 2:hotel::Standard_Room_Scenic--;
netprice+=Standard_Room_Scenic;
hotel::totalrooms--;
break;
case 3:hotel::Deluxe_Suite--;
netprice+=Deluxe_Suite;
hotel::totalrooms--;
break;
case 4:hotel::Penthouse--;
netprice+=Penthouse;
hotel::totalrooms--;
break;
default :cout<<"\nthat was a wrong choice\nplease try again\n";
goto booking;
break;
}
}
};
int main()
{
price p;
start:
cout<<"\nPlease select you choice\n";
cout<<"\n1. Hotel booking\n2. total remaining rooms\n3. netprice\n0. Exit";
int choice;
cin>>choice;
switch(choice)
{
case 0:break;
case 1:p.booking();
goto start;
break;
case 2:p.hotel::getTotal();
goto start;
break;
case 3:p.getTotal();
goto start;
break;
default :cout<<"\nthat was a wrong choice\nplease try again\n";
goto start;
break;
}
}
I hope it helps.