Hi. I am a C++ Student in college, enrolled in a simple C++ programming course. In class, the lectures have been about Arrays, Structs and Classes. My professor assigned a program that (to me) is IMPOSSIBLE. I CANNOT FIGURE IT OUT. Before I describe this project, I DO NOT, repeat, DO NOT want a program written. I would, however, like a guideline that puts me in the right direction. As of now, I have no clue how to even begin. Any kind of input, big or small, (even a little encouragement) is GREATLY appreciated.
Here is the project:
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. (I would probably make a multi-dimensional array here, I'm assuming.. int seats [15][30].. ? ). Design and create class called Theater to encapsulate the functionality specified below.
When the program begins, read the seat prices for each row from a file called seats.txt (here I'm guessing, I should do:
)Code:ifstream in_stream; in_stream.open(seats.txt); if (in_stream.fail()) //if the opening of the input file fails, the program exits { cout << "Input file opening failed. \n"; exit (1); } int x; in_stream >> x; //I have NO clue what i"m doing here actually. How do I make an in_stream read from this text file?
Prices in this file will be stored as a values of type double, with once 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 dispaly a seating chart similar to the one shown below. 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. Exist the system
(Here I'm guessing I would use the SWITCH branching mechanism..)
To purchase tickets, the user must enter the row and seat number of the desired seats. 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 availabe before it is sold. The user will continue to entre row and seat numbers until a value of -1 is entered fro the row, indicating that he or she is finished purchasing tickets. (Here, I'm guessing I would search the array using the sequential search algorithm). The program should then display the total dolalr value of all tickets sold, including the tickets just purchased, and return to the main menu.
Again, I know this project is a tough and long one, but ANY kind of input for a pathetic C++ beginner is GREATLY appreciatd