Help me to write a program in C++
Introduction You are required to write a program that simulates a flight booking system. A sample program execution is provided at the end of the document, to help you visualize and understand what the program should do. You should use the same input as the sample program, for the screenshots that you submit with your assignment. The flight route is from Johannesburg to Cape Town with the travel duration fixed at 2 %2 hours. o Departure and arrival locations remain the same. Departure is always from Johannesburg and destination is always Cape Town. o 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 4. 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 walkı (passage) in between. See the image of the setup below. 1. (image source: http://travelgurureviews.com/kulula-com ... e-reviews/) O The total number of seats in the flight is 50. 4 COS1511/104/0/2022 O o 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. O o Questions You are required to do the following. (See the sample output screenshots for clarification). Write a program that will do the following: 1. Prompt (ask) the user to enter his/her full name. Welcome to COS1511 Flight Booking system Enter full name Hannah George 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. Welcome to COS1511 Flight Booking system Enter full name
Questions You are required to do the following. (See the sample output screenshots for clarification). Write a program that will do the following: 1. Prompt (ask) the user to enter his/her full name. Welcome to COS1511 Flight Booking system Enter full name Hannah George 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. Welcome to COS1511 Flight Booking system Enter full name Hannah George 5 The available travel times for flights are: Depart Arrive 1. 7.00 9.30 2. 9.00 11.30 Validation for time option 3. 11.00 13.30 chosen 4. 13.00 15.30 5. 15.00 17.30 Choose the time by entering the option number from the displayed list: 9 Incorrect option! Please choose from 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. The available seats for 7.00 are as follows: First Class (1920.00) | A1 A2 A3|---- |A4|A5| A6 ||B1|B2B3- B4/B5/B6) ||ci|c2|03|-- |04|05|261 |01|D2|03| D4 D5 D61 | Economy class (1600.00) | E1 E2 E31 E4E5 E61 F1 F2 F3 F4F5F6| |G1|G2|63| G4 G5 G6 | H1 H2 H31 H4|H5| H61 |11|121 Please key in a seat number to choose a seat(eg: A2) A1 If any seats have already been booked for that time, the booked seats should be indicated and displayed using "**". 5 COS1511/104/0/2022 . 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 and give the option to enter the seat number again. The available seats for 7.00 are as follows: First Class (1920.00) (** AZTA3--- 144TASTA |B1|B2B31 |B4/B5 B6 Booked seats indicated with "**"
********** ********** Travel ticket for FLIGHT Name : Hannah George Travel Ticket class : First class Seat No : A1 Departure Time : 7.00 Arrival Time : 9.30 Departure Destination : : Johannesburg Cape Town ****** Amount:R1920.00 Thank you for booking with COS1511. Your travel agent for queries is Annie Mathew Do you want to make another booking (Y/N)? Y Welcome to COS1511 Flight Booking system Enter full name Deon Pieters The available travel times for flights are: Ticket display for a booking Depart Arrive 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 Choose the time by entering the option number from the displayed list: 1 Seats booked should be indicated with ** The available seats for 7.00 are as follows: t Class (1920.00) ** A2 A3 A4 A5 A6 B1 B2 B3 B4 B5 B6 C1 C2 C3 |C4 C5 C61 |01|D2|D31 D4 D5 D61 Economy class (1600.00) E1 E2 E3 E4 E5 E6 F1 F2 F3 F4F5F61 G1 G2 G3 |64|65| G6 H1 H2 H3 | H4 H5 H6 (11/12 Seats that are already taken are indicated with an asterisk Please key in a seat number to choose a seat (eg: A2) G3 8 Travel ticket for FLIGHT Name : Deon Pieters Travel Ticket class : Seat No Departure Time : Arrival Time : : Johannesburg : Cape Town Economy class G3 7.00 9.30 Departure Destination Amount:R1600.00 Thank you for booking with COS1511. Your travel agent for queries is Annie Mathew ***** Do you want to make another booking(Y/N)? Y
• 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. The available seats for 7.00 are as follows: : First Class (1920.00) ** ZA31 ---- A4 A5 A6T Booked seats indicated with "**" BT B2B3 B4/B5/B6 |01|C2031 |04|05|c6 |01|D2|03|---- |04|05|D6 Economy class (1600.00) | E1 E2 E31- | E4 E5 E61 F1 F2 F3 |F4F5F6 |61|G2|631 |64|65|66 | H1 H2 H31 H4 H5 H61 |11|12 Seats that are already taken are indicated with an asterisk Please key in a seat number to choose a seat(eg: A2) G3 5 4. Once the user has successfully chosen an available seat, a Flight booking ticket should be displayed on the scre Check the sample screenshot for the details that need to be displayed on the ticket. ******* Travel ticket for FLIGHT ***** ******* Name Hannah George Travel Ticket class : First class Seat No : A1 Departure Time : 7.00 Arrival Time : 9.30 Departure Destination : Johannesburg Cape Town : Amount: R1920.00 Thank you for booking with COS1511. Your travel agent for queries is Annie Mathew ******* ** 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 'V' should be accepted or both 'N' and 'n' should be accepted. . Travel ticket for FLIGHT ********* Name Hannah George Travel Ticket class : First class Seat No A1 Departure : Johannesburg Departure Time : 7.00 Destination Cape Town Arrival Time : 9.30 ***** Amount:R1920.00 Thank you for booking with cos1511. Your travel agent for queries is Annie Mathew EEL Do you want to make another booking (Y/N)? Welcome to COS1511 Flight Booking system Enter full name Deon Pieters 1. The available travel times for flights are: Depart Arrive 7.ee 9.30 2. 9.00 11.30 3. 11.00 13.30 4. 13.00 15.30 5. 5. 15.00 17.30 Choose the time by entering the option number from the displayed list: 1
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. Number of bookings made for 7.00 a.m:3 Number of bookings made for 9.00 a.m:0 Number of bookings made for 11.00 a.m:0 Number of bookings made for 13.00 p.m: 0 Number of bookings made for 15.00 p.m:1 The program should display the total bookings for each time, before exiting. execution time 125.236 s Process returned 0 (0x0) Press any key to continue. 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. Call the function to validate the menu option from here. o . Validate the menu option for flight times. . Display the seating arrangement (You might have to use two different functions for seat display). ie. before any booking has been made, you have one seating arrangement with all the seats availa After seats are booked, you have to display the booked seats with "**"). 6 o . Validate the availability of the chosen seat (to check if the seat has been already booked or not). 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. O . 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. For instance, when you show the amount in the ticket that is displayed as output for each booking made. O 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. o DO NOT use global variables. Except that you are only allowed to use global named constants for the following: Cost of economy class ticket. o An array for storing departure times and arrival times. For the size of any other arrays you might use. o DO NOT use classes to write this program (you should be able to write this program with the help of other data structures that you have learnt). Additional information/ Hints: 0 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. Therefore, you need to think in the direction of storing the details of one booking which are of different data types, in one place. 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. O
Welcome to COS1511 Flight Booking system Enter full name Jim Baker The available travel times for flights are: Depart Arrive 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 Choose the time by entering the option number from the displayed list: 1 Two seats booked for 7:00 am flight The available seats for 7.00 are as follows: First Class (1920.00) | ** |A2|A3| |A4|A5| A6 HBTB2B31 B4 B5 B6 |01|C203| C4 C5 C6 |01|D2|03| |04|05|06| Economy class(1600.00) |E1|E2|E3| E4 E5 E61 |F1 F2152 F4F5F61 |G1|62|**1) |64|65|661 H1 H2 H31 |H4|H5|16 || 2| 宋 AT Seats that are already taken are indicated with an asterisk Please key in a seat number to choose a seat(eg:A2) A1 was already booked for 7:00 Sorry, the seat is taken. Please choose a seat that is available D6 am flight. So display an appropriate message that the Travel ticket for FLIGHT seat has already been taken. **** Name : Jim Baker Travel Ticket class : Seat No : Departure Time : Arrival Time : First class D6 7.00 9.30 Departure Destination : : Johannesburg Cape Town 9 **** Amount:R1920.00 Thank you for booking with COS1511. Your travel agent for queries is Annie Mathew ****** ***** Do you want to make another booking (Y/N)? Y Welcome to COS1511 Flight Booking system Enter full name Fiona Bruce The available travel times for flights are: Depart Arrive 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 Choose the time by entering the option number from the displayed list: 5 10
Travel ticket for FLIGHT Name Hannah George Travel Ticket class: First class Seat No : A1 Departure Time : 7.00 Arrival Time : 9.30 Departure Destination Johannesburg Cape Town : Amount:R1920.00 Thank you for booking with COS1511. Your travel agent for queries is Annie Mathew Do you want to make another booking (Y/N)? Y Welcome to COS1511 Flight Booking system Enter full name Deon Pieters The available travel times for flights are: Ticket display for a booking Depart Arrive 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 Choose the time by entering the option number from the displayed list: 1 Seats booked should be indicated with 1* The available seats for 7.00 are as follows: INT Class (1920.00) ** A2 A3 ---- A4 A5 A6 B1 B2 B3--- B4 B5 B6 C1 C2 C3----|C4 C5 C6 D1 D2 D3 D4 D5 D61 Economy class(1600.00) E1 E2 E3|-- E4 E5 E61 F1 F2 F3 F4F5F61 61 62 63 |64|65|66| | H1 H2 H31 |H4 H5 H6 |11|12 Seats that are already taken are indicated with an asterisk Please key in a seat number to choose a seat(eg: A2) G3 ***** Travel ticket for FLIGHT 8 : Name : Deon Pieters Travel Ticket class : Economy class Seat No : G3 Departure Johannesburg Departure Time : 7.00 Destination : Cape Town Arrival Time : 9.30 ***** Amount:R1600.00 Thank you for booking with COS1511. Your travel agent for queries is Annie Mathew Do you want to make another booking (Y/N)? Y
Please key in a seat number to choose a seat(eg:A2) AT Sorry, the seat is taken. Please choose a seat that is available D6 A1 was already booked for 7:00 am flight. So display an appropriate message that the seat has already been taken. Travel ticket for FLIGHT Name . Jim Baker Travel Ticket class : Seat No : Departure Time : Arrival Time : First class D6 7.00 9.30 Departure Destination : Johannesburg : Cape Town Amount: R1920.00 Thank you for booking with COS1511. Your travel agent for queries is Annie Mathew Do you want to make another booking (Y/N)? Y Welcome to COS1511 Flight Booking system Enter full name Fiona Bruce The available travel times for flights are: Depart Arrive 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 Choose the time by entering the option number from the displayed list: 5 10 COS1511/104/0/2022 The available seats for 15.00 are as follows: First Class (1920.00) |A1|A2|A3| ---- |A4|A5| A6 B1 B2 B3 B4/B5 B6 C1 C2 C3 C4 C5 C61 D1 D2 D3 |D4|D5|D6 Economy class (1600.00) E1 E2 E3 |E4E5 E6 F1 F2 F3 F4F5F61 G1 G2 G3 G4 G5 G6 || H1 H2 H3L- | H4 H5 | H6 ||11|121 Please key in a seat number to choose a seat(eg:A2) I2 A different flight time chosen, and a corresponding display. No bookings were made for this time, so all seats available. Travel ticket for FLIGHT Name 10 . Fiona Bruce Travel Ticket class : Seat No : Departure Time : Arrival Time : Economy class I2 15.00 17.30 Departure Destination Johannesburg Cape Town ******** Amount:R1600.00 Thank you for booking with COS1511. Your travel agent for queries is Annie Mathew Do you want to make another booking (Y/N)? n Number of bookings made for 7.00 a.m: 3 Number of bookings made for 9.00 a.m:0 Number of bookings made for 11.00 a.m:0 Number of bookings made for 13.00 p.m:0 Number of bookings made for 15.00 p.m: 1 The program should display the total bookings for each time, before exiting. execution time: 125.236 s Process returned o (0x0) Press any key to continue. [TOTAL
Help me to write a program in C++
-
answerhappygod
- Site Admin
- Posts: 899604
- Joined: Mon Aug 02, 2021 8:13 am
Help me to write a program in C++
Join a community of subject matter experts. Register for FREE to view solutions, replies, and use search function. Request answer by replying!