Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

[1] Objectives: The main purpose of this assignment is to make sure you are familiar with using arrays (in particular, two dimensional arrays). In addition,

[1] Objectives: The main purpose of this assignment is to make sure you are familiar with using arrays (in particular, two dimensional arrays). In addition, it is important that you know how to use functions to structure your program.

[2] Description: We are going to simulate a seat reservation program (think airlines seats). We will have matrix NUMBER_OF_ROWS X NUMBER_OF_COLUMNS that represents seat capacity in any room. Set NUMBER_OF_ROWS = 8, and NUMBER_OF_COLUMNS = 4. (TA may change the values when testing your program). Here is what you need to do. Initialize the values to empty - and display the seat table. Allow the user to reserve available seat (one at a time) by entering Row and Column numbers of their desired seat such as 1A or '2b'. If the seat is available and does exist, change the seat status to RESERVED (from - to X). Otherwise, if the seat is already reserved or does NOT exist, display proper error message. When your program detects that all the seats have been reserved, display proper message to the user and then exit the program. When the user enters the values 0Q for row and column, exit the program. A wild character matches any character (A, B, C, or D). For example, when the user enters the values 2*, the program should scan all the available seats in row 2 and return the an available reserve seat if available. If all seats on that particular row are full, it will output the error message saying that the seats are not available. You do not have to handle cases like '*a'. Requirements: 1. You should use a two dimensional array in this assignment. 2. You should not use any global variable except for constants. 3. You should NOT use pointers (Do NOT use ** in your definition). You will get your chance to use pointers later. 4. Declare number of rows and number of columns as constants. Your program should work if we changed them. 5. Make sure to display row numbers from 1 to NUMBER_OF_ROWS and NOT from 0 to NUMBER_OF_NUMBERS - 1. 6. For columns display letter instead of number. Example: when NUMBER_OF_COLUMNS = 4, then columns will be A, B, C, D. Also, maximum possible number of columns is 26, which means that you do NOT have to worry about what to do when you reach Z column. Possible columns will be from A Z. 7. You must use at least 3 functions. 8. Do NOT forget to add header, comments, and name your .cpp file correctly 9. You should accept both upper/lower case column letters. Example: 1A and 1a are both valid inputs. Suggested functions: Reset(): reset all seats to available, - isFull(): check if all seats are reserved print(): display status of all seats in readable format isSeatValid(): check if selected seat is valid getSeat(): ask the user to enter desired row, column numbers, then returns user inputs scan(): if requesting a seat on a row, then reserve the first available seat. If no seats available, display error. reserve (): if selected seat is valid, then reserve the seat. Otherwise, display error Hint: It is ok to compare char with int. For example: A is equivalent to 65 in the ASCII table.

[3] Input: Row number and column character. The seat table is initially empty, i. e., all available. Example: Seat (Row Column): 2B

[4] Output: Sample outputs looks like

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

Step: 3

blur-text-image

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

Advanced Oracle Solaris 11 System Administration

Authors: Bill Calkins

1st Edition

0133007170, 9780133007176

More Books

Students also viewed these Databases questions