Question
Define a class with name Date to store a date with(this part already done i put it for info skip to the next class task):
Define a class with name Date to store a date with(this part already done i put it for info skip to the next class task):
- three private short unsigned integer attributes day, month and year.
- a public overloaded constructor to initialise a date.
- a public overloaded binary member operator + with a positive integer n of days as parameter, which creates a new date object as result, which is n days later than the stored date (examples: 2022-12-16 + 3 days should return 2022-12-19 as result, 2022-12-31 + 1 day as return 2023-01-01, 2023-01-27 + 7 days as return 2023-02-03; see examples below). Note: for simplicity, the value of n should be a maximum of 28 days (4 weeks). For the implementation of the member operator +, a constant class variable array daysInMonth may be helpful, in which the number of days is stored for each month; leap years can be ignored.
-an overloaded friend input and output operator, where a date in above shown ISO-8601 date format shall be read and written respectively.
Define a C++ enumeration (enum struct) with :
-values for no_meals, breakfast, half_board and all_inclusive.
-Define an overloaded binary output operator that writes breakfast, half board, all inclusive or otherwise no meals onto the character output data stream passed as a parameter depending on the enumeration value.
-Define a function get_price with an object of this enumeration as parameter and a floating point number as return. In the body, the price for a breakfast, which costs the same in all accommodations, in the amount of 10 EUR shall be returned, for half board 20 EUR, for all-inclusive 50 EUR (each per person) and otherwise 0 EUR.
Define a class with name Accomodation with following members:
a private attribute of type C++ string for the location of the accomodation.
a private attribute of type Date for the arrival at the accomodation.
three private integer attributes nights for the number of to book nights, singles for the number of to book single rooms and doubles for the number of to book double rooms.
three private real-valued attributes priceNightSingle for the price of a single room for one night, priceNightDouble for the price of a double room one night and priceOneDayParking for the price of a parking place one day.
a private attribute of type Board for the desired board.
a private Boolean attribute with name parking for an additionally to book parking place.
a public constructor with three parameters for the price of a single room per night, a double room per night and a parking place per night/day. In the body, only the member function ask_data shall be called, via which all other data can be entered and saved..
a public destructor outputting a message like shown in the examples below.
a public member function with name get_arrival without parameter returning the arrival date.
a public member function with name get_checkout without parameter returning the departure date (arrival date plus number of nights added by above defined operator in class Date).
xxxxa public member function with name get_guests without parameter returning the number of sleeping guests, e.g. 1 for a booked single room, 4 for two double rooms or 9 for three single and three double rooms booked.
a public member function with name get_price without parameters that returns the total number of overnight guests. In the body, add one person for to book single rooms and two persons for to book double rooms, for example 4 for two double rooms or 8 for two single and three double rooms.
a public member function with name ask_data without parameters and without return. In the body, as in the examples below, the location for the accommodation should be requested and initialised, the arrival date and the number of nights (a maximum of 28 nights/4 weeks should be possible to book), how many single and double rooms, what board and whether a parking place should be reserved. Finally, output the calculated price (via a call to get_price()).
a public member function with name print without parameters and without return. In the body, as in the example below, write the location of the accommodation to be reserved onto the standard character output stream, the number of guests and nights, the arrival and departure dates, the number of single and double rooms to book each with the price for one night in brackets behind it, the meals to book with the price for one person and one day in brackets behind it, as well as for a parking place to be reserved and finally the calculated price.
Define a class for a desired reservation Request for an accomodation with following members:
a private constant unsigned integer attribute no for a call center uniquely and consecutively assigned request number for each reservation request.
a private static unsigned integer class variable with name lastNo to store a sequential number for each reservation request, which is incremented each time a new object of this class is created, which initialises the respective attribute no and thus implements the unique, identifying number of all objects. This static class variable is to be initialised with value 0 - outside the class.
a private pointer attribute accomodation for this reservation request.
a private pointer attribute next to generate a list of reservation requests.
a public constructor with a pointer to an accommodation of type Accomodation and a default pointer parameter of type Request with default value null pointer. Initialise the number no of this request with the value of the incremented class attribute lastNo and the other two attributes with the respective parameters.
a public destructor that also deletes the reservation request and makes a corresponding output as in the example below.
a public member function with name get_no without parameter returning the number of the trip.
a public member function with name get_next without parameter returning a pointer to the next reservation request within the list.
a public member function with name set_next and a pointer to a reservation request as parameter assigning it as next request within the list.
a public member function with name get_price without parameter returning the calculated price of the accomodation
a public member function with name print without parameter or return value that writes the number of the request and the desired accommodation to the standard character output stream (see example below).
Define a class with name CallCenter with following members:
a private pointer attribute requests as head of a list of accomodation requests in this call center.
a public standard constructor initialising the head of the list with a null pointer.
a public method with name append with a pointer to a reservation request as parameter without return inserting it at the end of the list of requests.
a public method with name cancel with a pointer to a reservation request as parameter without return deleting this request from the list.
a public method with name get_request with a number as parameter searching for the reservation request with this number and returning a pointer to it or otherwise a null pointer.
a public method with name print_all without parameter or return outputting all reservation requests within the list (see example below).
Task main
The call center is in start phase, therefore only a few functionalities shall be offered. Define in function main an object of class CallCenter as well as further variables you need. Implement following small menue:
1.Create a new reservation request on the heap for a standard accommodation with 80.00 EUR/night for a single room, 150.00 EUR/night for a double room and 10.00 EUR/day for a parking place and append it at the end of the list of all requests of the call center.
2.Create a new reservation request on the heap for a superior accommodation with 110.00 EUR/night for a single room, 210.00 EUR/night for a double room and 10.00 EUR/day for a parking place and append it at the end of the list of all requests of the call center.
3.Enter a reservation request number, search for it, output it - if found - and optionally delete it from the list of all requests (see example below).
4.Output of all reservation requests within the list of the call center.
Example Program Run
CALL CENTER BOOKING REQUEST 0 end 1 new reservation request standard 2 new reservation request superior 3 show reservation request 4 show all reservation requests your choice: 4 CALL CENTER BOOKING REQUEST 0 end 1 new reservation request standard 2 new reservation request superior 3 show reservation request 4 show all reservation requests your choice: 1 location of accomodation: Duisburg arrival on (yyyy-mm-dd): 2022-12-16 how many nights (maximum 4 weeks): 3 how many single bed rooms (80.00 EUR/night): 1 how many double bed rooms (150.00 EUR/night): 0 a all inclusive (50.00 EUR/day) b breakfast (10.00 EUR/day) h half board (20.00 EUR/day) n no meals your choice: h with parking place (10.00 EUR/day; y(es) or n(o)): y price: 330.00 EUR CALL CENTER BOOKING REQUEST 0 end 1 new reservation request standard 2 new reservation request superior 3 show reservation request 4 show all reservation requests your choice: 4 ********REQUEST NO: 1******** accomodation at: Duisburg number of guests: 1 number of nights: 3 check-in date: 2022-12-16 check-out date: 2022-12-19 single bed room(s): 1 (80.00 EUR/night) double bed room(s): 0 (150.00 EUR/night) board: half board (20.00 EUR/day and person) parking: included (10.00 EUR/day) price accomodation: 330.00 EUR CALL CENTER BOOKING REQUEST 0 end 1 new reservation request standard 2 new reservation request superior 3 show reservation request 4 show all reservation requests your choice: 2 location of accomodation: Essen arrival on (yyyy-mm-dd): 2022-12-31 how many nights (maximum 4 weeks): 1 how many single bed rooms (110.00 EUR/night): 0 how many double bed rooms (210.00 EUR/night): 3 a all inclusive (50.00 EUR/day) b breakfast (10.00 EUR/day) h half board (20.00 EUR/day) n no meals your choice: a with parking place (10.00 EUR/day; y(es) or n(o)): y price: 940.00 EUR CALL CENTER BOOKING REQUEST 0 end 1 new reservation request standard 2 new reservation request superior 3 show reservation request 4 show all reservation requests your choice: 1 location of accomodation: Berlin arrival on (yyyy-mm-dd): 2023-01-27 how many nights (maximum 4 weeks): 7 how many single bed rooms (80.00 EUR/night): 5 how many double bed rooms (150.00 EUR/night): 0 a all inclusive (50.00 EUR/day) b breakfast (10.00 EUR/day) h half board (20.00 EUR/day) n no meals your choice: b with parking place (10.00 EUR/day; y(es) or n(o)): n price: 3150.00 EUR CALL CENTER BOOKING REQUEST 0 end 1 new reservation request standard 2 new reservation request superior 3 show reservation request 4 show all reservation requests your choice: 4 ********REQUEST NO: 1******** accomodation at: Duisburg number of guests: 1 number of nights: 3 check-in date: 2022-12-16 check-out date: 2022-12-19 single bed room(s): 1 (80.00 EUR/night) double bed room(s): 0 (150.00 EUR/night) board: half board (20.00 EUR/day and person) parking: included (10.00 EUR/day) price accomodation: 330.00 EUR ********REQUEST NO: 2******** accomodation at: Essen number of guests: 6 number of nights: 1 check-in date: 2022-12-31 check-out date: 2023-01-01 single bed room(s): 0 (110.00 EUR/night) double bed room(s): 3 (210.00 EUR/night) board: all inclusive (20.00 EUR/day and person) parking: included (10.00 EUR/day) price accomodation: 940.00 EUR ********REQUEST NO: 3******** accomodation at: Berlin number of guests: 5 number of nights: 7 check-in date: 2023-01-27 check-out date: 2023-02-03 single bed room(s): 5 (80.00 EUR/night) double bed room(s): 0 (150.00 EUR/night) board: breakfast (20.00 EUR/day and person) parking: no parking place booked price accomodation: 3150.00 EUR
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started