Question
DESCRIPTION: Write a program that reserves seats for a theater, airline, etc. using a two-dimensional array. The program should start by asking for the number
DESCRIPTION:
Write a program that reserves seats for a theater, airline, etc. using a two-dimensional array. The program should start by asking for the number of rows and seats on each row and display the available seats. The rows are to be identified by a number starting at '1'. The seats on each row are to be identified by a letter, 'A', 'B', 'C', etc. For example, 3C, 4A and 2D are sample seat identifiers.
Because the total number of rows and seats is unknown when the program first starts, it will be necessary sary for the program to dynamically allocate memory for the seating array and then release that memory when the program ends.
The program should ask the user to select row and seat. The program needs to verify and process only legal row and seat requests. If the seat is already reserved, the program should notify the user that the seat is taken. If the seat is available, the program should replace the seat identifier with a dash character '-'. The program should contain a loop to ask if additional seats are to be reserved. The program should also give a message when all the seats are taken. A counter must be used to keep track of and display the total number of seats purchased.
When running the program, you must use a minimum of 3 rows and 4 seats. The lab report must show these minimums. The program output must also show: a) a sample display of when more than one seat is taken, and b) another display showing a message when all seats are taken. You can use 2 rows by 2 seats for this.
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started