Question
C++ The owner of a small regional travel services company, Tyler Travel Services, would like you to develop a travel reservation system that supports their
C++
The owner of a small regional travel services company, Tyler Travel Services, would like you to develop a travel reservation system that supports their business. They own and operate a private island resort in the Caribbean. Tyler Travel Services provides the following services:
Service | Description |
Airline Reservation | Airline service to the island is only provided by Tyler Travel Services. There is only 1 flight daily at a cost of $199.00 per round trip. |
Hotel Reservation | Hotel accommodations are provided at $99.00 per night. |
Car Rental | Rental cars are available at a cost of $89.00 per day. |
Meal Plan | An all inclusive meal plan is offered at a cost of $50.00 per day |
Excursion Package | An excursion package is available at a cost of $150.00 (flat fee) |
Additional Information
The airline flight is capable of carrying 64 passengers according to the seating chart below:
1A 2A 3A 4A 5A 6A 7A 8A 9A 10A 11A 12A | 1B 2B 3B 4B 5B 6B 7B 8B 9B 10B 11B 12B |
| 1C 2C 3C 4C 5C 6C 7C 8C 9C 10C 11C 12C | 1D 2D 3D 5D 5D 6D 7D 8D 9D 10D 11D 12D |
13A | 13B | 13C | 13D | |
14A | 14B | 14C | 14D | |
15A | 15B | 15C | 15D | |
16A | 16B | 16C | 16D |
Requirements
Your travel reservation system should support the following commands as described below. Each command may be abbreviated using a single character for ease of entry. These commands should not be case sensitive.
Figure 1 - Welcome Message and List of Commands
1. (B)ook a reservation this command is used to make a flight reservation. This can only be done if the flight is not full (i.e. number of reservations is < 64). When booking a flight the following information is required:
a. The passengers first name and last name.
A seat assignment should automatically be made for the passenger. After a reservation has been made a confirmation number should automatically be generated and displayed. In addition, a passengers current seat assignment can be changed by selecting the S command from the main menu. See Figure 2 - Booking a flight below.
Figure 2 - Booking a flight
Figure 3 - Seating chart after booking 2 passengers
Figure 4 - Passenger manifest after booking 2 passengers
2. (C)ancel a reservation this command is used to cancel a flight reservation. This can only be done afteran initial reservation has been made. When canceling a flight reservation the following information is required:
a. The passengers Confirmation Number.
In addition to canceling the flight reservation, all additional services for the passenger will be canceled as well. See Figure 5 - Canceling a flight/reservation below.
Figure 5 - Canceling a flight/reservation
After canceling a reservation the change will be reflected in the passenger manifest as well as the seating chart. See Figure 6 - Passenger manifest after canceling a reservation below.
Figure 6 - Passenger manifest after canceling a reservation
3. (D)isplay seating chart this command should display the seating chart for the flight. To indicate a seat is occupied a (and ) should be placed around the seat number (i.e. (12A)). See Figure 7 - Display seating chart below.
Figure 7 - Display seating chart
4. (V)iew passenger manifest this command should display the flights passenger manifest. When displaying the passenger manifest the first name and last name of each passenger along with their seat number, confirmation number, and the total number of passengers should be displayed. See Figure 8 - View passenger manifest below.
Figure 8 - View passenger manifest
5. (S)elect additional services this command should allow the user to select additional services. Additional services can only be ordered after an initial reservation has been made. In order to add additional services, the following information is required:
a.The Confirmation Number a confirmation number is a 6 character identifier that begins with the letters TT and is followed by 4 numeric digits between 0 and 9. This number should have been automatically generated at the time of the initial reservation.
b.After you enter a customers confirmation number, you should be presented with a select additional services command menu (also referred to as a sub-menu in this document) for selecting the additional services desired.
c.In addition to adding a service, the ability to change or remove a service should also be provided.
See Figure 9 - Select additional services below.
Figure 9 - Select additional services
d. The following commands are supported in the Select Additional Services sub-menu. Each command may be abbreviated using a single character for ease of entry. These commands should not be case sensitive.
i. (S)how current services this command should display all of the services associated with a confirmation number along with the cost of each service. The total cost for all services should also be displayed. See Figure 10 - Show current services below for the output format.
Figure 10 - Show current services
ii. (C)hange flight seat assignment this command should enable the user to change a passengers current seat assignment. This can only be done if the flight is not full (i.e. number of reservation is < 64). To change a seat assignment, the following information is required:
1. The desired seat the desired seat is specified as a row number followed by a seat. Seat can be one of the following letters: A, B, C, or D. Example: 12A. If the desired seat is already occupied a message should be displayed and the user should be given the opportunity to enter a different seat. See Figure 11 - Change flight seat assignment below.
Figure 11 - Change flight seat assignment
iii. (H)otel this command should allow the user to Add, Change, or Remove a hotel reservation. When adding or changing a hotel reservation the following information is required:
1. The number of nights the customer will be staying. See Figure 12 - Add hotel reservation below.
Figure 12 - Add hotel reservation
iv. (R)ental car this command should allow the user to Add, Change, or Remove a rental car reservation. When adding or changing a rental car reservation the following information is required:
1. The number of days desired for the rental car. See Figure 13 - Add a rental car below.
Figure 13 - Add a rental car
v. (M)eal plan this command should allow the user to Add, Change, or Remove the meal plan. When adding or changing the meal plan the following information is required:
1. The number of days desired for the meal plan. See Figure 14 - Add the meal plan below.
Figure 14 - Add the meal plan
vi. (E)xcursion package this command should allow the user to Add or Remove the excursion package. See Figure 15 - Add the excursion package below.
Figure 15 - Add the excursion package
vii. (L)ist commands this command should list the commands used for selecting additional services (i.e. the commands described in this list). See Figure 16 - List commands below.
Figure 16 - List commands
viii. (Q)uit this command should exit the Select Additional Services sub-menu and return to main menu.
6. (L)ist commands this command should list the available commands in your travel reservation system (i.e. the commands described in this list). See Figure 17 - List commands below.
Figure 17 - List commands
7. (Q)uit this command should exit the travel reservation system.
In addition, when you first run your travel reservation system program, the user should be greeted with an appropriate welcome message.
Coding Requirements and Guidelines
1.Using the standard procedure for creating a win32 console application, name your project Last_Name Travel Reservation System, where Last_Name should be replaced with your actual last name. Also, name your solution ITSE 1302 Final Project. You should save this on your USB flash drive or other portable storage device.
2.When implementing your program you can only use those C++ features that were covered this semester. Using advanced features such Classes, Structures, Dynamic Memory Allocation, etc. is not permitted.
3.Use comments when appropriate.
4.Remember to indent all program statements when using selection structures (i.e if, if/else, switch) or repetition structures (i.e. while, for, do/while).
5.Perform data validation when appropriate (i.e. entered seat selections are in the proper format and is valid (i.e. 12A); entered confirmation numbers are in the proper format and are valid; etc.).
6.If a command results in displaying information on the computer screen you must first clear the display screen before you display the information. This can be accomplished using the C++ system function as follows:
system (cls);
7.Your main program should consist of a command processor only! After processing a command an appropriate function should be called that implements that command.
Here is my code and my professor had some instructions on the project:
//TylerTravelServicesTemplate.cpp //
#include
using namespace std;
#define HOTEL 0 #define CAR 1 #define MEALS 2 #define EXCURSION 3
//declare and initialize constant arrays and variables const int NUMBER_OF_ROWS = 16; // number of rows on the plane const int NUMBER_OF_SEATS_PER_ROW = 4; // number of seats per row
const int BEGIN_AISLE = 2; // indicates that the aisle begins after seat 2 in a row const int QUIT_COMMAND = 0; // a value indicating the user wished to exit a command
const char seats[NUMBER_OF_SEATS_PER_ROW] = {'A','B','C','D'}; // seat labels per row
//declare and initialize global arrays and variables string lastNames[NUMBER_OF_ROWS*NUMBER_OF_SEATS_PER_ROW] = {""}; // traveler last names string firstNames[NUMBER_OF_ROWS*NUMBER_OF_SEATS_PER_ROW] = {""}; // traveler first names bool occupied[NUMBER_OF_ROWS*NUMBER_OF_SEATS_PER_ROW] = {false}; // indicates if a seat is occupied on the flight bool services[NUMBER_OF_ROWS*NUMBER_OF_SEATS_PER_ROW][4] = {{false,false,false,false}}; // indicates whether a service has been ordered string confirmationNumbers[NUMBER_OF_ROWS*NUMBER_OF_SEATS_PER_ROW] = {""}; // traveler confirmation numbers int numberOfNightsForHotel[NUMBER_OF_ROWS*NUMBER_OF_SEATS_PER_ROW] = {0}; // number of nights booked for the hotel for each traveler int numberOfDaysForCar[NUMBER_OF_ROWS*NUMBER_OF_SEATS_PER_ROW] = {0}; // number of days car rented for each traveler int numberOfDaysForMeals[NUMBER_OF_ROWS*NUMBER_OF_SEATS_PER_ROW] = {0}; // number of days booked for the meal plan for each traveler
int numberOfReservations = 0; // total number of reservations int confirmationNumber = 1000; // confirmation number counter
//function prototypes void cancelReservation(); // called in the main() program when the (C)ancel reservation command is entered void changeSeatAssignment(int, int); // called in the selectServices() function when the (C)hange seat command is entered int checkSeat(int, int , char); // validate seat based on preferred row number (2nd formal parameter) and seat letter // (3rd formal parameter). // current seat is passed in the 1st formal parameter(1-64). // returns the actual seat number if seat is available int checkConfirmationNumber(string); // checks confirmation number specified in the first formal parameter and returns the // seat number (1-64) void displayCommands(); // called in the main() program when the (L)ist commands command is entered void displayServiceCommands(); // display service commands void displayPassengerManifest(); // called in the main() program when the (V)iew passenger manifest command is entered void displaySeatingChart(); // called in the main() program when the (D)isplay seating chart command is entered void displayWelcomeMessage(); // display welcome message string generateConfirmationNumber(); // generate a confirmation number for a reservation made for the flight int generateSeatAssignment (); // randomly generate a seat assignment (1-64)for the flight // returns the actual linear seat number (1-64) int getConfirmationNumber(); // return the seat number (1-64) given a confirmation number int getNumberOfDays(); // returns the number of days entered by the user int getNumberOfNights(); // returns the number of nights entered by the user int getSeatAssignment (int); // ask the user to enter a preferred seat assignment and validate it // current seat (1-64)is passed in the formal parameter // a non-zero return value indicates the actual linear seat number (1-64) void indexToSeat(int, int &, int &); // converts a linear seat number (1-64) specified in the first formal parameter // to the form [row number][seat number] returned in the second and third formal parameters void makeReservation(); // called in the main() program when the (B)ook a reservation command is entered int seatToIndex(int, int); // convert a 2 dimensional seat address (row, seat) specified in the formal parameters // to its equivalent linear address and returns the linear seat number (1-64) void selectCar(int); // rent a car for the passenger sitting in the seat specified by the formal parameter void selectExcursion(int); // book an excursion for the passenger sitting in the seat specified by the formal parameter void selectHotel(int); // book a hotel for the passenger sitting in the seat specified by the formal parameter void selectMeals(int); // select the meal plan for the passenger sitting in the seat specified by the formal parameter void selectServices(); // called in the main() program when the (S)elect services command is entered void showServices(int); // display the services selected by the passenger sitting in the seat specified by the formal parameter
int main() { /* initialize the random number generator*/ srand(static_cast
/*delare variables*/ char command = ' ';
displayWelcomeMessage();
do { cout << "Enter command: "; cin >> command; command = toupper(command);
cin.ignore(100, ' ');
system("cls");
if (command == 's') { if (numberOfReservations > 0) selectServices(); else cout << "No current reservations! Additional services cannot be selected!" << endl; } else if (command == 'D') displaySeatingChart(); else if (command == 'B') { if (numberOfReservations < 64) makeReservation(); else cout << "FLight is full! No additonal reservations can be made at this time!" << endl; } else if (command == 'C') { if (numberOfReservations > 0) { cancelReservation(); displaySeatingChart(); } else cout << "There are currently no reservations at this time!" << endl; } else if (command == 'V') displayPassengerManifest(); else if (command == 'L') displayCommands(); else { if (command != 'Q') { cout << "Invalid command - " << command << endl; displayCommands(); } } }while (command != 'Q');
system("pause"); return 0; } //end of main function
void cancelReservation() { // cancel a reservation by confirmation number }
void changeSeatAssignment(int from, int to) { // change seat assignment on the flight from current // seat "from" (1-64) to desired seat "to" (1-64) }
int checkConfirmationNumber(string number) { // check the confirmation number specified by the string "number" // returns the corresponding linear seat number (1-64)
return 0; }
int checkSeat(int currentSeat, int rowPreference, char seat) { // validate seat based on preferred row number and seat letter // currentSeat is the current linear seat address (1-64) // returns 0 if invalid seat or seat not available // returns the actual seat number if seat available (1-64) return 0; }
void displayCommands(){ cout<< "**************************************************" << endl; cout<< "* Please select a command : *" << endl; cout<< "* *" << endl; cout<< "* (S)elect additional services *" << endl; cout<< "* (B)ook a flight *" << endl; cout<< "* (C)ancel a flight reservation *" << endl; cout<< "* (D)isplay flight seating chart *" << endl; cout<< "* (V)iew flight passenger manifest *" << endl; cout<< "* (L)ist commands *" << endl; cout<< "* (Q)uit *" << endl; cout<< "* *" << endl; cout<< "**************************************************" << endl; }
void displayServiceCommands(){ // display the service commands }
void displaySeatingChart() { // display the seating chart }
void displayPassengerManifest() { // display the passenger manifest }
void displayWelcomeMessage(){ cout << "**************************************************" << endl; cout << "* *" << endl; cout << "* Welcome *" << endl; cout << "* to *" << endl; cout << "* Tyler Travel Services *" << endl; cout << "* *" << endl; cout << "* Featuring *" << endl; cout << "* *" << endl; cout << "* +Flight Reservation @ $199 R / T *" << endl; cout << "* +Hotel Reservation @ $ 99 / night *" << endl; cout << "* +Car Rental @ $ 89 / day *" << endl; cout << "* +Meal Plan @ $ 50 / day *" << endl; cout << "* *" << endl; displayCommands(); }
string generateConfirmationNumber() { // automatically create a confirmation number return ""; }
int generateSeatAssignment() { // randomly generate a seat assignment (1-64) return 0; }
int getConfirmationNumber() { // get the confirmation number // returns the actual linear seat number (1-64)
return 0; }
int getNumberOfDays() { // ask user for number of days // returns the number of days entered
return 0; }
int getNumberOfNights() { // ask user for number of nights // returns the number of nights entered
return 0; }
int getSeatAssignment (int currentSeat) { // ask the user to enter a seat assignment and validate it // the current seat (1-64) is passed in currentSeat // returns 0 to indicate quit without changing seats // returns non-zero indicates the actual linear seat number
return 0; }
void indexToSeat(int linearSeatNum, int &row, int &seat) { // converts a linear seat number (1-64) specified in the first formal parameter // to the form [row number][seat number] returned in the second and third formal parameters }
void makeReservation() { // make a reservation }
int seatToIndex(int row, int seat) { // convert a 2 dimensional seat address specified by row (1-16) and seat (1-4) to // its equivalent linear address (1-64) // returns the seat number (1-64)
return 0; }
void selectCar(int seat) { // add a rental car // seat-1 indicates the entry point in to the parallel arrays
}
void selectExcursion(int seat) { // add the excursion package // seat-1 indicates the entry point in to the parallel arrays
}
void selectHotel(int seat) { // add a hotel // seat-1 indicates the entry point in to the parallel arrays
}
void selectMeals(int seat) { // add the meal plan // seat-1 indicates the entry point in to the parallel arrays
}
void selectServices() { // select the other services
}
void showServices(int seat) { // show the current services for the active confirmation number
}
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