Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

In C++ language please! Via Rail has daily passenger service from Montreal to Toronto. This service has several stops, which are Montreal, Dorval, Brockville, Kingston,

image text in transcribedimage text in transcribedimage text in transcribedIn C++ language please!

image text in transcribed
image text in transcribed
image text in transcribed
Via Rail has daily passenger service from Montreal to Toronto. This service has several stops, which are Montreal, Dorval, Brockville, Kingston, Belleville, Toronto. A passenger may travel between any two stops, for example from Montreal to Kingston, or Brockville to ving classes to manage the passenger reservation system of Via Rail for this route. Include one or more constructors, destructor and the necessary set and get functions for each class. Also, provide a print function for each class, which outputs all the data members of that class. a) Define a class Date that has the following data members: month, day and year. b) Define a class Passenger with the following data members: The name of the passenger as a standard library string. The date of birth of the passenger (from part a). An array that stores reservation request numbers. A passenger is allowed to book up to 5 trips each being assigned a different request number. c) Define a Reservation Request class with the following data members, A Passenger object from part (b). An integer counter that generates reservation request numbers. An integer variable as a reservation request number. The counter is incremented by one each time a reservation request object is created, then this value is assigned as the reservation request number to a data member. Travelling date from part (a). Start station of the trip. Destination station of the trip. Number of seats requested by the passenger, which may be 1 to 4. h) Detine a class Reservation Manager with the following data members, Towel Variable capacity that specifies the number of seats in the train Varabiahat specifies the number of stations on the route A two-dimensional city number of stations array of gene for Forvation table This array isina.co to zero, which indicate that all the ev e Whana seat is assigned to a passenger than the servation number is stored at the array locations corresponding to the travel except the destination station The following four shows Montreal Toronto route and station numbers The following two some semp r e and the table to the fing of the reservation table in the reservation table aquest number is not stored at the destination station of the multiple seats are requested for a reservation, reservation request number should be stored in al the seats. Request no Destination Start Munt Du Kingston Belevile EE SOLO s Any of other Anwy oposte perssenger At least the following additional member functions should be provided, A member function that processes a reservation request received as a parameter Reservation will be successful ifratare able for all the p e rs in the group for the entire trip. If reservation is successful it should return reservation request number otherwise zero. If reservation is successful, reservation object should be inserted to the reservation request array, otherwise should be deleted. If reservation is successful, you should check if this passenger is on the passenger array, if not passenger should be stored in this array. The reservation number should be added to the passenger object A member function that receives a reservation request number as a parameter and outputs the details of the reservation. A member function that receives a reservation request number and cancels reservation request. A member function that deletes all reservation requests after the travel date. A member function that deletes old reservation requests of a passenger. - i) A main function that creates Passenger objects and Reservation Requests objects. It calls to the Reservation Manager member functions to process all Reservation Request tasks. Key Considerations for the assignment: . You must enforce encapsulation by keeping all data members private. Passenger and Reservation Request objects should be created using dynamic memory allocation and the objects that arenot needed anymore should be deleted. There should be an output statement confirming the deletion of an object from the destructor function. In the implemented member functions the relevant data members should be updated. You need to make sure that your classes are well defined using the various concepts seen in the class including constant member functions, static members, inline functions, etc. Via Rail has daily passenger service from Montreal to Toronto. This service has several stops, which are Montreal, Dorval, Brockville, Kingston, Belleville, Toronto. A passenger may travel between any two stops, for example from Montreal to Kingston, or Brockville to Belleville. Define the following classes to manage the passenger reservation system of Via Rail for this route. Include one or more constructors, destructor and the necessary set and get functions for each class. Also, provide a print function for each class, which outputs all the data members of that class. a) Define a class Date that has the following data members: month, day and year. b) Define a class Passenger with the following data members: The name of the passenger as a standard library string. The date of birth of the passenger (from part a). An array that stores reservation request numbers. A passenger is allowed to book up to 5 trips each being assigned a different request number. c) Define a Reservation Request class with the following data members, A Passenger object from part (b). An integer counter that generates reservation request numbers. An integer variable as a reservation request number. The counter is incremented by one each time a reservation request object is created, then this value is assigned as the reservation request number to a data member. Travelling date from part (a). Start station of the trip. Destination station of the trip. Number of seats requested by the passenger, which may be 1 to 4. h) Define a class Reservation Manager with the following data members, Travel date. Variable capacity that specifies the number of seats in the train. Variable that specifies the number of stations on the route A two-dimensional (capacity number of stations) array of integers for reservation table. This array is initialized to zero, which indicates that all the seats are available. When a seat is assigned to a passenger, then the reservation request number is stored at the array locations corresponding to the travel except the destination station.. The following figure shows Montreal-Toronto route and station numbers. The following table shows some example passenger reservations and the table below the filling of the reservation table. In the reservation table, request number is not stored at the destination station of the trip. If multiple seats are requested for a reservation, reservation request number should be stored in all the seats. No of passengers Request no 145 146 147 Start Montreal Montreal Dorval Kingston Belleville Destination Brockville Toronto Kingston Toronto Toronto 148 150 Belleville Toronto Seat no Montreal 145 Brockville 0 146 Dorval 145 146 147 0 0 146 Kingston O 146 148 148 0 147 0 148 148 0 ooooo 0 An array of pointers to the reservation request objects An array of pointers to the passengers. At least the following additional member functions should be provided, A member function that processes a reservation request received as a parameter Reservation will be successful, if seats are available for all the passengers in the group for the entire trip. If reservation is successful it should return reservation request number otherwise zero. If reservation is successful, reservation object should be inserted to the reservation request array, otherwise should be deleted. If reservation is successful, you should check if this passenger is on the passenger array, if not passenger should be stored in this array. The reservation number should be added to the passenger object A member function that receives a reservation request number as a parameter and outputs the details of the reservation. A member function that receives a reservation request number and cancels reservation request. A member function that deletes all reservation requests after the travel date. A member function that deletes old reservation requests of a passenger. - i) A main function that creates Passenger objects and Reservation Requests objects. It calls to the Reservation Manager member functions to process all Reservation Request tasks. Key Considerations for the assignment: . You must enforce encapsulation by keeping all data members private. Passenger and Reservation Request objects should be created using dynamic memory allocation and the objects that arenot needed anymore should be deleted. There should be an output statement confirming the deletion of an object from the destructor function. In the implemented member functions the relevant data members should be updated. You need to make sure that your classes are well defined using the various concepts seen in the class including constant member functions, static members, inline functions, etc. Via Rail has daily passenger service from Montreal to Toronto. This service has several stops, which are Montreal, Dorval, Brockville, Kingston, Belleville, Toronto. A passenger may travel between any two stops, for example from Montreal to Kingston, or Brockville to ving classes to manage the passenger reservation system of Via Rail for this route. Include one or more constructors, destructor and the necessary set and get functions for each class. Also, provide a print function for each class, which outputs all the data members of that class. a) Define a class Date that has the following data members: month, day and year. b) Define a class Passenger with the following data members: The name of the passenger as a standard library string. The date of birth of the passenger (from part a). An array that stores reservation request numbers. A passenger is allowed to book up to 5 trips each being assigned a different request number. c) Define a Reservation Request class with the following data members, A Passenger object from part (b). An integer counter that generates reservation request numbers. An integer variable as a reservation request number. The counter is incremented by one each time a reservation request object is created, then this value is assigned as the reservation request number to a data member. Travelling date from part (a). Start station of the trip. Destination station of the trip. Number of seats requested by the passenger, which may be 1 to 4. h) Detine a class Reservation Manager with the following data members, Towel Variable capacity that specifies the number of seats in the train Varabiahat specifies the number of stations on the route A two-dimensional city number of stations array of gene for Forvation table This array isina.co to zero, which indicate that all the ev e Whana seat is assigned to a passenger than the servation number is stored at the array locations corresponding to the travel except the destination station The following four shows Montreal Toronto route and station numbers The following two some semp r e and the table to the fing of the reservation table in the reservation table aquest number is not stored at the destination station of the multiple seats are requested for a reservation, reservation request number should be stored in al the seats. Request no Destination Start Munt Du Kingston Belevile EE SOLO s Any of other Anwy oposte perssenger At least the following additional member functions should be provided, A member function that processes a reservation request received as a parameter Reservation will be successful ifratare able for all the p e rs in the group for the entire trip. If reservation is successful it should return reservation request number otherwise zero. If reservation is successful, reservation object should be inserted to the reservation request array, otherwise should be deleted. If reservation is successful, you should check if this passenger is on the passenger array, if not passenger should be stored in this array. The reservation number should be added to the passenger object A member function that receives a reservation request number as a parameter and outputs the details of the reservation. A member function that receives a reservation request number and cancels reservation request. A member function that deletes all reservation requests after the travel date. A member function that deletes old reservation requests of a passenger. - i) A main function that creates Passenger objects and Reservation Requests objects. It calls to the Reservation Manager member functions to process all Reservation Request tasks. Key Considerations for the assignment: . You must enforce encapsulation by keeping all data members private. Passenger and Reservation Request objects should be created using dynamic memory allocation and the objects that arenot needed anymore should be deleted. There should be an output statement confirming the deletion of an object from the destructor function. In the implemented member functions the relevant data members should be updated. You need to make sure that your classes are well defined using the various concepts seen in the class including constant member functions, static members, inline functions, etc. Via Rail has daily passenger service from Montreal to Toronto. This service has several stops, which are Montreal, Dorval, Brockville, Kingston, Belleville, Toronto. A passenger may travel between any two stops, for example from Montreal to Kingston, or Brockville to Belleville. Define the following classes to manage the passenger reservation system of Via Rail for this route. Include one or more constructors, destructor and the necessary set and get functions for each class. Also, provide a print function for each class, which outputs all the data members of that class. a) Define a class Date that has the following data members: month, day and year. b) Define a class Passenger with the following data members: The name of the passenger as a standard library string. The date of birth of the passenger (from part a). An array that stores reservation request numbers. A passenger is allowed to book up to 5 trips each being assigned a different request number. c) Define a Reservation Request class with the following data members, A Passenger object from part (b). An integer counter that generates reservation request numbers. An integer variable as a reservation request number. The counter is incremented by one each time a reservation request object is created, then this value is assigned as the reservation request number to a data member. Travelling date from part (a). Start station of the trip. Destination station of the trip. Number of seats requested by the passenger, which may be 1 to 4. h) Define a class Reservation Manager with the following data members, Travel date. Variable capacity that specifies the number of seats in the train. Variable that specifies the number of stations on the route A two-dimensional (capacity number of stations) array of integers for reservation table. This array is initialized to zero, which indicates that all the seats are available. When a seat is assigned to a passenger, then the reservation request number is stored at the array locations corresponding to the travel except the destination station.. The following figure shows Montreal-Toronto route and station numbers. The following table shows some example passenger reservations and the table below the filling of the reservation table. In the reservation table, request number is not stored at the destination station of the trip. If multiple seats are requested for a reservation, reservation request number should be stored in all the seats. No of passengers Request no 145 146 147 Start Montreal Montreal Dorval Kingston Belleville Destination Brockville Toronto Kingston Toronto Toronto 148 150 Belleville Toronto Seat no Montreal 145 Brockville 0 146 Dorval 145 146 147 0 0 146 Kingston O 146 148 148 0 147 0 148 148 0 ooooo 0 An array of pointers to the reservation request objects An array of pointers to the passengers. At least the following additional member functions should be provided, A member function that processes a reservation request received as a parameter Reservation will be successful, if seats are available for all the passengers in the group for the entire trip. If reservation is successful it should return reservation request number otherwise zero. If reservation is successful, reservation object should be inserted to the reservation request array, otherwise should be deleted. If reservation is successful, you should check if this passenger is on the passenger array, if not passenger should be stored in this array. The reservation number should be added to the passenger object A member function that receives a reservation request number as a parameter and outputs the details of the reservation. A member function that receives a reservation request number and cancels reservation request. A member function that deletes all reservation requests after the travel date. A member function that deletes old reservation requests of a passenger. - i) A main function that creates Passenger objects and Reservation Requests objects. It calls to the Reservation Manager member functions to process all Reservation Request tasks. Key Considerations for the assignment: . You must enforce encapsulation by keeping all data members private. Passenger and Reservation Request objects should be created using dynamic memory allocation and the objects that arenot needed anymore should be deleted. There should be an output statement confirming the deletion of an object from the destructor function. In the implemented member functions the relevant data members should be updated. You need to make sure that your classes are well defined using the various concepts seen in the class including constant member functions, static members, inline functions, etc

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Database Management System MCQs Multiple Choice Questions And Answers

Authors: Arshad Iqbal

1st Edition

1073328554, 978-1073328550

More Books

Students also viewed these Databases questions

Question

What was the positive value of Max Weber's model of "bureaucracy?"

Answered: 1 week ago