Assignment 2 - Ticket Management System Extended
Assignment 2 - Ticket Management System Extended
Extended
Introduction
Welcome to the second assignment for COMP90041 - Programming and Software Development! See
a brief introductory video here.
An error occurred.
Customer Operations - A customer can perform all the operations that were allowed in the
previous assignment and some more -
Due to the change in specifications and operations performed, there are certain changes introduced
to Concert and Seats as well
the total capacity for concerts can be set based on seat layout at the beginning
seat capacity decreases with more tickets booked
For simplicity, all concert has the same venue layout despite they are at different locations. This
means that if there are 3 concerts, there should be 3 venues as the seats booked will be different in
each one but the layout will remain the same for all three of them for sake of simplicity.
Preamble: "The Specifications"
The slides from this lesson module for the assignment act as "the specifications" for the system we
are about to build.
"The specifications" in real-life software development is the document that details the features that
should be implemented in any particular project. They are the features and requirements that you,
the Software Developer, and the client have agreed should be implemented in the system.
As such, you should read these specifications carefully and ensure that your program implements the
requirements of the specification correctly.
Tests will be run on your program to check that you have implemented these specifications correctly.
Note that for Assignment 2, we will provide 10 visible tests that you can run to check that the basic
functionality of your system is correct. However, there will also be 10 hidden (i.e., invisible) tests that
we will run when assessing the correctness of your code. So once your program passes the basic
tests, we strongly recommend that you perform further tests yourself, to ensure that the required
features have been implemented correctly.
Some of the specifications will be referred back from Assignment 1. This will be notified using a
green strip as shown below -
Other specifications can be referred from Assignment 1 with slight modifications. This will be
notified using a yellow strip
New additions to the assignment will be marked using blue callouts like below-
Lastly, sometimes a developer thinks exhaustively and engages in continuous discussion with
people to gather more information. We try to keep certain use cases out of scope as they bring
more complexity to the system. Some advanced developers can cope through it but we would
like to keep some things simpler for beginners. Please read carefully through the out-of-scope
specifications as well. This may be embedded as a red strip in the specifications sometimes.
Out of Scope Scenario: This scenario ........ is out of scope for this assignment
Other than this, we will use the general informational, warning, error, and assumption callouts
using blue, yellow, red, and green coloured callouts.
Also, note that the code snippets have some characters in bold that represent the inputs to the
program.
Students can assume that test cases only contain outputs that are explicitly part of specifications. The test
cases, visible or hidden, do not produce any output that is not mentioned in the specifications explicitly. Please
note that the specifications will give you warnings and important notes where we expect special input
handling. You should observe those and implement them accordingly as they will be tested while marking your
program.
Preamble: Intended Learning Outcomes
The Intended Learning Outcomes for this Assignment are mentioned below -
Control Flows - use branching and looping to navigate the special use cases in specifications.
Classes - identify the entities and encapsulate their data and actions together in a class.
Static Variables & Methods - identify and implement a use case that can be solved using static
variables and methods
Arrays - to use 1D and 2D arrays and perform associated operations
Packages - identify and group logical entities(classes) together
Javadoc - generate javadocs from comments used in classes
Inheritance - implement polymorphism correctly as per the scaffold code provided.
ArrayLists are prohibited. In Assignment 2, we want to test your ability to work with array, array
indices and adding and removing items from an array. ArrayLists provide all these capabilities out of
the box and hence are prohibited from use in this assignment. ArrayLists and other Collections types
will be covered in the next assignment.
A warning to those who have previous programming experience in other programming languages (like C or
Python) that follow a procedural programming paradigm: Be careful to develop your program using object-
oriented principles, as programming and structuring your code in a way that is not object-oriented is an easy
way to lose marks for structure in the assignments.
Preamble: Structure and Style
We will also be assessing your code for good structure and style.
Use methods when appropriate to simplify your code, and avoid duplicate code.
Use correct Java naming conventions for class names, variable names, and method names and
put them in a well-organised way in your code i.e. it should be readable as well. Look at the
conventions provided by Oracle here.
Code structure in a file is very important and improves readability. Look at the code organisation
conventions provided by Oracle here.
Make sure the names you choose are meaningful, to improve the readability of your code.
Ensure to add meaningful comments in between your code and Javadoc comments for classes and
methods.
We will provide a marking scheme to help guide you in the development of your program.
Academic Honesty �
All assessment items (assignments, tests, and exams) must be your own, individual, original
work.
Any code that is submitted for assessment will be automatically compared against other
students' code and other code sources using sophisticated similarity-checking software.
Cases of potential copying or submitting code that is not your own may lead to a formal
academic misconduct hearing.
Potential penalties can include getting zero for the project, failing the subject, or even expulsion
from the university in extreme cases.
For further information, please see the university's Academic Honesty and Plagiarism website,
or ask your lecturer.
Main Program Execution
Your main program has slightly changed. Below are the specifications of how your program will be
run initially.
Carried Forward: The section mentioned below is same as Assignment 1. Refer to the slides here
Inputs
Your program must take command line inputs in the order mentioned below.
This means when you compile your program and run it, the command on the terminal should look
like this
javac TicketManagementEngine.java
java TicketManagementEngine 5 4 5 4
In case there are insufficient inputs (missing input) or if any of the input is 0 or negative, then exit the
program by printing the error message -
javac TicketManagementEngine.java
java TicketManagementEngine 5 4 5
Invalid Inputs to set layout. Exiting the program now.
Note that in Assignment 1 the display message was being printed before the Invalid Inputs error
message. But this is fixed now in Assignment 2. Please change your code accordingly.
To start with the Ticket Management System, you will need to print the display message. This part of
the code is already provided to you. You must not remove this from the files.
Our program must run in either Customer Mode or Admin Mode. Our main menu has changed to the
following :
Once the user has selected either Customer mode or Admin mode we will show them their respective
menu so they can choose the operations available to them.
Exit Option
In case, the user selects option 3, you must gracefully quit the program and print a goodbye message.
Look at the complete output below.
Invalid Command
In case, someone provides an invalid input like 4 or 7, you should be able to print “Invalid Input” and
prompt the user again with the menu to select a valid input again. Sample output
Out Of Scope: Note that we only expect integers as input to this menu. There can be invalid integers that you
need to handle, but there won't be any exceptions due to String/double or any other data type mismatch
input provided to your program.
Customer Main Menu
Once the user has chosen customer mode, we should show a slightly modified version of the menu
that we have shown in Assignment 1. The first 4 menu items remain the same as in Assignment 1.
There is an addition of menu item 5 and the exit option is now changed to menu item 6.
If the user selects option 1, you must show the below details to the user.
Assumption: For option 2,3,4,5 whenever we need to select a concert to do a further action, the input for
selecting the concert will always be correct ie in the above case either the concert selected would be 1 or 2 but
never 3.
Things to note -
1. Notice that there are two additional columns - Seats Booked and Seats Left.
2. The Total Seats are now set based on the Venue Layout input you have taken from the
command line. In this example, the command line arguments were 5 4 5 4 which means we
have 5 rows and total seats per row as 4+5+4 = 13 . Total seats for the venue are 13 x 5 = 65
as shown in the above output.
3. Every time a seat is booked, Seats booked should be increased and Seats Left can thus be
derived from Total Seats - Seats booked.
4. Admin can add more concerts, so you must not hard code anything and handle it accordingly.
See more in the Admin Section.
5. You must preload two concert details at the beginning of your program. See here.
Your seat layout is divided into three sections - Left, Middle, and Right. Ticket cost varies as per the
sections. This was discussed in the previous Assignment. However, the prices of seats can vary for
different concerts. When the user selects input 2 from the main menu, you must ask the customer
which concert they want to see the prices for and then show the prices for those concert seats
accordingly.
Note that if we choose concert 2 a different price will be shown. If the admin chooses to update the price of a
concert, the prices will change and they should reflect correctly the next time the customer wants to see the
price.
When the user selects option 3 from the main menu you must ask the customer which concert's seat
layout they want to see. Different concerts can have different bookings. Print the seat layout per the
seat settings provided as input in the command line arguments and seats that have already been
booked. Look how show timings also show the changes in Seats Booked and Seats Left.
Initially, when no booking is made, the seats are empty as mentioned in Assignment 1.
Option 6: Exit
Modifications : Do not exit from the entire program.
When you exit from the customer menu, you do not exit from the program. However, you must go
back to choosing customer or admin mode. The program can continue to switch to admin mode or
reselect the customer mode. All the changes made in a session remain available for other sessions. If
a concert is added or prices are updated by an Admin, they must be visible to customer if we switch
from admin mode to customer mode. See the output below
Select an option to get started!
Press 1 to look at the show timings
Press 2 to look at the ticket costs
Press 3 to view the layout of the concert
Press 4 to book seats
Press 5 to see the price for selected seats
Press 6 to exit
> 6
Exiting Customer Mode
Select an option to get started!
Press 1 to enter Customer mode
Press 2 to enter Admin mode
Press 3 to exit
>
Book Tickets & Prices
Modifications: Three major changes. First, you need to select the concert for which the seat is booked.
Second, you need to select X to book the seat and continue with the other seat selection. Third, The menu for
W/A/S/D/Q is now changed into one single statement.
Once the user selects option 4 to book the tickets we must allow them to select a concert before they
can select a seat. You can then prompt the user with a menu to move around the seating selection.
To select a seat you may need to move around the layout and mark your seat. The cursor is marked
by X. A seat booked is marked by B. As you move around the seat layout, the X moves.
Tip: in this case you will expect a String input - w/a/s/d/q/z. This can be upper or lower case. You must
handle the input accordingly.
By default, the leftmost available seat is pre-selected. If the leftmost seat is booked, the next available
leftmost seat is available. Look at the output below.
Select an option to get started!
Press 1 to look at the show timings
Press 2 to look at the ticket costs
Press 3 to view the layout of the concert
Press 4 to book seats
Press 5 to see the price for selected seats
Press 6 to exit
> 4
Select a concert that's price needs to be updated
Show Timings
-------------------------------------------------------------------------------------------------------
# Date Artist Name Timing Venue Name Total Seats Seats Bo
-------------------------------------------------------------------------------------------------------
1 2023-07-01 Taylor Swift 1700-1900 Melbourne Cricket Ground 65 1
2 2023-07-02 Taylor Swift 1900-2100 Marvel Stadium 65 0
-------------------------------------------------------------------------------------------------------
> 1
Continue to the seat selection!
You can select the seat that are empty and marked by _
[BX__ _____ ____]
[____ _____ ____]
[____ _____ ____]
[____ _____ ____]
[____ _____ ____]
Press W/S/A/D to move up/down/left/right. Press Z to select, Q to quit.
>
Carried Forward: Below section is same as Assignment 1. Refer to the slides here
Invalid Input
Movement - Right/Left/Top/Bottom
Invalid Moves
Special Moves
Exiting from Seat Selection - The selected seat is now marked with B instead of X.
Since the customer can book multiple seats, and the cursor X can now move around to book other
seats, we need to select the seat the customer wants to book. To select a seat, we will use option Z.
Once a seat is booked, the seat is marked by B. The cursor then moves to the next available seat.
Customers can then navigate around to book more seats. See the output below -
Prices
Addition: This specification is entirely new to Assignment 2.
When the user selects menu item 5, you must find all the seats booked for a concert and then find
the total pricing of the booked seats per the prices for different seating zones (Left/Middle/Right). For
example, for the seats booked in the previous section,
the price is calculated as 2 x left zone price for concert 1 (ie 200) + 1 for the middle zone price for
concert 2 (ie 500). = 2 x 200 + 500 = 900. See the output below -
If a concert is selected where no booking has been made simply show the error message - No
bookings made for this concert
2. If a seat is booked already and the user comes back to select more seats - the left most available
seat should be selected.
1. If an entire row is booked, where should be the marker X? Perhaps the next row. But this won't be
tested.
2. If a seat is booked and then a few seats later another seat is booked and you are navigating right to
left or left to right in the same row.
3. If a seat is booked in the middle of rows and you are moving up to down or down to up.
4. When booking seats, if you are booking the bottom right seat, there is no place where the cursor X
can go next. Thus, this case is not tested.
5. Also, with booking a seat, if the seat to be booked is to the immediate left of another seat, X skip
the seat on the right to get to the next available seat. This is complicated to implement and won't be
tested.
For use cases 2 and 3 your code may produce incorrect output like this if not carefully implemented
and hence they are out of scope. See the Booked seat in the middle section is overwritten by marker
X.
-------------------------------------------------------------------------------------------------------
# Date Artist Name Timing Venue Name Total Seats Seats Bo
-------------------------------------------------------------------------------------------------------
1 2023-07-01 Taylor Swift 1700-1900 Melbourne Cricket Ground 65 0
2 2023-07-02 Taylor Swift 1900-2100 Marvel Stadium 65 0
-------------------------------------------------------------------------------------------------------
For Concert 1
Left - 200
Middle - 500
Right - 250
For Concert 2
Left - 100
Middle - 300
Right - 150
Well, think of Object Oriented Programming. You must create some classes and instances of those
classes and use some kind of print statements to print the data from those instance variables' getters.
To set the data you invoke the setters.
Out of Scope: You don't have to validate the date times are correct. They are just treated as strings. We will
pass the correct format as yyyy-MM-dd and HHmm-HHmm as inputs to your program.
Admin Menu
admin can view the concerts (same as Option 1 of the customer menu)
admin can add a concerts
admin can remove a concert if no booking has been made for that concert
admin can view the costs of the seats for a concert (same as Option 2 of the customer menu)
admin can change the price of the seat sections
admin can look at the seat layouts with bookings (same as Option 3 of the customer menu)
If the user selects the Admin mode, you must print the below menu as output -
Option 1:
Same as customer mode Option 1
Option 4:
Same as customer mode Option 2
Option 6:
Same as customer mode Option 3
Option 7:
Same as customer mode but the message is changed to Exiting Admin mode. See output below -
Option 2:
When the admin selects option 2 they should be able to add a concert. They must take all the details
for the concert as inputs. Note that the total seats remain the same as the venue layout is set by
command line parameters. And seats booked are set to 0 initially but are dynamically changed when
the customer books a seat. See the program output below -
You should show this concert added to the admin and customer if they choose option 1 now. Look at
the output below -
Assumption: For options 3,4,5,6 whenever we need to select a concert to do a further action, the input for
selecting the concert will always be correct i.e. in the above example either the concert selected would be 1,2,
or 3 but never 4.
Option 3:
Admin can remove a concert if no booking has been made for that concert. But if a booking is made
already, then admin should not be able to remove the concert and an error must be shown. To
remove a concert you must show all the concert details to the admin and ask which concert to
remove. See the program output below.
In case a booking is already made then you should show the error - Concert cannot be removed as
tickets are booked for this concert.
Option 5:
If the admin wants to update the price of seats for any concert using option 5, you must ask them to
choose a concert and then ask them the prices of all three zones. Look at the output below
Note that the admin can change the prices of seats for a concert where the booking has already been
made. In that case, if the prices change the customer should see the updated final price for the seats
booked. See the output below that the previous price changed from 900 to 300 now.
Out of scope: In real world scenario, the prices of the tickets booked doesn't change. To do such an
implementation we need to extend our program to an even complex structure. For sake of simplicity, this is
out of scope. Thus the prices of the seats booked changes as per the current price set for the seats.
Guidance: Object Oriented Programming
Venue: Venue Class should hold some array that represents the layout of the seats. You can
add additional data fields to this. You must write some operations that modify these seats - like
navigating up/down/left/right through the seats, booking the seats, etc.
Concert: Since total seats are no longer a constant, you need to set the total seats of these
concerts along with other concert details somewhere. Use the concert class here. Write some
other data fields and methods about how to access or change them.
ConcertDetails: Since there is more than one concert, you would need a class to manage all of
these concerts together. Use the ConcertDetails class to hold all the information about the
concerts together. Add some methods to add or update the concerts.
Please note that in Object Oriented Programming, we try to abstract out code into many
classes that make logical sense. Creating one God-Like Class is a paradigm we avoid. Read
more about God Classes here.
Inheritance
We will assist you in writing your first inheritance-based classes. Inheritance should be used when
you can find a similar group of entities. Can you think of any similar group of entities here? Perhaps
different Users like Admin and Customer. Do they have any similarities and dissimilarities that you
can manage using inheritance?
One of the common properties of these two is that both have a menu to show, but they are slightly
different. To assist you in dealing with abstract classes, we have created an abstract method in
User.java. Here are the do's, don'ts and must's -
Do's
You can modify the method signature provided to you by adding/removing parameters to the
method.
You can add more methods to the abstract class that you think are common between customer
and admin
You can add more data fields to the abstract class
Don'ts
Must's
As part of your assignment, you must implement this abstract class by creating two classes by
yourself, namely, Customer and Admin that extend this class
You must use this User/Customer/Admin class somewhere in your code and invoke appropriate
methods.
Packages
You should group the logical entities in packages. One suggestion is to group the
user/customer/admin into a package. These packages are not created for you and we recommend
you move the provided classes to necessary packages. Can you think of anything else?
JavaDoc
You must annotate your classes and methods using javadoc style comments. How to create javadoc.
We also provided some tests for your code, which will run automatically every time you hit "Mark".
You can run these tests as many times as you would like until the submission deadline.
Happy coding!
Assessment
This project is worth 15% of the total marks for the subject. Your Java program will be assessed based
on the correctness of the output as well as the quality of code implementation.
Automatic tests will be conducted on your program by compiling, running, and comparing your
outputs for several test cases with generated expected outputs. The automatic test will deem your
output wrong if your output does not match the expected output, even if the difference is just having
extra space or missing a colon. Therefore, it is crucial that your output follows exactly the same
format shown in the provided examples.
Passing the tests we provide here on edstem does not mean you will score full marks. Each submission will
further be subject to hidden tests as well as manual inspection by our teaching team.
Marking Scheme �
Warning! You must make sure your code runs on edstem. If your code does not compile on edstem, 0
marks will be given.
Program Presentation
Including layout and style, readability, adherence to coding expectations and conventions, general
care and appearance. The full marks for this section of marking is 4.
Gaining marks
all choices of variable (except array indices), and method names were meaningful;
variable, method, and class names follow Java convention (camelCase and PascalCase);
Constant names follow Java convention (UPPER_SNAKE_CASE);
comments were sufficient and meaningful;
consistent bracket placement and indentation;
authorship statement (name, university email, student number) provided;
all magic numbers (essentially numbers other than 0 or 1) were assigned to constants; repeated
Strings are created as constants
clearly structured code with the correct order of variables, constructors, getters/setters, and
methods.
Deductions
stylistic issue, if major 1.0 mark per issue; if minor, 0.5 mark per issue. The minimum mark in
this section can be 0.
Gaining marks
Deductions
structural issues, if major 2.0 marks per issue, otherwise 1.0 per issue. The minimum mark in
this section can be 0.
Program Execution
Including compilation, execution of test data, output presentation, and readability.
Programs that do not compile in the test environment will lose all marks in this section. Be sure to
verify your submission and check the output before you say "finished" to yourself.
The full mark for this section of marking is 15.
Marks awarded
Deductions
Gain 0.5 marks for tests with slightly different output (e.g., small changes in whitespace/newline are
fine but a lot of white spaces or new line skipped may be an issue; if the marker says the difference is
not slight, that is final. This should not occur if the available test cases are all checked. White space
issues in visible test cases will be penalised);
If you have any questions regarding your mark, please contact the lecturers
Submission
Your submission should have the Java classes already provided to you and additional classes if you
wish to include them. Your submission should also contain some packages.
Rearrange the classes to create some packages and update the import statements accordingly.
A starter code has been provided to you here on the edstem platform, but you are welcome to
develop the project outside of the edstem environment, using your own IDEs.
Submission is made via edstem, however, and will be whatever code is saved on the Code
Challenge when the project deadline closes.
Your code MUST compile and run here on edstem. If your code does not compile we cannot mark it and you
risk getting 0 marks.
“I can’t get my code to work on edstem but it worked on my local machine” is not an acceptable excuse
for late submissions. In addition, submissions via email will not be accepted.
Be sure to copy your code into your Code Challenge workspace well before the deadline to avoid
being locked out of submissions last minute.
Only the last version of your code before the submission deadline will be graded. It is highly
recommended that you update your code on edstem frequently and well before the submission
deadline. Last-minute "connection errors" are not a valid excuse.
In case you need an extension due to valid reasons, please fill up this form and we will follow up
with you. Ensure you have a valid reason and proper documentation with you before seeking an
extension. If you seek an extension beyond 10 days, contact STOP 1. See more here.