Waiting for answer This question has not been answered yet. You can hire a professional tutor to get the answer.

QUESTION

The flight route is from Johannesburg to Cape Town with the travel duration fixed at 2 hours.

Please help me with a programming code that simulates a flight booking system. 

The flight route is from Johannesburg to Cape Town with the travel duration fixed at 2 ½ hours.

Departure and arrival locations remain the same.

Departure is always from Johannesburg and destination is always Cape Town.

The departure and arrival times are: Option Departure Time Arrival Time 1 7:00 9:30 2 9:00 11:30 3 11:00 13:30 4 13:00 15:30 5 15:00 17:30

The seating arrangement is six seats in a row, three on the left side and three on the right side of the plane with a walkway (passage) in between.

The total number of seats in the flight is 50.

There are two classes of travel: First Class and Economy class. 

The front four rows are considered as 'First Class' and all other rows to the back are 'Economy Class'.

The cost for economy class is fixed at R 1 600.00. 

The first class travel ticket is 20% more costly than the economy class.

The front four rows are considered as 'First Class' and all other rows to the back are 'Economy Class'.

The cost for economy class is fixed at R 1 600.00. 

The first class travel ticket is 20% more costly than the economy class

Questions

Questions You are required to do the following. Help me to program the code that will do the following:

1. Prompt (ask) the user to enter his/her full name.

2. Then display a menu showing the available times for the flight. The user can choose a preferred departure time (option 1 -5). 

The option selected should be validated for 1-5. 

3. If the user has entered a valid option, the seating arrangement for that particular flight time should be displayed to the user for the user to choose a seat. 

 If any seats have already been booked for that time, the booked seats should be indicated and displayed using "**". 

Validation for time option chosen

The user can then choose a suitable seat number that is available .The seat number should be validated to see if it has already been booked.In other words, if the user enters a seat number that is already booked, display a user-friendly message and give the option to enter the seat number again.

4. Once the user has successfully chosen an available seat, a Flight booking ticket should be displayed on the screen. Check the sample screenshot for the details that need to be displayed on the ticket.

5. The program should prompt (ask) the user if they would like to make additional bookings?  Then the program should be able to repeat for more than one booking with various flight times.  The check for 'y' or 'n' at the "Do you want to continue(Y/N)?" prompt should be case-insensitive. In other words, both 'Y' and 'y' should be accepted or both 'N' and 'n' should be accepted.

Booked seats indicated with "**"

6. When the user has finished all the booking and chosen 'N' or 'n' at the "Do you want to continue(Y/N)?" prompt, the program should display the total number of bookings made for each flight time, just before exiting.

Submit the full program code and output screenshots. Include screenshots in your submission showing:  the program repeating;  input validations;  booking for different flight times. 

You are required to define and use functions to do the following:  Display the menu for flight times, accept the user option and validate the user option. o Call the function to validate the menu option from here.

Validate the menu option for flight times. 

 Display the seating arrangement (You might have to use two different functions for seat display). o ie. before any booking has been made, you have one seating arrangement with all the seats available. After seats are booked, you have to display the booked seats with "**"). 

 Validate the availability of the chosen seat (to check if the seat has been already booked or not). o You DO NOT have to do validation for an invalid entry like Z3. We assume that the user enters a valid seat number that is displayed on the screen. You only need to check if it has been already booked or not.

 Calculate the ticket price.(You are allowed to use a global named constant for the price of economy class, however, wherever you have to display the cost of ticket, you need to use this function to determine the price of the ticket. o For instance, when you show the amount in the ticket that is displayed as output for each booking made.

 Display the ticket, as shown in the sample output, for each booking. The function used to calculate ticket price can be called from this function.

DO NOT use global variables. Except that you are only allowed to use global named constants for the following: o Cost of economy class ticket. o An array for storing departure times and arrival times. o For the size of any other arrays you might use.

Additional information/ Hints:

o You need to store the details of a particular booking, because you have to display the booked seats in the seating arrangement with "**", when the program repeats. o Therefore, you need to think in the direction of storing the details of one booking which are of different data types, in one place. o Again, if you are making more than one booking, then you have to store the details of various bookings in an array. Apply what you have learnt and use appropriate data types and data structures.

The program should display the total bookings for each time, before exiting.

8 If you want to display the seat number as a combination of letter and number as in A1, A2 etc, then you can use the to_string() function to convert the integer to string and concatenate. For example:

char row = 'A'; int col = 1; string sNo = ""; sNo += row; sNo += to_string(col);

Sample Program output (from one execution of the program without exiting):

Show more
LEARN MORE EFFECTIVELY AND GET BETTER GRADES!
Ask a Question