Assignment 10
Due: Wednesday, December 4, 2013
--------------------------------

Implementing Ticket Seller application

Minimum from Assignment 9:
--------------------------
“At the minimum you should allow for several theaters 
within the complex, at least three ticket price categories, 
at least three time slots per theater, at least five 
different movies shown.” Initialization file will have 
at least three theaters, at least three ticket prices, 
at least three time slots per theater, and at least five 
movies.

Initializing the cinema data:
-----------------------------

To test your application we will provide the initial data 
for the cinema complex. Your application should be able to 
read the file that initializes the cinema complex schedule 
for any given day. 

The file that provides the initial information will be 
formatted as follows:

Movies
"Harry Potter" 102
"Great Expectations" 115
...
Theaters
"A" 300
"B" 90
"C" 500
... 
Shows
1, 1, 960
1, 1, 1080
1, 1, 1200
1, 3, 1020
1, 3, 1140
2, 2, 990
2, 2, 1210
... 
Prices
"Adult" 10
"Child" 7
"Senior" 8
... 
End

The headings “Movies”, “Theaters”, “Shows”, and “Prices” 
will signal the change in type of data and "End" will 
indicate the end of input.

The format of this file is designed so that it can be 
generated by the user's input from a console or user's 
input from some GUI. That way the main program that manages 
the sales can be initialized by using several different 
sources of information - enforcing the model (sales 
processing) and view (user's input) separation.

The ... indicates that there could be additional entries 
of the same type. Each entry is on a separate line. This 
cinema complex is showing two movies, Harry Potter that 
runs for 102 minutes and Great Expectations that runs for 
115 minutes. The cinema complex has three theaters named 
A, B, and C with seating capacity of 300, 90, and 500 
respectively. There are three showings of Harry Potter 
(movie 1 in the list) in Theater A (theater 1 in the list) 
the first one at 4:00 pm (960 minutes), the second at 6:00 pm 
and the third at 8:00 pm. Harry Potter is also playing in 
Theater C at 5:00 pm and at 7:00 pm. Great Expectations is 
shown in Theater B at 4:30 pm and at 6:30 pm. The prices are 
always given in whole dollars, adults pay $10, children pay $7, 
and seniors pay $8.

Your programs has to include the option of initializing the 
data from a file like this, and from at least one other 
source (a GUI or a console). The input from the other source 
should first generate a sequence of String-s in the same 
format as given here - and the initialization should then 
process both sources in a uniform manner. Whether you choose 
to allow users to input from a GUI or a console, you need to 
make sure that the implementation is robust---provides 
prompts, checks for errors, handles incorrect input 
gracefully, etc.

Selling tickets, reporting on sales:
------------------------------------

Once your program reads this file (or console or GUI) it should 
be ready to respond to requests for ticket sales and the 
manager's requests for the status of the sales. It should 
respond to movie-goers' orders and at any time process 
the manager's request on the status of the sales.

Again, we specify the format of the sales requests and manager's 
requests for reports that you must use. These requests will come 
in a separate file that your program should read. Additionally, 
your program should provide at least one other way that the sales 
requests and the report requests can be generated (GUI or console) 
and these requests should be presented to the program that 
processes the sales in this format, regardless of the source 
from which the requests were issued. 

We repeat: Whether you choose to allow users to input from a GUI 
or a console, you need to make sure that the implementation 
is robust---provides prompts, checks for errors, handles 
incorrect input gracefully, etc.

The responses to the orders should be saved to a 'log' file 
your program creates and concurrently to your chosen means of 
communication with the user (again, a GUI or a console). The 
responses to orders are just numbers - the total price, or zero, 
if not enough seats are available. 

The responses to the manager's update request will also go to a file, 
separate from the order responses. Of course, you will also report 
theses to the manager via a GUI or a console (more about this below).
There should be a new file for each manager's request. We will 
specify the file name, but each request should append the file 
name with a number - 1 for the first request, 2 for the second 
request, etc.

The sales orders and the manager's requests will be co-mingled 
in one file, as the manager may want to know at 6:00 pm, what had 
happened up until now, and get a final update at the end of the 
day as well.

The order request will be in the following format:

"Harry Potter" "A" 960 2 3 0
"Great Expectations" "B" 1210 2 0 2

where the first order is for 2 adults and 3 children to see 
Harry Porter at 4:00 pm in Theater A, the second order is 
for 2 adults and 2 seniors to see Great Expectations in 
Theater B at 6:30 pm.

The response is the total price for all tickets, if there 
are sufficient number of tickets available or zero, if 
the show is sold out or there are not enough seats 
for all members of the party.

At any time the sequence of order requests may be interrupted 
by a manager's request for status. This request will be very 
simple:

"Status Update"

with no additional information given. The program should report 
the status as in a csv format as follows:

1, 1, 960,  150, 85, 15, 50  
1, 1, 1080, 120, 100, 10, 70
1, 1, 1200, ...
1, 3, 1020, ...
1, 3, 1140, ...
2, 2, 990,  50, 0, 35, 5
2, 2, 1210, ...

indicating that we have sold 150 adult tickets, 85 children 
tickets, and 15 senior tickets for the first showing of Harry 
Potter in Theater A with 50 empty seats, ... and 50 adult 
and 35 senior tickets for Great Expectations in Theater B 
at 6:30 pm, with 5 empty seats.

Example file with sales orders and the manager's requests 
co-mingled in single file: 

"Harry Potter" "A" 960 2 3 0
"Great Expectations" "B" 1210 2 0 2
"Status Update"
"Harry Potter" "A" 960 2 3 0
"Great Expectations" "B" 1210 8 0 0
"Great Expectations" "B" 1210 1 10 0
"Status Update"

Your report to the manager should use the data generated 
in response to the "Status Update" and provide humanly readable, 
understandable summaries.

We will define later what may be required, for now we want 
you to think about what kind of report the manager may want 
and add that to your design.

We will provide a 'program starter' class that will include 
a 'main' method that will invoke a method call to a static 
method 

TicketSeller.start()

in your program.

The final version of this part of the assignment will be 
ready next week, once the WebCAT server is ready for 
submissions.

—————————————————————————————————————

Collaboration between students is forbidden on this 
assignment. You are responsible for keeping your code 
hidden from all other students. You will submit this 
assignment within Web-CAT.

Your files of Java code should begin with a block comment 
that lists:
    1.  Your name, as you want the instructor to write it.
    2.  Your email address.
    3.  Any remarks that you wish to make to the instructor.

Part of your grade will depend on the quality and 
correctness of your code, part will assess the tests you 
design - especially the test coverage, part will depend on 
the readability of your code (comments and indentation), 
and part will depend on how well you follow the procedure 
above for submitting your work. Assignments submitted 
between 12:00 am and 11:59 pm the day after the due date 
will receive a 20 percentage point penalty on the assignment. 

For this assignment, you will submit the following:
 - Your code for the Ticket Seller application.
 - Your requirements document and design document with any 
     updates. If there are updates to these documents, you 
     should note why the changes were made.