Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

This program must be coded in C++. Write an object-oriented program that can be

ID: 3633011 • Letter: T

Question

This program must be coded in C++.


Write an object-oriented program that can be used by a small theater to sell tickets for its performances. The auditorium has 15 rows of seats, with 30 seats in each row. Design and create a class called Theater to encapsulate the functionality specified below.

When the object is created, read the seat prices for each row from a file called seats.txt. Prices in this file will be stored as values of type double, with one price per line and one price for each row. The price for Row 1 will be listed first, the price for Row 2 will be listed second, and so on. The prices can be stored in an array.

After the prices have been read, the program should display a seating chart similar to the one shown below, except your rows should be labeled starting at 1 instead of 0. For example, the following image shows a chart depicting each seat in the theater. Seats that are available are represented by the # symbol, whereas those that are taken are represented by an * symbol.


Finally, the program should enter a loop to display a menu system with options that allow the user to:

(1) Purchase tickets
(2) Display the total dollar value of all tickets sold
(3) Display the total number of tickets sold
(4) Display the number of seats available in each row
(5) Display the number of seats available in the entire auditorium
(6) Display the current seating chart
(7) Exit the system

To purchase tickets, the user must enter the row and seat number of the desired seat. Do not accept row or seat numbers that do not exist. In addition, do not sell seats more than once: when the user requests a particular seat, make sure that seat is available before it is sold. The user will continue to enter row and seat numbers until a value of -1 is entered for the row, indicating that he or she is finished purchasing tickets. The program should then display the total dollar value of all tickets sold, including the tickets just purchased, and return to the main menu. Notice that this value is not the price of that customer’s tickets alone but rather how much money the theater has brought in so far for this show.

Explanation / Answer

#include #include using namespcae std; class Theater { public: void purchase_tickets(); void display_total_value_of_all_tickets_sold(); int main () { ifstream ifs; ifs.open("seats.txt"); if (ifs.fail()) //if the opening of the input file fails, the program exits { cout > x; const int nrows = 15; const int ncols = 30; char theater[nrows][ncols]; for (row = 0; row one_seat; theatre[nrows][ncols] = one_seat; } } do { int choice; cout
Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote