RECENT ASSIGNMENT

Tweet Share WhatsApp Share
GET ANSWERS / LIVE CHAT


Assessment Details COIT11222
Assessment item 2 – Java GUI Application
Due date: Midnight, Thursday, 18/09/2014, Week 11 ASSESSMENT
Weighting: 20% 2
Submission: Electronically through Moodle course site
This assessment item is for COIT11222, 2014 Term 2.
Objectives
This assessment item relates to the course learning outcomes as stated in the Course Profile.
Details
For this assignment, you are required to develop a Java Graphical User Interface (GUI) Application to demonstrate you can use Java constructs including input/output via a GUI, Java primitive and built-in types, Java defined objects, arrays or ArrayLists, selection and looping statements and various other Java commands. Your program must produce the correct results.
The code for the GUI is supplied and is available on the course website. You must complete the underlying code to implement the program. The buttons have been activated and are linked to appropriate methods in the given code. Please spend a bit of time looking at the given code to familiarise yourself with it and where you have to complete the code.
You can create your own GUI if you choose to but DO NOT use any GUI generators.
What to submit for this assignment
1. The Java source code:
o CarInsuranceGUI.java
If you submit the source code with the incorrect name you will lose marks.
2. A report of your assignment which includes:
a. a UML Activity Diagram (refer to weeks 4 and 5) to depict how your program searched for a car.
b. a short paragraph or 2 about how long it took to create and any problems encountered.
c. screen shots of the output produced. (Use Alt-PrtScrn to capture just the console window and you paste it into your Word document) .
You should test every possibility in the program.
o Your report should be named ReportAss2.docx
You will submit your files by the due date using the “Assignment 2” link on the Moodle course website under Assessment… Assignment 2 Submission.

Assignment Specification
You have completed the console program for Motorcity Car Insurance. Your boss now wants a GUI prototype of the program to allow staff to enter details of cars and to produce reports of all the cars in the system. You are to write a Java GUI Application (CarInsuranceGUI class). Most of the GUI code has been written and it looks like this:
The registration of each car is to be entered in to the registration text field.
The age will be selected from the drop down combo box
There is a checkbox for selecting if the car had been in an accident or not.
The pricing structure is the same as assignment 1:
• Cars over 5 years old will cost $350.00.
• Cars less than and up till 5 years old will cost $200.00.
• 25% discount off their insurance cost if there they have not been in an accident before
You will use 4 parallel arrays or ArrayList structures to store the various details about the cars
A maximum of 10 cars should be set.
Your job is to implement the buttons in this program.
The following explains what should happen when each of the buttons are clicked.

Enter
When the user hits the enter button the information about the current car will be displayed, for example:
The text area is set to a mono-spaced font (done for you already) so that String.format can be used to align the columns.
To remove the existing content of the text area and input new text: textArea.setText(“text to input”)
To keep the existing content and add new text to the text area: textArea.append(“text to append”)
If the limit of cars is reached, let the user know with an appropriate message dialog:
If no car registration was entered, do not add the details into the program and let the user know with an appropriate message dialog:
After the car’s details have been successfully entered,
• the registration field must be cleared
• the combo box returned to zero
• and the accident check box should be unchecked.
The supplied code returns the focus back to the registration field.
DisplayAll
This option will display all cars entered so far and the total of the fees.
Sort
This option will sort the cars by registration number and display them.
Hint: You cannot use the inbuilt sort method within Java Arrays class as you will need to sort the four lists in tandem using the registration list as the sort criteria.
Search
When the search button is clicked, use an input dialog box to let the user input the car registration to search for. You can just use a simple linear search. Your search should not be case sensitive (if there is a car with registration “HSV123”, searching with “hsv123” should be successful).
If the search is successful, display the details about the car.
If the search is unsuccessful, display an appropriate message and clear the text area
Exit
When the user selects this option the program will ask the user if they really want to exit the program.
For this use the showConfirmDialog in JOptionPane.
If the user selects “Yes” (JOptionPane.YES_OPTION), then exit the program, otherwise just ignore and return to the program.
Extra Hints
1. Use registrationField.getText() to retrieve the registration of the car
2. Use setText(“”) to clear the registration field.
3. Use Integer.parseInt((String) ageCombo.getSelectedItem()) to retrieve the car age.
4. Use accidentCheckBox.isSelected() to determine if the accident check box has been selected.
5. Your program should be well laid out, commented and uses appropriate and consistent names (camel notation) for all variables, methods and objects.
6. Make sure you have no repeated code (even drawing the line in the output)
7. You cannot use a list of objects you must use four parallel lists.
8. Constants must be used for all numbers in your code.
9. Look at the marking criteria to ensure you have completed all of the necessary items
10. Refer to a Java reference textbook and the course and lecture material (available on the course web site) for further information about the Java programming topics required to complete this assignment.
11. Check output, check code and add all of your comments, complete report and the UML activity diagram.
Supplied GUI Code
Download, compile and run the supplied GUI code available from the course web site.
You will see the GUI interface has been implemented using the FlowLayout layout manager.
Study the code to understand how it works, you can experiment and change things around, but preserve an original copy of the code for your assignment.
Consider how the interface could be improved using panels and other layout managers.
The window has been adjusted in size so the input area, buttons and output area (text area) line up correctly.
You have to implement the underlying code, use the supplied method stubs and add you own methods.
No code should be repeated in your program.



GET ANSWERS / LIVE CHAT