Essay Help Services

COIT20256 | Data Structures and Algorithms | Technology

Home Assignment Answers COIT20256 | Data Structures and Algorithms | Technology

COIT20256 | Data Structures and Algorithms | Technology

  • Introduction:

In this assignment we have 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.txt), 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.

  • Two java classes created:

  • java
  • java

Resident class includes a parameterized constructor, get and set methods and three variables which are used for storing data that is, name of the resident which is of string datatype, age which is of integer datatype and condition of string datatype.

ResidentApplication class is a complete GUI application which contains components and uses ArrayList for storing the resident’s data.

  • The application’s GUI components used are:

  • A menu bar that contains four menus (File, Tools, Help and Exit) .
  • A text area.
  • Methods created in ResidentApplication class:

  • initComponents() -> We have used a method named, initComponents() which is used for initialization of all the components used in the application and setting the layout ,i.e, setting the title,size of the frame,etc.
  • readData() -> readData() has been created to read data from the text file and storing the data into the arraylist.
  • showData() -> showData() method has been used to display the data stored in the arraylist to the textArea in a particular format.


  • We have four menus in menuBar. The four menus contain various menuItems:

  • File -> Read, Save
  • Tools -> List, Add, Delete, Sort, Search
  • Help -> Details
  • Exit -> Exit


  • Working of the menuItems:

  • File -> Read: This menuItem reads the data from the file ResidentData.txt and stores the data into arraylist. The text file contains a series of records, each record with the resident name (String), age(integer) and health condition description (String). We have used various classes for reading data from text file and then storing that data into the arraylist. The classes used are File,FileReader and BufferedReader. we have used add() method adding the data into the arraylist.
  • File -> Save: This will save the whole data stored in the arraylist into same text file. For this, the classes used are File, FileWriter and BufferedWriter. The data stored in the text file will be comma separated values. After that ,the user will receive appropriate message showing whether the data has been stored into the file or not.
  • Tools -> List: This menuItem will display the resident’s data, that is already stored in the arraylist, in textArea in a particular format. With this, it will also display the total number of records stored. showData() method is used to display the content to the textArea.
  • Tools -> Add: If we want to add new resident’s data into the arraylist, then this menuItem will be used. To do so, three input dialog boxes, one after another, will be shown to the user in which user has to fill the details which is going to be stored into the arraylist. Appropriate validations have been used. For example, if user has not entered the name, then proper message box has been shown that ‘Name cannot be blank.’ showData() method has been called for displaying all the data from arraylist to the textArea.
  • Tools -> Delete: This menuItem is used to delete a particular entry from arraylist. We have used remove() method for this. First of all, an input dialog box for entering the name has been displayed to the user. After that, that name will be searched from the arraylist using for-each loop. If the name entered by the user matches with any of the data of the arraylist, then that particular detail will be removed from the arraylist and a proper message has been displayed to the user ,i.e ,’User found’. If no data matches, then message box will show ‘No user found’ to the user.
  • Tools -> Sort: In this, sorting of the data, already stored in the arraylist, will be done according to the resident’s name. For this, we have used three temporary variables in which two of them are of string datatype and one of integer datatype. compareTo() method is used for sorting the data. Temporary variables are used for swapping of data according to the names of the residents.
  • Tools -> Search: This is used for searching the details of any resident according to the name that will be entered by the user. For this, the input dialog box will be appeared in which user will enter the name. If the name entered by the user will match with any of the arraylist data, then message will be shown accordingly ,that is, if the names matches, then message shown will be ‘Name found’ otherwise the message will be ‘No name found!!’. For-each loop has been used for matching the name entered by the user with the name in the arraylist.
  • Help -> Details: In this, brief information about the application will be shown in the message box. The details are:
  1. Select File->Read menu to read data.
  2. Select File->Save menu to write data
  3. Select Tools->List menu to display data
  4. Select Tools->Add/Delete menu to add/delete data
  5. Select Tools->Sort menu to sort data
  6. Select Tools->Search menu to search a resident
  7. Select Help->Help menu to display help message
  8. Select Exit->Exit menu to exit from the application
  • Exit -> Exit: This is used for exiting the application. A confirmation message will be used which will ask user ‘Are you sure you want to exit the application?’. If user clicks ‘yes’ option then application will be closed. ‘System.exit()’ will be used for exiting the application.

Search Here

Order Now

Latest Reviews


Payments And Security