Question
Write a program to assign passengers seats in an airplane. Assume a small airplane with seat numbering as follows: 1 A B C D 2
Write a program to assign passengers seats in an airplane. Assume a small airplane with seat numbering as follows:
1 A B C D
2 A B C D
3 A B C D
4 A B C D
5 A B C D
6 A B C D
7 A B C D
The program should display the seat pattern, with an ‘X’ marking the seats already assigned. For example, after seats 1A, 2B, and 4C are taken, the display should look like:
1 X B C D
2 A X C D
3 A B C D
4 A B X D
5 A B C D
6 A B C D
7 A B C D
After displaying the seats available, the program prompts the seat desired, the user types in a seat, and then the display of available seats is updated. This continues until all seats are filled or until the user signals that the program should end. If the user types in a seat that is already assigned, the program should say that the seat is occupied and ask for another choice.
Your program should have 4 functions other than main:
Get Data -> to read the seat number chose by the user.
Check-> to check for the availability of the chosen seat.
Update -> to update the status of the airplane seats.
Display -> to display the current status of the airplane seats.
You MUST apply array in your program.
Step by Step Solution
3.41 Rating (157 Votes )
There are 3 Steps involved in it
Step: 1
Flight Booking Application In this we are using 2 dimensional array to store the whole seats First we will display total available seats Then asks user to enter the desired seat location We takes the ...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