Docsity

PROG191-Assignment- Java Programming, Assignments of Java Programming

Toggle sidebar
bg1
T r a n g 1 | 52
ASSIGNMENT 1 FRONT SHEET
Qualification
BTEC Level 5 HND Diploma in Computing
Unit number and title
Submission date
March 9th ,2022
Date Received 1st submission
Re-submission Date
Date Received 2nd submission
Student Name
Nguyen Duc Quang
Student ID
GCH200720
Class
GCH0908
Assessor name
Dinh Duc Manh
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
Quang
Grading grid
Grade (0-10)
pf3
pf4
pf5
pf8
pf9
pfa
pfd
pfe
pff
pf12
pf13
pf14
pf15
pf16
pf17
pf18
pf19
pf1a
pf1b
pf1c
pf1d
pf1e
pf1f
pf20
pf21
pf22
pf23
pf24
pf25
pf26
pf27
pf28
pf29
pf2a
pf2b
pf2c
pf2d
pf2e
pf2f
pf30
pf31
pf32
pf33
pf34

Partial preview of the text

Download PROG191-Assignment- Java Programming 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 March 9th^ ,2022 Date Received 1st submission Re-submission Date Date Received 2nd submission Student Name Nguyen Duc Quang Student ID GCH Class GCH0908 Assessor name Dinh Duc Manh 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 Quang Grading grid Grade (0-10)

❒ Summative Feedback: ❒ Resubmission Feedback:

Grade: Assessor Signature: Date: IV Signature:

I. Introduction:

Currently, the use of books to look up information as well as entertainment at my library is increasing. This leads to manual library management which makes it difficult, delayed and impossible for us to control the right amount. Therefore, I decided to create an application that supports book management in java language. This application helps me to know the exact information of the book and control its price and quantity.

II. Requirement

The java program that I created helped me solve some of the following problems:

  • I can enter data, and can edit and delete them easily and understandably
  • I can find information about the product I need through the search function.
  • I can review the information I have entered before through the program's file reading and writing function

III. UI design

The first is the initialization method. I use this method to initialize the objects I declared above. This helps me to initialize values for properties inside it and helps me to call other corresponding methods to initialize the logic inside the objects. I then apply java's encapsulation through getter and setter methods to define accessibility for the private properties I initialized above and allow those properties to be viewed and modified.

I apply java’s inheritance to this class. Through calling hashCode() method I will get the hashcode value of the above initialized elements. Combined with that, I use the equals()) method to semantically compare two objects (by comparing the data members of the class).

In the bookManagement class, I have declared properties like file (for file read and write functionality), a new List named bookList which is linked from the Book.java class that I created, a memory variable which is model to use Used for information display function, two integer variables index and editIndex are used to

display and interact with information. Then I instantiate a new method called bookManagement , which contains the values of the properties created above. I will use them to pass values to the methods and functions below. I initialize the thongke array with the function of displaying the information printed under the labels Total, Borrowed, BorrowedCost , used to calculate the total number of books, the number of books to borrow and the amount of books to be borrowed.

in the writeFile array with the input bookList variable, I initialize 2 variables fileOutputStream and outputStream with the initial value of null. I use try ... to catch the exception through which to pass the value of the initialized file variable into this method. I use a for loop so that every time a value is added to memory, the writeObject method with the variable b as bookList will be executed. In the catch part, I leave

the conditions printed to the screen as unsatisfactory. I end the method with finally with another try..catch exception method to remove unsatisfied conditions Similarly, in the readFile array with the input bookList variable, I initialized 2 variables fileInputStream and inputStream with the initial value of null. I use try ... to catch the exception through which to pass the value