1. Trang chủ
  2. » Công Nghệ Thông Tin

Huỳnh trần anh khoa GCS200252 java

25 8 0

Đang tải... (xem toàn văn)

Tài liệu hạn chế xem trước, để xem đầy đủ mời bạn chọn Tải xuống

THÔNG TIN TÀI LIỆU

Thông tin cơ bản

Tiêu đề Java Programming
Tác giả Huỳnh Trần Anh Khoa
Người hướng dẫn Lâm Nguyễn Trung Nam, PTS
Trường học BTEC Level 5 HND Diploma in Computing
Chuyên ngành Java Programming
Thể loại assignment
Năm xuất bản 2022
Định dạng
Số trang 25
Dung lượng 1,49 MB

Các công cụ chuyển đổi và chỉnh sửa cho tài liệu này

Nội dung

Higher Nationals in Computing JAVA PROGRAMMING ASSIGNMENT No 11 Learner’s name Assessor name Nam Lam Class Learner’s ID Subject’s ID Assignment due Assignment submitted Table of Contents and Figure Table of Contents ASSIGNMENT 1 FRONT SHEET 3 Assessment Brief 5 Introduction 8 Requirement (Use Case Diagram) 9 Figure 01 Cashier Package 10 Figure 02 Report Package 11 UI design (Wireframe) 11 Figure 03 Wireframe of Java Programming 13 Implementation (Code) 13 Test (Results) 21 Figure 04 Picture of.

Trang 1

Higher Nationals in Computing

Trang 2

Table of Contents and Figure

Table of Contents

ASSIGNMENT 1 FRONT SHEET 3

Assessment Brief 5

Introduction 8

Requirement (Use Case Diagram) 9

Figure 01: Cashier Package 10

Figure 02: Report Package 11

UI design (Wireframe) 11

Figure 03: Wireframe of Java Programming 13

Implementation (Code) 13

Test (Results) 21

Figure 04: Picture of Result 01 21

Figure 05: Picture of Result 02 22

Figure 06: Employee Information 24

Figure 07: Message 25

Reference 25

Trang 3

ASSIGNMENT 1 FRONT SHEET

Qualification BTEC Level 5 HND Diploma in Computing

Unit number and title Java Programming

Submission date 10/03/2022 Date Received 1st submission 10/03/2022

Student Name Huỳnh Trần Anh Khoa Student ID GCS200252

Class GCS0903B Assessor name Lâm Nguyễn Trung Nam

Trang 4

❒ Summative Feedback: ❒ Resubmission Feedback:

IV Signature:

Grade:

Trang 5

Assessment Brief

Student Name/ID Number Huỳnh Trần Anh Khoa/GCS200252

Unit Number and Title Object Oriented Programming with Java

Academic Year 2020 - 2021

Unit Tutor

Assignment Number &

Title Design, Implement and Test a GUI application

Trang 6

Unit Learning Outcomes

LO1 Understand basic programming skills and OOP paradigm

LO2 Understand how to detect errors and handle errors

LO3 Understand how to working with files in applications

LO4 Understand how to build GUI application

Assignment Brief

You 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 file, working with

a collection of data (searching for item / min / max / sum / etc.) The application must handle errors

so that it will not crash at end user side The application also need to be fully tested before the

Trang 7

Learning Outcomes and Assessment Criteria

LO1 Understand basic programming skills and OOP paradigm

LO2 Understand how to detect errors and handle errors

LO3 Understand how to working with files in applications

LO4 Understand how to build GUI application

To get Pass (5 – 6.5 points)

- Student can design and implement GUI for the application solve a specific problem

- Student knows how to load and save data from file

- Student knows how to handle errors by using exceptions

- Student knows how to write test plan, execute test cases and log results

To get Merit (7 – 8.5 points)

- The application is well designed, user friendly and has logical flow of actions

- Can apply MVC in the application, can apply JUnit to test automatic

- Errors are well handle to avoid program crashing, the test can cover as many as possible the errors

in program

To get Distinction (9 – 10 points)

The application must show excellent design & implementation, runs without any errors, all inputs are validated, all errors are well handled including recover choice, rich features showing unique ideas, algorithms

Trang 8

Introduction

