Assignment 2, Part B
Introduction
You are required to implement a basic Java program using Java SE 8.0 or later.
This assignment is designed to help you:
1. Enhance your ability to build a Graphical User Interface using JavaFX;
2. Practise implementation of various GUI event handlers;
3. Practise application of using file input and output processing;
General Implementation Details
Initial data should be read from an input text file. A Save option should be
implemented that writes out to a text file.
All menu/interactive input should be via a graphical user interface, implemented XXXXXXXXXXusing JavaFX. All information displayed to the user should be via the same GUI.
Sample GUI layouts will be put on Canvas: you are free to have different layouts as long as your GUI layouts are clear (marks may be deducted for very poor design).
Any inco
ectly formatted input should be checked by the GUI implementation.
You are to use packages: all your new code should be in packages called:
o gui
o fileio
Code not in either of these packages will not be considered for marking.
You must not use 3rd-party GUI components (i.e., not built by you). Use of drag-
and-drop GUI-building tools is allowed but discouraged and may result in some
loss of marks.
Marks will be allocated to proper documentation and coding layout and style.
Your programs will be marked using Java SE 8.0 or later. Make sure you test your program before you submit.
Task Specification
You are to build a Graphical User Interface (GUI) for the MyTi system of Assignment 2 Part A. You will also make the running of the MyTi system more configurable by reading initial User and Travel Pass price information from input files and write updated information to an output file. You will also design and write JUnit code for testing your program. You do not need to add any other new functionality to the MyTi system of Assignment 2.
What if my Part A did not work properly?
If you did not get TravelPass purchasing and upgrading working fully in Part A then you are allowed to just purchase a TravelPass each time (instead of a Journey), as in Assignment 1
Part A: Packages and Organisation of Code
You should organise your code into 3 packages. A package called myti should be used for code from Assignment 2A. Packages called gui and fileio should contain all new code for Assignment 2B (you can put some of your existing code into these packages, if necessary).
Part B: Command-Line Arguments
You are to use command-line arguments to provide the name of your input and output files. For example, if your main() program is in the class Assign3 and you read input from input.txt and your output is output.txt, then you would run your program as follows from the command-line:> java Assign3 input.txt output.txt If you use eclipse, then you specify the arguments under Run > Run Configurations; as always, your program will be marked by running it under your documented configuration.
Part C: File Input and Output
Put initial TravelPass prices and User information in a text file (the name of this file is the first command-line argument); your program should read this file at start-up and initialise prices and create Users with the appropriate values.
must follow that format precisely, though you are welcome to include more information than in that sample. Your program will be tested with different values (but with the same format) so make sure you can handle reading the file properly.
When the SAVE option is selected on the GUI, you should write an output (text) file. The output file must use the identical format to input file format below. You should write out the same information as you read in with the updated values.
Part D: Graphical User Interface
Add a GUI for at least the following functionalities from Assignment 2. (You can implement a GUI that covers your complete Assignment 2 functionality but there’s no extra marks in it.)
The GUI should consist of 3 panes, for Buy a journey; Manage Users; Display Reports; these 3 panes can be implemented in a single large window or as 3 separate windows, students are free to choose as long as the display is clear and not overly cluttered.
The Buy a journey screen should include:
o a list for selecting a User (i.e., buy a Journey for this User);
o lists to select 2 stations;
o a list to select the day of travel, and an input box to enter the times;
o a message box where e
or messages or other output is displayed;
o CANCEL and PURCHASE buttons.
The Manage Users screen should include:
o a list of User IDs and names;
o when a User is selected, their details and remaining credit is displayed;
o an input box and an ADD CREDIT button for adding credit for the selected User: when this is performed, credit for that user is displayed / updated;
o a message box where e
or messages or other output is displayed;
o an Add a User panel that obtains the required information for a new user and adds them. Any new user should immediately appear in the select-user menu.
The Display Reports screen should include:
o a single Display User Journeys button;
o a scrollable text box that contains the list of Journeys, by User.
SAVE and QUIT (without saving) buttons should always be available (ideally, separate from the 3 panes mentioned earlier). Obvious GUI e
ors should be checked—for example, if the user tries to ADD CREDIT without first selecting a User from the menu.
Policy on NetBeans: This GUI is small enough to be programmed manually, without use of NetBeans, SceneBuilder, or other GUI-building toolkit, so up to 3 marks may be deducted for using such a toolkit. Any 3rd-party components not built by you will not be marked at all.
GUI Demo: there will be a demo of GUI functionality this can be of “click” functionality that isn’t fully connected to the MyTi system.
Part E:
As always, marks will be awarded for coding style, documentation/comments, code layout and clarity, meaningful e
or and other messages, proper e
or handling, choice of data structures and other design decisions. You are encouraged to discuss such issues with your tutors and lab assistants, or with the coding mentors.
Submission
1. You must include a README file. This should describe how to run your program, what extra functionality you implemented, any standard functionality you know does not work, and any problems or assumptions. If the tutors have any problem running your program and the README does not help, then you will lose marks.
2. For the code submission, you must include all source files and input data file in
your submission (do not submit any *.class files!). Since you are using packages, make sure you zip to the top-level of your package hierarchy: i.e. to the level at which you compile and run the main class. (Ask your lab tutor to help if you are not sure how to do this.)
3. Late final submissions will incur a penalty of 10% per day. Submissions made 5 days after the due date will receive no marks.
Items for testing
Your program must include the following test items: just create them in your main program and use them to populate your data structures that keep track of all such items. These will be used to test/mark your program so it’s crucial that you enter them. You may add further Users and Stations if you wish, but you must add at least the ones below.
Users (id, type, name, email)
o lc, Senior, Lawrence Cavedon, XXXXXXXXXX
o vm, Adult, Xiang Li, vuhuy.mai@ deakin.edu.au
Stations (name, zone)
o Central, 1
o Flagstaff, 1
o Richmond, 1
o Lilydale, 2
o Epping, 2
Note: - Your program must read the given file on start up, and write cu
ent data values (i.e., users and their credit, journey prices) using the same format on clicking "Save".
#users (last field is initial credit)
lc:senior:Lawrence Cavedon: XXXXXXXXXX:50
xl:adult:Vu Mai: XXXXXXXXXX:45
#prices
2Hour:Zone1:2.50
2Hour:Zone12:3.50
AllDay:Zone1:4.90
AllDay:Zone12:6.80
Slide 1
lc, Lawrenc
vu, Vu Mai
Central
Flagstaff
Richmond
Lilydale
Central
Flagstaff
Richmond
Lilydale
Use
From
To
Day
Start
900
End
910
Purchased new 2 Hour Travel Pass for Zone 1 for vu
Mon
PURCHASE
QUIT
SAVE
QUIT
SAVE
lc, Lawrenc
vu, Vu Mai
Credit for xl: $17.50
ADD CREDIT
25.00
$25.00 added to vu
Create New Use
id:
name:
email:
type:
CREATE USER
Adult
QUIT
SAVE
DISPLAY JOURNEYS