C++ Programming: Create a class called Reservation that holds reservations of cu
ID: 3879634 • Letter: C
Question
C++ Programming:
Create a class called Reservation that holds reservations of customers. Customers must be assigned rooms during reservation. Assume that a customer can reserve only one room for a given date. The class will have the following data members:
- Reservation number ( int)
- Customer ( of type Customer)
- Room ( of type Room)
- Customer arrival date to the hotel ( of type Date)
- Requested duration of the stay in number of nights (integer)
The class should have at least the following member functions:
- One or more constructors
- Assigning a room to a customer
- Returning the room number
- Returning the customer name
- A function that prints information about a reservation
- A destructor
Create a driver to test the class Reservation.
Explanation / Answer
#include //#include > day >> month >> year; } int getday() { return day; } int getmonth() { return month; } int getyear() { return year; } }; class Reservation { static int id=0; // how to increment id ? date Date; int periodDay; int RoomID; //Rooms state; //why error ?? // Rooms roomID; //need to be defult & set public: //friend Rooms; //friend Hotel; Reservation() { Date.defaultset(); periodDay = 7; //RoomID = state.id; } ~Reservation() { id++; }; }; class Rooms { int id; int floor; float price; //Reservation state; int reserved; public: Rooms() { id = 0; floor = 3; price = 150.05; //reserved = (state.id > 0); } //friend Reservation; //friend Hotel; }; class Hotel { int n, m; int id; int floors; Reservation *reserve; Rooms *room; public: //friend Rooms; //friend Reservation; /*reserve = new Reservation[n] ; room = new Rooms[m];*/ };Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.