Final Project - Ticket Management System Upgraded
Final Project - Ticket Management System Upgraded
Upgraded
Introduction
Welcome to the Final Project for COMP90041 - Programming and Software Development!
For this project, we will extend the ticket management system to a real-life Ticket Management
System. In your real life, you may use some kind of database. But we will handle and save data using
files.
Some of the operations are now removed from the previous assignments and there are a few new
operations to perform by different kind of users.
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 the Final Project, we will provide 20 visible tests that you can run to check that the
basic functionality of your system is correct. There will be no hidden test cases. However, we
will manually upload some different data files to rerun your program and assess 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.
Treat every scenario as new. Even though some operations may resemble previous assignments
you may still need to implement them in a different way as the program complexity has
increased.
We will show some of the scenarios as valid/expected/best-case scenarios. This section will be
marked in green.
Some inputs to the program can be invalid and should be handled accordingly by the program.
These unexpected but valid scenarios will be tested and are shown below -
Worst Case Scenario: Your program may behave incorrectly if not handled explicitly. These inputs can
be tested.
Just like the previous assignment, 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 the final Project 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.
Arrays or ArrayLists - to use 1D and 2D arrays/ArrayList and perform associated operations
Packages - identify and group logical entities(classes) together
Javadoc - generate javadocs from comments used in classes
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.
File Handling & Command Line Args
File Handling
Your program can launch in two modes - Customer mode or Admin mode. To run the program in any
mode, it is important to read some data from the files and load them in the appropriate objects of
classes (see guidance slide). There are atleast four or more files available to you. Four files that will
always be present are mentioned below. These files are present in the assets folder.
1. concert.csv - This file contains data for all the concerts in a comma-separated format.
2. customer.csv - This file contains data for all the current customers in a comma-separated
format.
3. bookings.csv - This file contains data for all the bookings made by all the customers in a
comma-separated format.
4. venue_default.txt - This file contains a default layout for venues.
Note that the file names may change. They are passed in specific order via the command line params.
See the Command Line Arguments section below. You must not hardcode the file names in the code.
Venue Files - Venue files can change. They are not mandatory files except venue_default.txt
mentioned above. When we test your code for assessment we may add/skip these files and some
additional files.
1. venue_mcg.txt - This file contains a layout for a venue that is specific to MCG(Melbourne Cricket
Ground)
2. venue_marvel.txt - This file contains a layout for the venue that is specific to Marvel Stadium.
Customer File
This file contains the following data in order
Booking File
The booking file contains bookings for all the concert for all the customers. The data follows the order
-
Booking ID - uniquely identifies a booking within a concert. That is Concert 1 can only have one
booking id as 1. But another concert, say Concert 2, can also have a booking ID set to 1.
Customer ID - cross-reference to the customer ID from the customer list
Customer Name - the name of the customer who has booked the concert
Concert ID - uniquely identifies the concert for which booking has been made
Total Tickets - total number of seats booked in the booking. For eg - 3
Ticket Id - If 3 tickets(or seats) are booked then ticket Id will be 1/2/3.
Row number - The row number within a zone. This starts from 1.
Seat number - Within a row, the seat number which is booked.
Zone Type - VIP or STANDING or SEATING
Price - the price of the seat at the time of booking. Note that the price of the seat can be
changed by admin. Thus it is important to save the price of the seat at the booking time.
Thus to derive an aisle number you will look at ZoneType and merge it with RowNumber. See the
Venue File layout below for more details.
The last 5 data (Ticket Id to Price) repeat based on the Total Tickets booked. Thus for 2 tickets and 3
tickets booked the data may look like the following respectively.
4,2,John Doe,2,2,1,3,6,VIP,259,2,3,7,VIP,259
1,1,Jane Doe,1,3,1,3,3,VIP,359,2,3,4,VIP,359,3,3,5,VIP,499
Total fixed data points: 5 (Booking id, customer id, customer name, concert id, total tickets)
Total variable data points: multiples of 5 based on total tickets (Ticket id, row number, seat number,
zone type, price)
Out of Scope Scenario: A line in the booking file will never have an incorrect concert ID or customer ID
that does not exist in their respective files.
Venue File
The Venue is now marked with Aisle Numbers. The Aisle Numbers start from the letters V for VIP, S
for SEATING and T for STANDING zones. The venue may look like this
This means that there are 3 rows each for VIP (that starts with the initial V: V1 to V3) and SEATING
(that starts with the initial S: S1 to S3) and 4 rows for STANDING(that starts with the initial T: T1 to T4).
Each row has 3 seats in the left section, 2 seats in the middle section and 4 seats in the right section.
Worst Case Scenario: Your program may behave incorrectly if not handled explicitly. These inputs can
be tested.
There will always be a venue_default.txt available to you. When you parse the concert.csv file if you see
a venue name like MCG, you should look for a file venue_mcg.txt to load the venue. Similarly, if you
see a venue name like abc you should look for a file venue_abc.txt. If you can not find the file
venue_abc.txt or venue_mcg.txt you should load the venue layout from venue_default.txt file.
Note that the IDs (customer id/ concert id/ booking id) start from 1 as an index. You should take care when
saving them in array/ArrayList as array indices start from 0.
Note that the files do not have a header describing the column names so you don't have to do special
handling of the header vs the data.
Command Line Arguments
There is a set of command line arguments that should be passed to the program. Some of these
parameters are optional. So you should take special care while handling these. The general format for
the command line args is like this -
Note that the first param can be either --admin or --customer. The | signs represent or. The params in
the [] means that they are optional. See the details below.
Admin Mode
Your code will have command-line arguments like this
While the file name can change from bookings.csv to bookings_incorrect.csv to abc.csv as well, but the order will
remain the same - customer > concert > booking > variable list of venue files. You must not hardcode the file
names in your program at all.
Note that venue_default.csv is not provided as a file path. You can assume (hard code or make it a
constant in your code and set the default file path as assets/venue_default.txt ).
Customer Mode
The customer mode follows a similar pattern however the second and third parameters can be
optional.
Worst Case Scenario: Your program may behave incorrectly if not handled explicitly. These inputs can
be tested.
In case the second and third parameters are missing, your program command line args will look like
this.
In Edstem, this will be passed automatically. However, if you want to write code in your IDE, you must pass
appropriate command line arguments.
When you quit the program, your program should write back any changes done to Bookings, Concert,
and Customer back to the file path mentioned. Please do not override the Venue files.
IMPORTANT NOTE: Sometimes file handling is buffered internally by the operating system as well. This means
if you PrintWriter.print , you may end up with an empty file. This can be an intermittent issue. To avoid this,
please use .flush() methods.
Worst Case Scenario: Your program may behave incorrectly if not handled explicitly. These inputs can
be tested.
1. FileNotFoundException or IOException - The file paths that are provided to you are not present
in the directory. Or are unavailable for File read/write operations. In this case, Java raises
FileNotFoundException or IOException. Your program should handle these correctly and terminate
the program. For example - this is printed when the file for bookings doesn't exist.
2. InvalidLineException - Every file expects a minimum number of fixed data points. When these
data points are missing, you should raise an InvalidLineException, skip reading the line, print an error
message and move onto the next line. This will only happen for concert.csv, customer.csv and
bookings.csv. One of the following exception messages should be printed.
3. InvalidFormatException - Some data points are rigid and some data points are flexible. For
example, customer names can be anything. However, seat aisle numbers should either start from
V/S/T. In such cases, you must raise an InvalidFormatException and skip reading the line, print an
error message and move onto the next line. One of the following exception messages should be
printed.
Booking Id is in incorrect format. Skipping this line. // This is printed when booking id is not numeri
Customer Id is in incorrect format. Skipping this line. // This is printed when customer id is not nume
Concert Id is in incorrect format. Skipping this line. // This is printed when concert id is not numeri
Incorrect Number of Tickets. Skipping this line. // This is printed when the total number of tickets is
Invalid Zone Type. Skipping this line. // when the aisle numbers in Venue does not starts with V/S/T
4. IncorrectPasswordException - When the customer id and password are passed from the
command line params and they do not match as per the customers.csv, you should raise this
exception, print the message and terminate the program.
5. NotFoundException: If the customer id is not found in the customer.csv file raise this exception,
print the message and terminate the program.
Customer does not exist. Terminating Program
Customer Main Menu
Customer Menu
Your program will run in customer mode when you provide the correct command line parameters.
With the correct command line params (highlighted in bold below) you should print the welcome
message as shown below. The password and customer id are present in the customer.csv file and
should match. Note that the welcome message shows the customer's name (highlighted in bold to
differentiate, you don't have to make the output bold.). The customer's name is also present in the
customer file.
The customer mode always asks to select a concert for which they can perform different options. See
the Select a concert section below.
Use Case 2: Customer mode with either incorrect customer id and incorrect password
Worst Case Scenario: Your program may behave incorrectly if not handled explicitly. These inputs can
be tested.
When an incorrect password is passed, the program should terminate with the message shown in
bold below.
When an incorrect customer id is passed, the program should terminate with the message shown in
bold below.
If no customer id is provided in the command line params as shown below, then prompt the user to
provide a name and password.
A customer id should be auto-generated. Read the last available customer id in customer.csv file, say
1, 2,3 is present in the file. So the last available customer id is 3. And then add 1 to generate the new
customer id = 4 in this case.
When you quit the program, this customer should be appended in the customer.csv file as well.
Note that the welcome message shows the customer's name (highlighted in bold)
Out of Scope Scenario: The input to concert selection will either be the concert id or a 0. There won't
be any invalid input here.
If the user selects a 0 then you should terminate the program by printing the message Exiting
customer mode. Please ensure that all the changes made to Concert/Bookings/Customers should
be saved back to the files.
Tip: Use the format string "---------- %8s ----------%n" to print the statements like ---------- VIP ----------
Option 2: View Venue Layout
Customers can view the venue layout of the concert. A concert layout shows the available seats for
the venue. The venue is loaded at the beginning of the program based on the venue name. See the
FileHandling Slide again. The venue layouts do not have any bookings in the venue_xxx.txt files.
However, when you read from the bookings.csv file, you should also show the booked seats to the
customers while printing the venue layout, so that they don't book the already booked slides. X
represents the booked seats in the venue layout. (See the bold highlighted texts. Note, you don't have
to generate outputs in bold)
Once you have booked a seat(s), you should store it somewhere so that you can write the relevant
data back to the bookings.csv when you exit the program. Take a look at the bookings.csv again to
see what is the relevant information that gets stored.
For the current concert and current customer find the maximum of the previous booking ids and
simply add 1.
Not Enough Seats - Select the seat number say 15 and try to book 5 seats.
Select an already booked seat.
Not Enough Seats - Select a seat next to a booked seat and try to book 2 seats. This will force
you to choose the already booked seats and hence is not possible.
Choose an incorrect aisle number
Choose an incorrect seat number
1. A list of bookings showing the booking id, concert date, artist name, timing, venue name, seats
booked and total price for all the seats booked.
2. For each booking there should be a ticket info printed. Each ticket info shows ticket id, aisle
numbers, seat numbers, Seat Type and the price of the seats at the time of booking. Note that within
a zone there are different sections with different prices, and hence price for each seat can vary.
Warning: Be extra cautious that you are showing booking details for the correct concert selected and
for this specific customer only. As a customer, other customers should not be able to see your
bookings or vice versa.
Ticket Info
############### Booking Id: 1 ####################
Id Aisle Number Seat Number Seat Type Price
##################################################
1 3 3 VIP 359.0
2 3 4 VIP 359.0
3 3 5 VIP 499.0
##################################################
Tip: Use the format string "%-5s%-15s%-15s%-10s%-15s%-15s%-10s%n" to print booking list and
"%-5s%-15s%-15s%-10s%-10s%n" to print the ticket info list.
If no booking is found for a concert, you should print an error message and return back to the menu.
Option 5: Exit
Exiting the concert menu only exits from the current concert and prints the concert selection again.
You can proceed to perform operations with the same or other concerts or can choose to exit the
program by selecting 0. See the Concert Selection at the beginning of this slide.
Invalid Option
In case, someone provides an invalid input like -9 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
Admin Menu
Your program will run in admin mode when you provide the correct command line parameters
(highlighted in bold).
You should print the appropriate welcome message and show the menu options.
Ticket Info
############### Booking Id: 1 ####################
Id Aisle Number Seat Number Seat Type Price
##################################################
1 3 3 VIP 359.0
2 3 4 VIP 359.0
3 3 5 VIP 499.0
##################################################
Tip: Use the format string "%-5s%-15s%-15s%-10s%-15s%-15s%-10s%n" to print booking list and
"%-5s%-15s%-15s%-10s%-10s%n" to print the ticket info list.
Option 5: Exit
Admin should exit the program by printing the exit message. Please ensure that all the changes made
to Concert/Bookings/Customers should be saved back to the files.
Invalid Option
In case, someone provides an invalid input like -9 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
Quick Tips
Now that you know about UML, perhaps start designing your solutions by creating a UML first.
Think about what classes need to be created. Some of them are provided to you as the scaffold.
You can create other classes as well.
The second step is to associate appropriate data with appropriate classes. Create the data fields
as instance variables in those classes.
The third step would be to create the exceptions.
The next step is file handling. This will take the maximum amount of time.
The next step is to create a structure for running the menu options with different Control Flows
you have learned.
Exceptions thrown in a method are not handled in the same method. You should handle them
with try-catch block in some other methods where you are invoking the method that is causing
the exception. For example - when you use Integer.parseInt and the parseInt method throws a
NumberFormatException, you handle it in the method where you are using the Integer.parseInt.
create packages like previous assignments to logically group entities and interfaces and
exceptions as well.
generics are optional but may gain you some bonus marks.
File Parsing
Some files have a fixed width for each line. They have the same parameters for each line like
Venue, Customers or Concerts.
Some files have different data for each line like Bookings.
When you read the files, you can read the entire line and then split the data on comma. This shall
provide you with different data points in an array. Check the split method in the String class here. You
can use this method to perform a split on other special characters present in data like underscore( _ )
or colon ( : ).
Ticket Management System Upgraded
The starter code have been provided for you. Some classes are provided but packages are not
created. You must create some packages and move the classes to the appropriate package except
TicketManagementEngine.java. TicketManagementEngine.java should not be moved under
any package else your code won't run. Write the rest of the code to implement your program
there �
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 40% 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.
2. System Architecture
Including: Code structure resembling real-world entities. Clear hierarchy by using separate, well-
named files for generics, abstract, and concrete classes. Use of package(s) to modularise code.
5. Control Flow
Including: Easily traceable program flow. Loops have clear breakout conditions. Proficient use of
switch and if-else statements. No system.exit or return statements from loops.
7. File Handling
Including: Correct read/write of files including overwriting a file or appending a file wherever
necessary.
9. Style
Including: Consistency around naming conventions and descriptive naming of classes, methods, and
variables. Program code is well indented, spaces are sufficient, and avoidance of overly long lines of
code.
Including: Javadoc created without errors. Following javadoc conventions. All major classes and
methods are annotated. Additional in-line comments clarify complex program sections.
Points awarded for this section: /2
11. UML
Including: Major classes and methods are listed with their correct association arrows and multiplicity
values. The spatial arrangement allows for easy reading and shows a clear hierarchy between classes.
Package allocation is correctly displayed.
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.