Recent Question/Assignment

Assignment 2
Due date: Week 11, Thursday, 27 Sep 2018, 11:45 PM AEST
Weighting: 30%
Assessment Task
Your task is to develop a Java Application that allows the user to read the data (flight departure city, flight arrival city, year and month, and flight price) from a text file (FlightData.txt), save data in a file (NewData.txt), display data in a text area, sort data by the departure city and search data by the flight price.
The application’s GUI components should consist of a menu bar containing 6 menus (Read File, Save File, Display Data, Sort Data, Search Data, Help) and a text area (Display Area for flights) as shown below.
There are six menus (Read File, Save File, Display Data, Sort Data, Search Data, Help). Each of the first 5 menus (Read File, Save File, Display Data, Sort Data, Search Data) contains a single item (Read, Save, Display, Sort, Search) and Help menu contains 2 items (Help, Exit). The menu items are described below.
Read File?Read: Reads the data from FlightData.txt (see format of this file below) and stores the data in a Linked List or an ArrayList. The application must use appropriate exceptions to deal with problems during the file opening (e.g. what to do if file doesn’t exist).
The file contains flight departure city (String), flight arrival city (String), flight year-month (String) and flight price (double). A sample file format for FlightData.txt is as follows.
Adelaide, Sydney, 201010, 116
Alice Springs, Darwin, 201103, 428
Save File?Save: Saves all the data from ArrayList/LinkedList to NewData.txt file. The new file only contains departure city, arrival city and price. It also contains the total number of flights. The format for NewData.txt file is as follows.
Adelaide, Sydney, 116
Brisbane, Canberra, 158
Number of total flights: 2
The application must use the appropriate exceptions to deal with problems during the file saving.
Display Data?Display: Displays all the data from ArrayList/LinkedList in the display area as shown below.
Sort Data?Sort: Sorts data by the flight departure city in ascending order using the best sorting algorithm covered in COIT20256 unit and displays sorted data in the display area as shown below.
You are not allowed to use any built-in sorting algorithm.
Search Data?Search: Asks the user to enter a flight price via a dialog box as shown below and uses the best searching algorithm covered in COIT20256 unit to search for the given flight price. It displays appropriate message found or not found in display area.
Help ? Help: Provides instructions to user via a dialog box on how to use the application and displays the details (e.g. contact person and email) for further help. Help ? Exit: Allows the user to exit the application.
Data Validation
Input data validation for the flight price entered to search is required. If no flight price is entered or entered flight price is less than $1 and OK button is pressed then the application will pop out a message box with an appropriate message.
Data Structures & Algorithms You must use:
• LinkedList or ArrayList for storing flight object.
• Best searching algorithm (based on your analysis) covered in COIT20256 unit for searching.
• Best sorting algorithm (based on your analysis) covered in COIT20256 unit for sorting.
• Two classes to implement the application. One class, named Flight which describes an individual Flight (fields such as Departure, Arrival, Year-Month, Price and get and set methods) and another class named FlightApplication which contains GUI with components and methods for sorting, searching and file processing.
• Appropriate fields and methods to store/process flight data.
Evaluation and Analysis of Data Structures and Algorithms
• You must justify the reason for selecting the data structure (ArrayList or LinkedList). Why do you think that the data structure used by you is the best data structure for your application? Write maximum 2-3 lines to answer this question in Report.docx.
• You must justify the reason for selecting the sorting algorithm. Why do you think that the sorting algorithm used by you is the best sorting algorithm for your application? Write maximum 2-3 lines to answer this question in Report.docx.
• You must justify the reason for selecting the searching algorithm. Why do you think that the searching algorithm used by you is the best searching algorithm for your application? Write maximum 2-3 lines to answer this question in Report.docx.
• You must run your application 3 times by increasing the data each time (e.g. 7 flights, 700 flights, 7000 flights) and compare time for sorting algorithm. Write in Report.docx, the time taken to sort in each case.
• You must run your application 3 times by increasing the data each time (e.g. 7 flights, 700 flights, 7000 flights) and compare time for searching algorithm (use same search key each time). Write in Report.docx, the time taken to search in each case.
Implementation Platform
You must implement your program in Java using TextPad Editor which is available in University’s computing labs and may also be downloaded from the following site: http://textpad.com/download/index.html
Assignment Submission
You MUST show your tutor the progress (Flight.java and FlightApplication.java files) in Week 9 Tutorial and Week 10 Tutorial. If you are a distance student, you need to contact the unit coordinator by e-mail.
You MUST submit on 27 September the following files using the Moodle online submission system. • Flight.java - Source code for Book class (fields, constructor, get and set methods)
• FlightApplication.java - Source code for class with GUI components, sorting method, searching method, reading/writing from/to file methods, etc.
• Report.docx – Results of comparing data structures and algorithms as mentioned above (see section Evaluation and Analysis of Data Structures and Algorithms).
Warning: You must submit your own assignment and correct files.
Marking Criteria
Total Marks – 30 Marks
Allocated
1 GUI implementation and presentation (menus, display area, etc.) 4
2 Read data 2
3 Display data from file 2
4 Save data to file 2
5 Sort data/algorithm 3
6 Search data/algorithm 3
7 Help and Exit 1
8 Input validation and pop out message box 2
9 Design – fields, classes, objects, methods 4
10 Quality of code (comments, indentation, naming and readability) 2
11 Report
Quality (content, presentation, language) (1 mark)
Reason for selecting data structure ArrayList or LinkedList (1 mark)
Reason for selecting the best sorting and searching algorithms (1 mark)
Time comparison/analysis of sorting and searching algorithms (2 marks) 5
12 Late submission penalty is 5% of total mark per day -1.5/day
13 Penalty for using things not covered in lectures and tutorials -3