Documentation.docx
Object Oriented Programming Team Work Assignment

Team Name:
MegasXLR.
Team Members:
BonchoValkov, Stefan Geshakov, VeselaParvanova, Anna Velcheva
Repository URL:
https://megasxlr.codeplex.com/
Project Purpose:
The project is a system for management of the ticket selling process in a theatre. The purpose is to enable the theatre to keep track of the process and get information about various aspects of it. For example, how many tickets each seller sold and which seats for a given performance are already taken. If a customer desires, he can also have an account with the theatre, in order to receive discounts for the tickets he/she buys. The calculation of those discounts is also made by the application.It ensures that no duplicate seats are sold and that each ticket has a unique number. It helps printing tickets and seating charts of a performance, together with the seats that are taken and those that are free. It keeps information about the number of tickets sold by a seller and calculates its salary on the basis of this.
Class diagram and clarifications:

The abstract class Customer comprises the main logic behind each of the classes that inherit it. These are Regular Customer, Silver Customer and Gold Customer. Each Customer has a first name, a last name, an optional telephone number, a count for the attended performances which is increased with the method AttendPerformance and an abstract method GetDiscount, which calculates the discount of the customer on the basis of the attended performances. The GetDiscount method is also defined in the IDiscountable interface, its idea being that other classes that describe people entitled to discounts can be added later, for example groups of people.
The other main classes are Hall, Performance and Ticket, each representing the respective object in the theatre. The ticket has the fields name of the play, a date of the performance, name of the hall, price, seat place and optionally the name of the customer. Most importantly it has a unique number, which will be explained below. The Performance class has the fields play, time, hall name, price and a seating chart, which it draws from the seating chart of the Hall upon the creation of the new performance. It implements methods for checking if a seat is taken and for making a seat taken. The Ticket class and the Performance class implement the IPrintable interface, which defines the method PrepareToPrint. The purpose is that this method will convert the ticket or the seating chart of all the taken seats of a performance in a form adequate for a printer.
The abstract class Employee is inherited by the Seller class, giving the option to add other employee classes. The Seller class has fields for bonus rate, tickets sold and the base of the salary. The seller is the employee that implements the IFlexibleSalary interface, which will be implemented by any employee, whose salary depends on their productivity and has the method CalculateSalary.
The seat in a given performance is defined in the struct Seat. The Plays are listed in the enumeration Play.
The class MainTheatreSystemis the heart of the application. The other classes are not supposed to have access to each other, which is why their fields do not include any objects of the custom classes. For example, the Ticket class does not include a Performance field, but instead it has a date, name of the Hall, represented as a string and Play. It also does not hold its Customer as an object in a field, but once again only the name, once again represented as a string. The MainTheatreSystem coordinates this. It holds lists of all the objects of the classes Hall, Customer, Seller and Performances. It has methods to find by name or date any of those objects if they are necessary and methods to add new objects. It also keeps dictionaries of the created objects of the class Ticket so that tickets can be found fast by name of customer, seller who issued them and performance.
There is one more class which is a link between all the other classes besides the MainTheatreSystem and this is the TicketFactory, which implements the factory design pattern. The Ticket is a class that has a lot of information and has quite a complicated constructor. It also requires a unique ticket number, which is secured by a static field, which increases with one each time a new ticket is created. Moreover, upon the creation of a ticket, this ticket needs to be placed in the ticket repositories in the Main System. The Customer object needs to be updated with the information that the customer bought a new ticket and the Seller object has sold one more ticket. The Performance object’s seating chart needs to be updated with the seat taken. The Ticket Factory takes care of all of this and channels the complicated process of creating a new ticket.
The application also has two custom exceptions: SeatDoesNotExistException and SeatTakenException, which may be thrown if we attempt to make a new ticket for a seat that is taken or not existing.
If a Customer object is a RegularCustomer or a SilverCustomer, after a certain amount of purchased tickets, it can transform from a Regular to Silver customer or from Silver to Gold. This is implemented with an event which follows the count of the attended performances and if the threshold of performances is passed, it creates a new Customer object, using the data of the old and removes the old Customer object from the list of Customers. The old Customer object is not present as a reference anywhere else, in any of the fields of the other classes and the dictionary used to keep the information about the tickets bought by the customer use only the string representation of the name as a key, not the object itself. This is why this transformation is not a complicated process.
The application also has a not fully developed console-based interface.
Diagram.jpg
Documentation.docx

Last edited Mar 19, 2013 at 10:57 AM by BonchoValkov, version 5

Comments

No comments yet.