Create a struct called Booking that consists of a 3 digit flight number (e.g. 234), type of seat (E or B), the price of a seat in economic class and the number of seats booked. Declare an array to store at least 30 Booking structs. (4) 2. The user must be able to enter the information for a number of bookings from the keyboard. Ask whether a booking must be made (Y or N). If a booking must be made, a random 3 digit flight number must be generated. The user must be asked to enter the type of seat, the price per seat and the number of seats to book. 3. Write code to display a numbered list with all the information of all the bookings. The price per ticket must be displayed with 2 decimal places. The output must be displayed with a heading and subheading 4. Write code to calculate and display the income earned per booking. Display headings and subheadings. Also count and display the number of business seats and economics seats booked as well as the income earned from each of these types of bookings. Calculate and display the total income. 5. The user must be able to remove a booking from the list. Ask whether the user wants to remove a booking. If the user wants to remove a booking, the user must enter the number of the booking to be removed from the list. Use a do … while loop to validate the number that is entered. The number that was entered must be in the range of numbers displayed on the numbered list. In this example the number must be in the range of 1 to 5. If the number that was entered is not in the correct range, display an error message and ask the user to enter another number until a valid number has been entered. The validation must work for any number of bookings as displayed on the numbered list. Write code to display the numbered list again to see whether the booking has been removed.
1. Create a struct called Booking that consists of a 3 digit flight number (e.g. 234), type of seat (E or B), the price
of a seat in economic class and the number of seats booked.
Declare an array to store at least 30 Booking structs. (4)
2. The user must be able to enter the information for a number of bookings from the keyboard. Ask whether a
booking must be made (Y or N). If a booking must be made, a random 3 digit flight number must be generated.
The user must be asked to enter the type of seat, the price per seat and the number of seats to book.
3. Write code to display a numbered list with all the information of all the bookings. The price per ticket must be
displayed with 2 decimal places. The output must be displayed with a heading and subheading
4. Write code to calculate and display the income earned per booking. Display headings and subheadings.
Also count and display the number of business seats and economics seats booked as well as the income
earned from each of these types of bookings. Calculate and display the total income.
5. The user must be able to remove a booking from the list. Ask whether the user wants to remove a booking. If
the user wants to remove a booking, the user must enter the number of the booking to be removed from
the list.
Use a do … while loop to validate the number that is entered. The number that was entered must be in the
range of numbers displayed on the numbered list. In this example the number must be in the range of 1 to 5.
If the number that was entered is not in the correct range, display an error message and ask the user to
enter another number until a valid number has been entered. The validation must work for any number of
bookings as displayed on the numbered list.
Write code to display the numbered list again to see whether the booking has been removed.
Step by step
Solved in 2 steps with 2 images