Question: Q3. (25 marks) Create a class called Reservation that holds reservations of customers. Customers must be assigned rooms during reservation. Assume that a customer can
Q3. (25 marks) 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
these are the headers of Date, customer, and room
#ifndef DATE_H_ #define DATE_H_
#include
using namespace std;
class Date
{
private :
int day;
int month;
int year;
public:
Date() ;
Date(int d,int m,int y) {
this->day=d;
this->month=m;
this->year=y;
}
void setDate(int d,int m,int y)
{
this->day=d;
this->month=m;
this->year=y;
}
int getDay()
{
return day;
}
int getMonth()
{
return month;
}
int getYear()
{
return year;
}
};
#endif /* DATE_H_ */
#ifndef CUSTOMER_H_ #define CUSTOMER_H_
#include
using namespace std;
class Customer
{
private :
string Name;
string Address;
string Tel;
Date dob;
public :
string getName(); void setName(string name);
string getAddress(); void setAddress(string address);
string getTel(); void setTel(string tel);
Date getDateOfBirth(); void setDateOfBirth(Date dob) ;
void changeDetails(); void printDetails();
~Customer();
};
#endif /* CUSTOMER_H_ */
#ifndef ROOM_H_ #define ROOM_H_
#include
class Room {
private:
int roomNum;
string roomType;
bool available;
public:
Room();
Room(int number, string type, bool Available);
bool Available();
string getType();
int getNumber();
void print();
~Room() {}
};
#endif /* ROOM_H_ */
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
