Question: Project 2 Airline Seat Reservations Write a program to assign passenger's seats in a small airplane. Assume the plane has its seats numbered as follows:

Project 2 Airline Seat Reservations
Write a program to assign passenger's seats in a small airplane. Assume the plane has its seats numbered as follows:
Row
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
To reserve a seat, the user should enter the row (1-7) and seat (A - D). Here are the error conditions when checking for a specified seat entered by the user:
the row is not between 1 and 7
the seat is not A, B, C, or D
the seat at that row/column combination is already reserved
In any of the three cases, print an error message and prompt for the next seat to reserve.
Model the seats in the plane using a two-dimensional array with 7 rows representing the seat rows and the columns representing the 4 seats in that row.
Use a loop in your program which continues to prompt for a seat to reserve until either the user specifies a sentinel to stop the program, or when all seats are reserved.
After a seat is reserved, the program should display the seat reservation pattern, with an 'X' marking the seats already assigned. If a seat isn't reserved, then print its seat letter (A, B, C, or D).(See the example below.)For example, after seats 1A,2B,4D, and 6C are reserved, your display might show the following:
Row
1 X B C D
2 A X C D
3 A B C D
4 A B C X
5 A B C D
6 A B X D
7 A B C D
There are 24 seats available.

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 Programming Questions!