Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Write a program to assign seats to passengers in an airplane. The program asks the user for the number of rows of seats and the

image text in transcribed
Write a program to assign seats to passengers in an airplane. The program asks the user for the number of rows of seats and the number of seats per row, and creates a two-dimensional character array with that many rows and columns. It initializes every row with letters A, B, C, etc. For example if the plane has 7 rows of seats and each row has five seats, then the seats are numbered as follows: ABCDE 2 ABCDIE 3ABCDE 4 A BCDE 5ABCDE 6ABCD E 7ABCDE The program should display the seat pattern with an X marking the seats already assigned. For example, after seats 1A, 2E, and 6D are taken, the display should look like this: 1X BCD E 2 A B CDX 3A BCDE 4ABCDE 5 ABCD E 6 A BCXE 7ABCDE After displaying the seats available, the program asks the user for the seat desired. The user types in a seat, and then the display of available seats is updated. However, if the user enters a seat that is already taken, the program prints a message "seat is occupied" and asks the user for another seat. The above steps should continue until all seats are filled or until the user signals that the program should end by entering the word 'exit' instead of a seat number Sample Input and Output Programmer: Course: Labt: Due date: Name of the programmer (your name) cosc 246, Winter 2018 Take home project #2 4-12-2018 Enter number of rows: 7 Enter number of seats per row: 5 1AB CDE 2 A B C DE 3 ABCD E 4 AB C DE

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image_2

Step: 3

blur-text-image_3

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

More Books

Students also viewed these Databases questions

Question

Develop goals and timetables.

Answered: 1 week ago

Question

f. Did they change their names? For what reasons?

Answered: 1 week ago