Objectives
- Analyse, develop, and implement software solutions
- Choose and compare appropriate data structures and algorithms in program design
- Apply classes, inheritance, polymorphism, and exception handling
- Test software implementations to ensure correctness and maintainability
Assignment 2 Specification
Your task is to develop a Java windowed
application for a nursing home management system. The program allows the
user to read the resident name, age, and health condition description
from a text file (ResidentData), save data to the same file, display
data in a text area, sort data by the resident name, search data by the
resident name, add a record and delete an entry.
The application’s GUI components should
consist of a menu bar containing four menus (File, Tools, Help and Exit)
and a text area as shown below.
Order Now
Order Now
How the program works
There are four menus (File, Tools, Help
and Exit). The File menu contains 2 items (Read and Save), the Tools
menu has 5 items (List, Add, Delete, Sort and Search), the Help menu has
1 item (Details) and the Exit menu has 1 item (Exit). The menu items
are described below.
File→Read:
Reads the data from the file ResidentData.txt (see format of this file
below) and stores the data in a Linked List or an ArrayList. The
application must use appropriate exception handling to deal with
problems during the file opening (e.g. what to do if file doesn’t
exist).
The file contains a series of records,
each record with the resident name (String), age (integer) and health
condition description (String). A sample file format for
ResidentData.txt is as follows.
Harry Potter,90,Good health
David Packer,78,Poor health
James Lin,68,Chronic illness
Michael Li,79,Poor Health
John Smith,66,Good Health
Max William,89,Diabetes II
File→Save:
Saves all the data from ArrayList/LinkedList to the same file name
ResidentData file. The saved file contains the resident name, age and
health condition description, separating with comma. This file should be
allowed to re-open and read data as the File->Read operation as
above. The application must use the appropriate exception handling to
deal with problems during the file saving.
Tools→List: Lists all resident records from ArrayList/LinkedList in the display area as shown below
Tools→Add:
Adds a resident entry to the Linked List via a series of input dialog
box to enter the resident name, age and health condition description
respectively. For example, the following input dialog box allows
entering the resident name.
Tools→Delete:
Deletes a resident entry by entering the resident name as the following
input dialog box. Accordingly, the matched object of a resident stored
in the Linked List is removed.
Tools→Sort:
Sorts data by the resident name 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. You must write your own code to implement sorting
Tools→Search :
Asks the user to enter a resident name via an input dialog box as shown
below and uses the best searching algorithm covered in COIT20256 unit
to search for the
given resident name. It displays appropriate message found or not found in the display area.
You must write your code to implement searching.
Help→Details: Provides the user with some brief information on this application program as shown in the following message bo
Exit→Exit: Allows the user to exit the application.
Data Validation
Input data validation for the resident
name entered to search is required. If no resident name is entered and
OK button is pressed, then the application will pop out a message box
with an appropriate message.
Assumptions
It can assume that the program is not
concerned the issue of uniqueness of resident name. A record is a
resident object. Two records having the same resident name is allowed
for simplicity. To test sort and search algorithm efficiency with 1000
records in the data file, you can copy and paste repeating records in
the data file. In addition, you can assume that the resident name is
case sensitive.
Data Structures & Algorithms
You must use:
- LinkedList or ArrayList for storing resident 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 Resident which describes an
individual Resident (fields such as
resident name, age, and health condition description, and get and set
methods) and another class named ResidentApplication which contains GUI
with components and methods for sorting, searching and file processing
etc. • Appropriate fields and methods to store/process resident 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-4 lines to answer this question in Report.docx. You can justify your answer with big O notation on the algorithms involved.
- 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-4 lines to answer this question in Report. You can justify your answer with big O notation on the algorithms studied.
- You must run your application 3 times by increasing the data each time (e.g. 10 records, 100 records, 1000 records) 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. 10 records, 100 records, 1000 records) 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 may use any platform, however your
assignment submission must compile in Java using TextPad Editor which is
available in University’s computing labs and may also be downloaded
from the following site:
Assignment Submission
You MUST show your tutor the progress
(Resdient.java and ResidentApplication.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 1 February 2108 the following files using the Moodle online submission system.
- java - Source code for the Resident class (fields, constructor, get and set methods)
- java - Source code for the ResidentApplication class with GUI components, sorting method, searching method, reading/writing from/to file methods, etc.
- 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 | Add a resident object | 1 |
5 | Delete a resident object | 1 |
6 | Save data to file | 2 |
7 | Sort data/algorithm | 3 |
8 | Search data/algorithm | 3 |
9 | Help and Exit | 1 |
10 | Input validation and pop out message box | 1 |
11 | Design – fields, classes, objects, methods | 2 |
12 | Quality of code (comments, indentation, naming and readability) | 2 |
13 | Report | 6 |
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 (2 mark) | ||
Time comparison/analysis of sorting and searching algorithms (2 marks) | ||
14 | Late submission penalty is 5% of total mark per day | -1.5/day |
15 | Penalty for using things not covered in lectures and tutorials | Up to -10 |
No comments:
Post a Comment