Java is a class-based, object-oriented programming language with minimal

implementation requirements It is a general-purpose programming language that enables developers to write once and run anywhere (WORA), which implies that generated Java code may run on any Java-enabled systems without the need for recompilation Java

programs are often compiled to bytecode, which may be executed on any Java virtual machine (JVM), independent of underlying computer architecture Java's syntax is

comparable to those of C and C++, although it provides less low-level features than the preceding languages The Java runtime includes dynamic features (such as reflection and runtime code change) not seen in typically compiled languages According to GitHub, as

of 2019, Java is one of the most popular programming languages, particularly for server web applications, with 9 million developers

client-For any of these small company difficulties, the Java programming language is the ideal option It may assist you and your clients with billing concerns, making invoices,

inventory checks, and registering students

Trang 9

Requirement (Use Case Diagram)

Trang 10

Figure 01: Cashier Package

Trang 11

Figure 02: Report Package

UI design (Wireframe)

Trang 13

Figure 03: Wireframe of Java Programming

public class EmployeeManagement {

ArrayList<Employee> eList = new ArrayList<Employee>();

Employee currentEmp;

File empFile = new File ("Employee.data");

FileOutputStream empStream;

ObjectOutputStream empObjectStream;

Trang 14

protected String firstName;

protected String lastName;

protected boolean gender;

protected LocalDate DoB;

protected String address;

protected String phone;

protected String email;

public Employee(String id2, String firstname2, String lastname2, boolean , LocalDate of, String address2,

String phone2, String email2) {

// TODO Auto-generated constructor stub

Trang 15

SSN = ssn;

}

public double payCommission() {

return commissionRate*totalSales; }

public void setTotalSales(double ) {

}

public double getTotalSales() {

return totalSales; }

class BasePlusCommissionEmployee extends CommissionEmployee{

public double paySalaryandCommission() {

return baseSalary + payCommission();

}

}

}

private JFrame frame;

private JTextField txtId;

private JTextField txtFirstName;

private JTextField txtLastName;

private JTextField txtPhone;

private JTextField txtEmail;

private JRadioButton rdMale;

private JRadioButton rdFemale;

