Question: Write a C++ program that can be used by a small theater to sell tickets for performances. The theaters auditorium has 15 rows of seats
Write a C++ program that can be used by a small theater to sell tickets for performances. The theaters auditorium has 15 rows of seats with 20 seats in each row.
The program should have a FUNCTION that displays a screen that shows which seats are available and which are taken. Available seats represented by a * and seats that are taken should be represented by a #. All seats available upon beginning. (HINT: The seating chart should be a two dimensional array.)
Here is an ex. of the starting seating chart
Seats: 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19
Row 0 * * * * * * * * * * * * * * * * * * * *
Row 1 * * * * * * * * * * * * * * * * * * * *
Row 2 * * * * * * * * * * * * * * * * * * * *
Row 3 * * * * * * * * * * * * * * * * * * * *
Row 4 * * * * * * * * * * * * * * * * * * * *
Row 5 * * * * * * * * * * * * * * * * * * * *
Row 6 * * * * * * * * * * * * * * * * * * * *
Row 7 * * * * * * * * * * * * * * * * * * * *
Row 8 * * * * * * * * * * * * * * * * * * * *
Row 9 * * * * * * * * * * * * * * * * * * * *
Row 10 * * * * * * * * * * * * * * * * * * * *
Row 11 * * * * * * * * * * * * * * * * * * * *
Row 12 * * * * * * * * * * * * * * * * * * * *
Row 13 * * * * * * * * * * * * * * * * * * * *
Row 14 * * * * * * * * * * * * * * * * * * * *
Each row in the auditorium has a different ticket price. So tickets in row 0 may be 5.00 each and tickets in row 1 maybe 10.00 each. Your program should have a FUNCTION that reads the ticket price of each row from an input file called prices.txt. The ticket price for each row should be stored in a one dimensional array.
The program should have variables tracking the total number of tickets sold and the total revenue for all tickets sold.
The program should allow the user to buy tickets one at a time. The user should be able to buy as many tickets as they would like. Do this with a menu asking the user if they would like to 1) Buy ticket or 2) Total sell and exit. Validate input data if necessary. If 2) is selected, print total tickets and total revenue and exit. If 1) is selected, to allow the user to buy a ticket the program should have the user enter a row number and a seat number for the ticket they would like to buy.
The program should check to see if the seat is available. If the seat is taken the program should not allow the user to buy the ticket. If this happens, print a message accordingly and prompt the user to see if they would like to buy another ticket.
If the seat is available the program should update the seating chart by putting a taken symbol (#) in that seats position. It should then look up the row price for the seat sold then update the revenue and total tickets sold variables accordingly.
Once the user is finished buying tickets print out an updated seating chart followed by the total tickets sold and the total revenue generated from those tickets.
NOTE:
Use two arrays in this program, one for the seating chart and one to store the prices for each row. Also use the two functions:
one to display the seating chart and one to read in the price per row data and store it in the array with the prices for each row in it
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
