Question: the code should be in c++ Objective: learn how to: --pass multi-scripted array to a function Problem: Write a program to assign passenger's seats in

 the code should be in c++ Objective: learn how to: --pass
multi-scripted array to a function Problem: Write a program to assign passenger'sthe code should be in c++

Objective: learn how to: --pass multi-scripted array to a function Problem: Write a program to assign passenger's seats in an airplane. Assume a small airplane with seat numbering as follows: 1 ABCDEF 2 ABCDEF 3 ABCDEF 4 ABCDEF 5 ABCDEF 6 ABCDEF 7 ABCDEF 8 ABCDEF 9 ABCDEF The program should display the seat pattern with an X" marking the seats already assigned. For example, after seats 1 A, 2B and 4 E are taken, the display should look like this: 1 XBCDEF 2 AXCDEF 3 ABCDEF 4 ABCDXF 5 ABCDEF 6 ABCDEF 7 ABCDEF 8 ABCDEF 9 ABCDEF Define a display function to display the seats table as shown above. After displaying the seats available, the program prompts for the seat desired, the user types in a seat (an integer, a space and a letter) and print a message "the seat is assigned" if the seat is available. If the user types in a seat that is already assigned, the program should display the seat table, say that the seat is occupied, tell the user how many seats left and ask for another try. This continues until all seats are filled with a notice or until the user signals the program should end. Then display the seat table and tell the user how many seats are taken. You need to handle invalid input like 10 B, 4 S, IA, A or A 2. Requirements: You must define a display function to show the table. Hints: The statement inder-col- 'A' will assign the integer 1 to index if the variable col holds value 'B', where index is int data type and represents the position number of the column. Suggested screen design: 1 ABCDE 2 ABCDEF 3 ABCDEF 4 ABCDEF 5 ABCDEE 6 ABCDEE 7 ABCDEE 8 ABCDEE 9ABCDEE Enter passenger's seat (-1 to end): 2 D The seat is assigned. Enter passenger's seat (-1 to end) : 10 B Invalid seat. Try again. Enter passenger's seat (-1 to end) : 4C The seat is assigned. Enter passenger's seat (-1 to end): 2 D The seat is not available. Check the table and assign another seat. There are 52 seats left. 1 ABCDEE 2 ABCXEE 3 ABCDEF ABXDEE 5 A B C D E E 6 ABCDEE 7 ABCDEF 8 ABCDEE 9ABCDEE Enter passenger's seat (-1 to end) : 8 # Invalid seat. Try again. Enter passenger's seat (-1 to end): 8 A The seat is assigned. Enter passenger's seat 1-1 to end): -1 The final seats are: 1 ABCDEF 2 ABCXEP 3 ABCDEF 4 ABXDEE 5 ABCDEF 6 ABCDEE 7 ABCDEF 8 XBCDEF 9 ABCDE There are 3 seats sold

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!