Objectives: Design a comprehensive program that utilizes inheritance and polymorphism. Details (Changes are displayed in blue) This project will use classes to create a doubly linked list The seating arrangement for each auditorium will be stored in separate files. These files will be named A1.txt, A2.txt and A3.txt for auditorium 1, 2 and 3 respectively. Each line in the file will represent a row in the auditorium. The number of rows in each auditorium is unknown to you. The number of seats in each row of a single auditorium will be the same. For example, if the first line of the file has 15 seats, then every subsequent row in the theater will also have 15 seats. This does not mean that each auditorium has the same number of seats in each row. One auditorium may have 15 seats per row and another may have 20 seats. Empty seats are represented by a pound sign (#). Reserved seats are represented by a period (.). Each file should be read into memory and stored in a linked list o For each auditorium, you will have 1 linked list (instead of the 2 linked lists of project 3) o The list should be sorted by row and seat number – all row 1 seats grouped together in order by seat, then row 2, etc. Ticket prices are as follows: o Adult - $7.00 o Senior - $5.00 o Child - $3.00 If the user is reserving seats, ask the user for the row and seat number of each seat. If all seats selected are available, reserve the seats. o The seats selected by the user do not have to be consecutive o If all of the desired seats are not available, offer the user the best available consecutive seats for the number of tickets desired in the entire auditorium. The best available seats are the seats closest to the center of the auditorium. Think of the distance between 2 points For simplicity, use the distance between the first seat of the section and the center. In the event of a tie for distance, the row closest to the middle should be selected. You may develop this piece any way that you see fit. Please try to be as efficient as possible with the memory. o If the user declines the best available seats, return the user to the main menu. o If the user accepts the best available seats for that row, reserve them. Tickets can only be reserved the day of the screening and all screenings are at 7 PM that night. There is no need to worry about multiple screenings or reserving seats on a specific day. At the end of the program, overwrite the original files with the new information Classes The members to be included in each class are listed below. All classes should have an overloaded constructor, mutators and accessors. Other functions may be added to the class. Please
remember that class functions should be generic enough to be used in any situation. Functions that solve a specific problem for this project should be defined in main rather than the class. Linked List o Head (Node pointer) o Tail (Node pointer) o overloaded [] operator o overloaded += operator Base Node (abstract) o Row (integer) o Seat (integer) Reservation Node - Inherited from base node o Reservation status (Boolean) o Next (Node pointer) o Prev (Node pointer) o Overloaded << operator o Overloaded >> operator Overloaded Operators For all overloaded operators, include comments at the top of main.cpp including line numbers where each operator is used += operator o Adds a node to the end of the linked list [] operator o Treat the linked list like an array o First node will be [0] o Return a pointer to the node indicated inside the brackets >> operator o Read the symbol from the file o Store correct value for reservation status based on symbol read in file << operator o Print out correct symbol based on reservation status User Interface and Input: Present a user-friendly menu system for the user to reserve seats. 1. Reserve Seats 2. View Auditorium 3. Exit Although in reality the user would likely only make one purchase, for testing purposes, assume the user will repeat the ticket buying process until they decide to quit. After the user has selected a non-exit option, present the user with a menu to select the auditorium. 1. Auditorium 1 2. Auditorium 2 3. Auditorium 3 Once the auditorium has been selected, display the current seating availability for that auditorium. An example seating chart is provided below for an auditorium with 5 rows and 20 seats per row. 12345678901234567890 1 ...##..#####........ 2 ########....####..## 3 .........##......... 4 #.#.#.#.#.#.#.#.#.#. 5 ########.#####.##### The seats are numbered sequentially from left to right and only the ones digit is displayed above each column to make it easier to display the chart. It is understood that the second set of digits from 1-0 are for the numbers 11- 20 in the above example. After the user has selected the auditorium and the seating chart has been displayed, prompt the user for the following information in the order below: IN ORDER TO GRADE THE PROJECTS QUICKLY, PLEASE PROMPT FOR THE INFORMATION IN THE FOLLOWING ORDER. PROMPTING FOR INFORMATION IN A DIFFERENT ORDER (OR ADDING EXTRA PROMPTS) WILL CAUSE THE TEST CASES TO FAIL FOR YOUR PROGRAM. THERE WILL BE VERY LITTLE TIME FOR CORRECTIONS AND REGRADING DUE TO THE END OF THE SEMESTER. Total Number of tickets How many adult tickets How many senior tickets How many child tickets Loop (iterations = total number of tickets) o Row o Column Do not prompt the user to enter the number of tickets for a category if the total number of tickets has already been met. For example, if the user wants to buy 4 tickets, and selects 4 adult tickets, there should be no prompt for senior or child tickets. If the desired seats are not available, offer the user the best available seats that meet their criteria in the entire auditorium. The best available seats are the seats closest to the middle of the auditorium. Prompt the user to enter a Y to reserve the best available or N to refuse the best available. Once the selection has been processed, return to the main menu. When prompting the user for input, expect anything. Do not assume any input will be valid. If you ask for a number, the user could put in a floating point number, symbols or maybe even the Gettysburg Address (or at least a sentence or two). Make sure that your program handles proper validation. You may validate with strings or Cstrings; the choice is yours. Output: At the end of the program, write the current status of each auditorium to the proper file. Also display a formatted report to the console. The report should consist of 7 columns: Column 1 – labels o Auditorium 1 o Auditorium 2 o Auditorium 3 o Total Column 2 - Open seats: number of all open seats for each label Column 3 – Total reserved seats: number of all reserved seats for each label Column 4 - Adult seats: number of all adult seats reserved during this session for each label Column 5 - Senior seats: number of all senior seats reserved during this session for each label Column 6 – Child seats: number of all child seats reserved during this session for each label Column 7 – Ticket sales: total amount of ticket sales during this session for each label
Aucun commentaire:
Enregistrer un commentaire