Question: In C programming please, thank you. The specifications must be followed exactly, or else the input given in the script file may not match with

In C programming please, thank you.

The specifications must be followed exactly, or else the input given in the script file may not match with the expected output.

Overview:

A local airline asked you to automate its simple reservation system. Your program should assign seats on each flight of the airline's only plane with a seat capacity of 20 (a Cessna aircraft). Your program should display the following two menu of choices:

In C programming please, thank you. The specifications must be followed exactly,

If 'F'(or 'f') is typed, then your program should assign a seat in the first class section (seat 1 -10). If 'E' (or 'e') is typed, then your program should assign a seat in the economy section (seat 11-20). Your program should then print a boarding pass indicating the person's seat number and whether it is in the first class or economy section of the plane. For example, if the seat reserved is 18, the boarding pass is displayed is as follows: or else the input given in the script file may not match

If the user presses 'Q'(or 'q'), you should exit the program. Use an array to represent the seating chart of the plane. Initialize all the elements of the array to 0 at the beginning to indicates all the seats are empty. As each seat is assigned, set the corresponding element to 1 to indicate the seat is no longer available. Your program should not assign a seat that is already been assigned. When first class section is full, your program should ask the person if it is acceptable to be placed in the economy section. The same should be applied for the economy class. The user can answer "Yes" or "No" (both are case sensitive). If "Yes" is the answer, then the seat will be reserved. If "No", then print "Next flight leaves in 5 hours". If there is no seat available in both classes, your program should display the flight is full, the next flight leaves in 5 hours. .

Your program must have the following functions (not including main()):

  • A function that prints the initial menu of choices for the user, prompts the user to enter a choice ("F" or "E" or "Q") and retrieves that choice and teturn it. the menu should be displayed until the user enters "q" or "Q". Use the following function header: char displayMenu()
  • A function that checks if a seat is available in the given class. This function accepts an array and a character that represents the class, "F or f" or "E or e". Use the following header for your function: int isAvailable(int seats[], char class)
  • A function that reserves a seat. This function reserves a seat (if there is an empty seat) based on the class choice of the user. It returns 1, if the reservation is successfull , 0 otherwise. Use the following function header: int reserveSeat(int seats[], char class)

Example Output:

with the expected output. Overview: A local airline asked you to automate

its simple reservation system. Your program should assign seats on each flight

Please type 'F' for "First Class" Please type 'E' for "Economy Class" Please type 'Q' to exit Class: Economy Seat:18 This is an example of some of the output that might be displayed on the screen based on the inputs: Please type 'F' for "First class" Please type 'E' for "Economy Class" Please type 'Q' to exit Class:First Seat:1 Please type 'F' for "First Class" Please type 'E' for "Economy Cla33" Please type 'Q' to exit Sorry, our Economy class is full. Do you want to fly First class? (Yes/No) N Please enter (Yes/No) Please enter (Yes/No) Yes Class:First Seat:2 Please type 'F' for "First Cla33" Please type 'E' for "Economy Cia33" Please type 'Q' to exit After 20 reservations Please type 'F' for "First Class" Please type 'E' for "Economy Cla33" Please type 'Q' to exit f Sorry, our First class is full. Do you want to fly Economy class? (Yes/No) Yes The flight is full, the next flight leaves in 5 hours

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!