![]() |
![]() |
|
02115 Java Programming | ||
Autumn 2011 |
The model of your system must contain the class CinemaSystem
holding a set of public methods - if convenient only a
main
method - together with the additional
classes you find appropriate.
The user interface has to handle two different kinds of users:
The final solution must have both a command line based user interface and a
GUI, just as illustrated with the address-book family of
projects in Chapter 12 of the BK textbook. It's important to
state that the same system model should be used without needing any
changes when switching between the two user interfaces.
In the first part of the assignment develop the system with a command
line based user interface where commands are written one by
one and then read, parsed and executed. That interface is
well-suited for testing the model.
In the second part of the assignment a GUI interface has to be
added. The choice of user interface offered to the customers
is probably a matter of system setup done by the administrator.
Feel free to make your own proper choice which also allows a switching
between the two interfaces.
The system could be considered a kind of client-server system where
customers are the clients, the audience.
The model of the system should have the following main properties:
1
2
... 999999
Mon
Tue
Wed
Thu
Fri
Sat
and
Sun
ADMIN
, some are applicable
only to the customers - user mode equals CUSTOMER
, and some
may be used by both.
When program execution starts only administator commands must be executed.
Command | Parameters | Description |
mode
| user | The command sets the user to be either administator or customer. The parameter user has to be either ADMIN or
CUSTOM |
addCinema |
cinema name | The command adds a cinema hall to the system - user mode
must be ADMIN .The parameters are: The cinema name identifying the cinema, the number of rows of seats in the cinema (≤ 30), the number of seats of each row (≤ 20) given by rowLength and the number of tables (≥ 0 and ≤ 25) |
rows | ||
rowLength | ||
number of tables | ||
addShow |
film name | The command adds a show to the system - user mode
must be ADMIN .The parameters are: The film name identifying the film to be played in the cinema given by cinema name on the days stated by day names. The day names is a list of days, e.g. Mon Thu Sat
|
cinema name | ||
day names | ||
addFrom |
file name | The command adds from a file cinema halls and shows to the system
- user mode must be ADMIN .The parameter file name identifies the file holding informations on the cinemas and shows to be added: Each line of the file holds either an addCinema command
or an addShow command
|
load |
file name | The command initializes the system with the state previously
stored in a file by use of the save command
below - user mode must be ADMIN .The parameter file name identifies the file holding informations on the defined cinemas, shows and bookings done in a previous run of the program where the state has been saved to that file |
save |
file name | The command saves the state of the system in a file -
user mode must be ADMIN .The parameter file name identifies the file which should hold informations on the defined cinemas, shows and bookings done in the actual run of the program |
when |
film name | The command lists the names of days on which the film identified by film name is shown. All shows are searched |
where |
film name | The command lists the names of all cinemas showing the film identified by the specified film name on the day specified by day name |
day name | ||
tables |
day name | The command lists the names of all cinemas having free tables together with the actual number of free tables for each cinema on the day specified by day name |
book |
person name | The user mode has to be CUSTOM The command either books a number of seats in a cinema hall for a film shown in that cinema on the day specified or a table attached to that cinema on that day. The command takes 3 or 5 parameters: The person name to identify the person doing the booking, the cinema hall given by cinema name, the day stated by day name, and when booking for a movie screening and not just for a table then also the film name identifying the movie screened and last the number of seats to be booked |
cinema name | ||
day name | ||
film name | ||
number of seats | ||
show |
booking number | List booking informations corresponding to the
stated booking number |
showAll |
person name | List all bookings done by the specified person name Each booking should be presented in the same format as that used by the show command but preceded with the
corresponding booking numbers for each booking information |
exit |
Stop running the program - the user mode has to be ADMIN |
addCinema
and/or
addFrom
addShow
and/or
addFrom
ADMIN
mode the administrator may use the
commands save
, load
and
exit
load
as the very first command in a new run
when it should be a strict continuation of the system state after
a save
from a previous run.
book
command used with 5 parameters is for
reserving seats to a show.
The book
command used with 3 parameters is for
reserving a table.
The methods responsible for the execution of the commands should
of course for each command store the resulting data in proper chosen
objects some of which should be elements of collections
addCinema City_Theatre 25 10 15 addShow The_Hidden_Person City_Theatre Mon Wed mode CUSTOM when The_Hidden_Person tables Mon book Peter_Thomsen City_Theatre Wed The_Hidden_Person 5 book Peter_Thomsen City_Theatre Wed showAll Peter_Thomsen mode ADMIN exit
Comments on the example commands above:
addCinema
command adds the cinema hall 'City Theatre' to the
system stating that the cinema theatre has 25 rows of seats with
10 seats in each row and 15 tables to be offered for booking._
denotes a space character
addShow
command adds the two shows specified by the
parameters to the system
mode CUSTOM
command sets the system into
CUSTOMER
mode to allow booking commands to be entered
by some customer
book
commands are needed because
Peter_Thomsen
wants to book both some seats and
a table. The two bookings are added to the system and
identified by booking numbers 1
and 2
,
respectively
addCinema
command one has to make sure
that
ADMIN
30
20
ADMIN
or CUSTOM
An attempt to execute an illegal command should cause an error reaction. Be aware of the fact that not all command sequences are legal.
The execution of legal commands will cause a state change of the
cinema booking system, except for the commands when
,
where
, tables
, show
and
showAll
.
The execution of a legal book
command will couple
a unique booking number to the booking made. This
number may later be used in the show
command to identify
and look up a booking.
Bookings can also be looked up by a showAll
command
having a person name as parameter.
Analyse the need to uniquely identify a person by his/her
person name
How flexible is your design ?
Choose the collection classes guided by the requirements set by
the commands to ease the execution of the commands (e.g. introducing
maps for easy look ups)
Would it be easy to add more theatres to a cinema ?
You are not allowed to use tools which automatically generate classes.
But tools supporting your editing of source code are allowed.
So all Java code including the
GUI parts has to be handwork. The GUI must not be constructed
using a drag and drop tool. So, you are not allowed
to use the NetBeans IDE's GUI builder, because that tool lets you
visually construct your Graphical User Interface.
Newest edition: 23. November (some minor language corrections)
Previous editions:
- 10. October (one minor language correction)
- 6. October (NetBeans IDE's GUI builder is not
allowed to use)
- 5. October