Java programming greenwich 5 points (pass enough), Assignments of Java Programming

just passed this just passed this just passed this just passed this just passed this

Typology: Assignments

2021/2022

Uploaded on 04/01/2022

imissyou
imissyou 🇻🇳

4.6

(33)

9 documents

1 / 21

Toggle sidebar

This page cannot be seen from the preview

Don't miss anything!

bg1
ASSIGNMENT 1 FRONT SHEET
Qualification
BTEC Level 5 HND Diploma in Computing
Unit number and title
Submission date
Date Received 1st submission
Re-submission Date
Date Received 2nd submission
Student Name
Đinh Xuân Trường
Student ID
GCH200308
Class
GCH0908
Assessor name
Đinh Đức Mạnh
Student declaration
I certify that the assignment submission is entirely my own work and I fully understand the consequences of plagiarism. I understand that
making a false declaration is a form of malpractice.
Student’s signature
Trường
Grading grid
Grade (0-10)
pf3
pf4
pf5
pf8
pf9
pfa
pfd
pfe
pff
pf12
pf13
pf14
pf15

Partial preview of the text

Download Java programming greenwich 5 points (pass enough) and more Assignments Java Programming in PDF only on Docsity!

ASSIGNMENT 1 FRONT SHEET

Qualification BTEC Level 5 HND Diploma in Computing Unit number and title Submission date Date Received 1st submission Re-submission Date Date Received 2nd submission Student Name Đinh Xuân Trường Student ID GCH Class GCH0908 Assessor name Đinh Đức Mạnh Student declaration I certify that the assignment submission is entirely my own work and I fully understand the consequences of plagiarism. I understand that making a false declaration is a form of malpractice. Student’s signature Trường Grading grid Grade (0-10)

❒ Summative Feedback: ❒ Resubmission Feedback:

Grade: Assessor Signature: Date: IV Signature:

I. Introduction In this assignment, I have to develop an application to solve a small business problem. The problem requires a graphical user interface with features that required reading/writing data from text files, working with a collection of data. The application must handle errors so that it will not crash on the end-user side. The application also needs to be fully tested before the production phase. So, I made an application enough response named "Manage Employee", and I will describe clearly in my report. II. Requirement In Assignment, the requirement is about to develop an application to solve a small business problem. In the problem, it includes requires a graphical user interface with features that required reading / writing data from text file, working with a collection of data and can handle errors.

After read and understand the requirement, I created an application that have enough to solve specific problem about “Manage Employee”. The Manage Employee application will describe clearly in my report. III. UI Design UI Design Manage Employee IV. Implementation

1. Apache NetBeans IDE

Package and import libraries Libraries are using here:

  • Java.io*: import all the classes of the input output package in the program.
  • Java.util.ArrayList: Use to resizable array, which can be found in the java.
  • Java,util.List: represents an ordered sequence of objects. The elements contained in a Java List can be inserted, accessed, iterated and removed according to the order in which they appear internally in the Java List.
  • Javac.swing.JoptionPane: Used to provide standard dialog boxes such as message dialog box, confirm dialog box and input dialog box.
  • Javax.swing.table.DefaultTableModel: uses a Vector of Vectors to store the cell value objects.
  • Javax.swing.RowFilter: Used to filter out entries from the model so that they are not shown in the view.
  • Javax.swing.table.TableRowSorter: Use for perform the filtering using the javax.swing.RowFilter object.
  • Javax.swing.JFileChooser: Provides a simple mechanism for the user to choose a file.
  • Javax.swing.filechooser.FileNameExtensionFilter: An implementation of FileFilter that filters using a specified set of extensions.

The program has 5 features: Read file, Write File, Delete, Edit, Search. Program structure

3. Explain classes A class is used in object-oriented programming to describe one or more objects. In my program, class called Employee with 6 properties string: Id, Name, Address, Gender, Position, Salary.

Program structure

  • Add Firstly, when manager insert an information of employee about Id, Name, Address, Salary, Position, Gender, then, the information will go in table Employee. ActionState. Add will take this mission. Add feature code

There is the way add feature works: +) Declare var id, name, address, gender, salary to storage string that manager input by getText(). +) Use ‘if else’ statement to check. In this case, this statement is using for if the text field is empty, a notification will show up with “Missing information of employee” Notification of missing information +)Using comboPosition.getSelectedItem() to get the item from Position, it has 5 (Employee, Trainee, Expert, Manager, Director). After this, pressed it to string and storge in var positon declared, var employee also store information after insert. Position +) After insert completed, the table will clear by setText(“”) and display information inputted by display(employee). A notification will show up with “Add employee completed”. Inputted information completed +) When insert informations completed, to write file, import libraries filechooser.FileNameExtensionFilter and JFileChooser to work.

Edit feature code +) If manager did not insert a data of information in table, so, use if else statement, if size of class employess is under 0, the notification will show with “No data in the table”. If manager did not choose a row, the notification will show with “Please choose a row”. +) When manager click on the row want to edit. Declare employee is var format, that mean after chose from class employee, it will storage in employee. txtId, txtName, txtAddress, txtGender, txtSalary will display in text field each information by getId, getName, getAddress, getGender, getSalary. Position also display by comboPosition.setSelectedIndex(i). +) Add button is set text to Update button to save changed and ActionState. Edit will take the mission.

  • Delete In Delete feature, it works when manager click on row where manager wants to remove it, then click on Delete button.

Delete feature code +) If manager did not insert a data of information in table, so, use if else statement, if size of class employee is under 0, the notification will show with “No data in the table”. If manager did not choose a row, the notification will show with “No row is selected”. Declare chose to save the Row want to delete. +) When selected, a notification will show with “Do you want to delete this employee?”, two options Yes or No will display in new box by ‘YES_OPTION’. If NO, this row will still in table. If YES, this row will be delete. It delete from class Employee and table. fireTableDataChanged is for notifies all listeners that all cell values in the table's rows may have changed. Completed delete, a notification will display with ”Delete employee complete”.

  • Search Search feature helps manager to search. Search feature code +) Declare mode variable to get data from tblEmployee. After that, declare tr variable to collation data. Finally, use regex to collation date and display on table.

Example in my program: Example In case, when manager using application, after click on read file, output code showed an Error. This happen when coding errors made by the programmer, errors due to wrong input, or other unforeseeable things. To handle this problem but still made program work smoothly, I added ‘try - catch’ statement.

Example ( 2 ) When I run application, it is still work after I handle error with “try - catch” statement.

Add feature Edit feature changed from Nguyễn Văn A to Nguyễn Văn G

Delete feature Read file feature Search feature