Docsity

Assignment2_DataStructuresandAlgorithms, Exercises of Data Structures and Algorithms

Toggle sidebar
bg1
ASSIGNMENT 2 FRONT SHEET
Qualification BTEC Level 5 HND Diploma in Computing
Unit number and title Unit 20: Advanced Programming
Submission date Date Received 1st submission
Re-submission Date Date Received 2nd submission
Student Name NGUYEN TIEN LOC Student ID BHAF200116
Class PBIT17102 Assessor name NGUYEN THAI CUONG
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
Grading grid
P3 P4 M3 M4 D3 D4
1
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
pf35

Partial preview of the text

Download Assignment2_DataStructuresandAlgorithms and more Exercises Data Structures and Algorithms in PDF only on Docsity!

ASSIGNMENT 2 FRONT SHEET

Qualification BTEC Level 5 HND Diploma in Computing Unit number and title Unit 20: Advanced Programming Submission date Date Received 1st submission Re-submission Date Date Received 2nd submission Student Name NGUYEN TIEN LOC Student ID BHAF Class PBIT17102 Assessor name NGUYEN THAI CUONG 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 Grading grid P3 P4 M3 M4 D3 D

❒ Summative Feedback: ❒ Resubmission Feedback:

Grade: Assessor Signature: Date: Lecturer Signature:

  • A. Introduction..............................................................................................................................................................
  • B. Build an application derived from UML class diagrams. (P3)................................................................................
    • I. Scenario
    • II. Class Diagram
    • III. Explain
    • IV. Initialization
    • V. Implementation
    • VII. Text Case
  • (P4).............................................................................................................................................................................. C. Discuss a range of design patterns with relevant examples of creational, structural and behavioral pattern types
    • I. Definition.............................................................................................................................................................
    • II. Why should use Design Pattern.......................................................................................................................
    • III. Elements of Design Pattern............................................................................................................................
    • IV. Advantage and Disadvantage of Design Pattern.........................................................................................
    • V. Design Patterns Classification........................................................................................................................
        1. Creational patterns
        1. Structural Pattern
        1. Behavioral Pattern
  • D. Conclusion.............................................................................................................................................................
  • E. Reference................................................................................................................................................................

A. Introduction

The previous report covered everything OOP-related, including OOP concepts, OOP traits, and much more. A basic introduction to UML and class relationships was also provided. In this report, I will select a specific scenario to apply a program to in order to put all of the previous report's knowledge into practice. The UML class diagram will be included in the report for clarity. Finally, a summary of the design pattern that will be used in future projects will be provided.

B. Build an application derived from UML class diagrams. (P3)

I. Scenario

As mentioned in Assignment 1, I designed a book borrow management system. In this system, I have designed 5 main classes: Borrow, Person, Book, Journals and TextBook. The book borrow management system can provide a list of people who have borrowed books and the books currently available at the library. This makes managing the borrower easier and also helps the borrower find a specific book at any time in the library. The main functions that have also been developed by me include create, show, update and delete. To make this system, I will use the Java programming language and combine it with the Design Pattern to make it easier to reuse, maintain, and be flexible. The Builder Pattern will be the design pattern I have chosen.

II. Class Diagram

In assignment 1, I designed a UML diagram for my project. But in this assignment, I have revised it to make it easier to understand and more convenient to write code program during project development process. The UML diagram as follows:

library. Maintaining a database used to add new books and track borrowers is another aspect of a book borrow management system. Some Requirements:  Any library reader can conduct a book search using BookName, AuthorName, TypeName.  Each book will have a special identification number, as well as other information, such as Journals or Textbook category, will assist in finding the book directly.  Library members can borrow and reserve any copy of a book, even if it is available Multiple copies available.  The system must be able to retrieve detailed information such as who borrowed a particular book or document.  Each book and membership card will have a unique barcode. The system will be able to read the barcode on library cards and books I have planned to present the above scenario to show the features in OOP and optimize system the most. To apply for the project, I chose to use Builder Pattern to solve my problem. IV. Initialization Here I will initialize and show how to do work it and the function are implemented. Below is the Borrow class, I will declared Borrow ID and i had relationship to the Person and Book classes. Next I declared setter and getter functions for Borrow class.

In the Interface Folder, i will create ActionBorrow which is inherit all the function and methods, behavior of the Action class to be able to handle from the Manager.

Next, below is Edit function of Borrow Manage class on the Manage folder. Here, the user can enter ID what you want to edit. If the ID not existed ,the System will print “ not valid “ and else the System will display Book and Person for you.

Next, Below is the delete function of Borrow Manage on the manage folder. For this function, you can delete Borrow who want to delete. So, You only enter ID to delete and the remove it. Next , the show and search functions of this class. Below is detailed code and the way use to it. If the objects do not exist, I will display a message “ Not Found “.

Finally, in the Main class i have some pre-initialize objects as well as data added to the menu. below is the code for the casese user can select and conditions i have set for it.