Question: Write a program in C++ language to assign passengers seats in an airplane. Assume a small airplane with seat numbering as follows: 1 A B
Write a program in C++ language 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
Your program will ask the user how many rows the plane has and use a dynamic array or arrays) to handle the number of rows. Your 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 this:
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 for 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. Dont forget to free the memory allocated for these returned dynamic arrays when the data is no longer needed.
(Automated testing) For a large number of rows, you may need to enter a lot of test data. In order to speed up the testing, you need to design your program to allow the input to be entered via console or an input file. So you should initially prompt the user to ask whether the input will come from the console or an input file. If from an input file, user needs to enter the file name. For example, the test file should contain the following input:
7
1A
2A
3A
4A
5A
6A
7A
2B
2C
2D
7D
end
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