public static void main(String[] args) {

EventQueue.invokeLater(new Runnable() {

public void run() {

try {

EmployeeManagement window = new EmployeeManagement();

window.frame.setVisible(true);

Trang 16

private void initialize() {

JLabel lblNewLabel = new JLabel("ID");

lblNewLabel.setFont(new Font("Tahoma", Font.BOLD, 10));

lblNewLabel.setBounds(10, 36, 40, 19);

JLabel lblFirstname = new JLabel("First Name");

lblFirstname.setFont(new Font("Tahoma", Font.BOLD, 10));

lblFirstname.setBounds(10, 60, 56, 19);

JLabel lblLastname = new JLabel("Last Name");

lblLastname.setFont(new Font("Tahoma", Font.BOLD, 10));

lblLastname.setBounds(10, 89, 56, 19);

JLabel lblNewLabel_1 = new JLabel("EMPLOYEE INFORMATION");

lblNewLabel_1.setFont(new Font("Tahoma", Font.BOLD, 15));

lblNewLabel_1.setBounds(101, 0, 225, 33);

Trang 17

JLabel lblGender = new JLabel("Gender");

lblGender.setFont(new Font("Tahoma", Font.BOLD, 10));

lblGender.setBounds(10, 118, 56, 19);

JLabel lblDob = new JLabel("DoB");

lblDob.setFont(new Font("Tahoma", Font.BOLD, 10));

lblDob.setBounds(10, 147, 56, 19);

JLabel lblAddress = new JLabel("Address");

lblAddress.setFont(new Font("Tahoma", Font.BOLD, 10));

lblAddress.setBounds(10, 181, 56, 19);

JLabel lblPhone = new JLabel("Phone");

lblPhone.setFont(new Font("Tahoma", Font.BOLD, 10));

lblPhone.setBounds(10, 246, 56, 19);

JLabel lblEmail = new JLabel("Email");

lblEmail.setFont(new Font("Tahoma", Font.BOLD, 10));

lblEmail.setBounds(10, 282, 56, 19);

JRadioButton rdMale = new JRadioButton("Male");

rdMale.setFont(new Font("Tahoma", Font.BOLD, 10));

rdMale.setBounds(161, 117, 56, 21);

SimpleDateFormat dateFormat = new SimpleDateFormat("dd/MM/yyyy");

JSpinner spDoB = new JSpinner(new SpinnerDateModel ());

spDoB.setEditor(new JSpinner.DateEditor(spDoB, dateFormat.toPattern()));

spDoB.setBounds(105, 156, 139, 20);

Trang 18

JTextArea taAddress = new JTextArea();

taAddress.setBounds(76, 178, 264, 55);

JTextArea txtId = new JTextArea();

txtId.setBounds(71, 36, 164, 19);

JTextArea txtFirstName = new JTextArea();

txtFirstName.setBounds(71, 60, 164, 19);

JTextArea txtLastName = new JTextArea();

txtLastName.setBounds(71, 86, 164, 19);

JTextArea txtPhone = new JTextArea();

txtPhone.setBounds(76, 243, 142, 19);

JTextArea txtEmail = new JTextArea();

txtEmail.setBounds(76, 279, 142, 19);

JButton btnCreate = new JButton("Create");

btnCreate.setFont(new Font("Tahoma", Font.BOLD, 10));

btnCreate.setBounds(122, 325, 85, 21);

JButton btnCancel = new JButton("Cancel");

btnCancel.setFont(new Font("Tahoma", Font.BOLD, 10));

btnCancel.setBounds(208, 325, 85, 21);

JButton btnPrev = new JButton("<< Prev");

btnPrev.setBounds(29, 324, 89, 23);

JButton btnNext = new JButton("Next >>");

btnNext.addActionListener(new ActionListener() {

public void actionPerformed(ActionEvent e) { }

});

btnNext.setBounds(297, 324, 89, 23);

Trang 19

frame.getContentPane().add(btnNext);

JMenuBar menuBar = new JMenuBar();

menuBar.setBounds(0, 3, 101, 22);

JMenu mnNewMenu = new JMenu("File");

menuBar.add(mnNewMenu);

JMenuItem mntmNewMenuItem = new JMenuItem("Save All Employee Data");

mntmNewMenuItem.addActionListener(new ActionListener() {

public void actionPerformed(ActionEvent e) {

try {

}catch (IOException e1) { e1.printStackTrace();

} }

});

mnNewMenu.add(mntmNewMenuItem);

JMenuItem mntmNewMenuItem_1 = new JMenuItem("Load All Employee Data");

mntmNewMenuItem_1.addActionListener(new ActionListener() {

public void actionPerformed(ActionEvent e) {

try {

txtId.setText(String.valueOf(currentEmp.id));

txtFirstName.setText(currentEmp.firstName);

txtLastName.setText(currentEmp.lastName);

taAddress.setText(currentEmp.address);

txtPhone.setText(currentEmp.phone);

txtEmail.setText(currentEmp.email);

}catch (IOException e1) { e1.printStackTrace();

} catch (ClassNotFoundException e1) {

// TODO Auto-generated catch block

Trang 20

e1.printStackTrace();

} }

});

mnNewMenu.add(mntmNewMenuItem_1);

btnCreate.addActionListener(new ActionListener() {

public void actionPerformed(ActionEvent e) {

int id = Integer.parseInt(txtId.getText());

String firstname = txtFirstName.getText();

String lastname = txtLastName.getText();

String address = taAddress.getText();

String phone = txtPhone.getText();

String email = txtEmail.getText();

Employee emp = new Employee(id, firstname, lastname, true, LocalDate.of(2002, 04, 16), address, phone,

"email:"+ emp.email);

Trang 21

Test (Results)

Figure 04: Picture of Result 01

Trang 22

Figure 05: Picture of Result 02

Trang 24

Figure 06: Employee Information

Trang 25

https://www.researchgate.net/figure/Figure-4-Use-Case-Diagram-of-Cashier-Package-[3] Researchgate, Use Case Diagram 02, Available at

Figure-6-illustrate-the-use-case-diagram-of_fig5_288858003

Ngày đăng: 11/05/2022, 17:14

TỪ KHÓA LIÊN QUAN