unit 20 assignment 1 1651 PASS advance programming, Lecture notes of Java Programming

unit 20 assignment 1 1651 PASS advance programmingunit 20 assignment 1 1651 PASS advance programmingunit 20 assignment 1 1651 PASS advance programmingunit 20 assignment 1 1651 PASS advance programming

Typology: Lecture notes

2022/2023

Uploaded on 05/03/2023

nguyen-ly-6
nguyen-ly-6 🇻🇳

4.8

(10)

43 documents

1 / 41

Toggle sidebar

This page cannot be seen from the preview

Don't miss anything!

bg1
Higher Nationals in Computing
UNIT20:
:
ADVANCED PROGRAMMING
ASSIGNMENT 1
Assessor name: Nguyen Ngoc Tu
Learner's name: Ly Nguyen
ID: GCS210154
Class: GCS1003A
Subject code: 1651
Assignment due:
Assignment submitted:
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

Partial preview of the text

Download unit 20 assignment 1 1651 PASS advance programming and more Lecture notes Java Programming in PDF only on Docsity!

Higher Nationals in Computing

UNIT20:

ADVANCED PROGRAMMING

ASSIGNMENT 1

Assessor name: Nguyen Ngoc Tu

Learner's name: Ly Nguyen

ID: GCS

Class: GCS1003A

Subject code: 1651

Assignment due: Assignment submitted:

ASSIGNMENT 1 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 Ly Nguyen Student ID GCS Class GCS1003A Assessor name Nguyen Ngoc Tu 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 1

❒ Summative Feedback: ❒ Resubmission Feedback:

Grade: Assessor Signature: Date: Lecturer Signature: 3

ASSIGNMENT 1 BRIEF Qualification BTEC Level 5 HND Diploma in Computing Unit number Unit 20 : Advanced Programming Assignment title Examine and design solutions with OOP and Design Patterns Academic Year Unit Tutor Nguyen Ngoc Tu Issue date Submission date Submission Format: Format: The submission is in the form of a group written report. This should be written in a concise, formal business style using single spacing and font size 12. You are required to make use of headings, paragraphs and subsections as appropriate, and all work must be supported with research and referenced using the Harvard referencing system. Please also provide a bibliography using the Harvard referencing system. Submission Students are compulsory to submit the assignment in due date and in a way requested by the Tutors. The form of submission will be a soft copy in PDF posted on corresponding course of http://cms.greenwich.edu.vn/ Note: The Assignment must be your own work, and not copied by or from another student or from books etc. If you use ideas, quotes or data (such as diagrams) from books, journals or other sources, you must reference your sources, using the Harvard style. Make sure that you know how to reference properly, and that understand the guidelines on plagiarism. If you do not, you definitely get fail Assignment Brief and Guidance: Scenario : You have recently joined a software development company to help improve their documentation of their in-houses software libraries which were developed with very poor documentation. As a result, it has been very difficult for the company to utilise their code in multiple projects due to poor documentation. Your role is to alleviate this situation by showing the efficient of

Table of Contents

    1. Introduction.....................................................................................................................................
    1. OOP general concepts (P1)............................................................................................................
      • 2.1 Class......................................................................................................................................
      • 2.2 Objects...................................................................................................................................
      • 2.3 Data Abstraction....................................................................................................................
      • 2.4 Encapsulation......................................................................................................................
      • 2.5 Inheritance...........................................................................................................................
      • 2.6 Polymorphism......................................................................................................................
      • 2.7 Dynamic Binding..................................................................................................................
      • 2.8 Message Passing................................................................................................................
    1. OOP scenario (P2)........................................................................................................................
    • 3.1 Scenario..................................................................................................................................
    • 3.2 Usecase Diagram....................................................................................................................
      • Notations:...................................................................................................................................
      • Diagram:....................................................................................................................................
      • Use-case explain of diagram:....................................................................................................
    • 3.3 Class Diagram.........................................................................................................................
        1. Classes..................................................................................................................................
        1. Active Classes.......................................................................................................................
        1. Visibility..................................................................................................................................
        1. Associations...........................................................................................................................
        1. Multiplicity (Cardinality)..........................................................................................................
        1. Constraint..............................................................................................................................
        1. Composition and Aggregation...............................................................................................
        1. Generalization........................................................................................................................
        1. Class diagram explaination:..................................................................................................
    1. Conclusion....................................................................................................................................
  • REFERENCES..................................................................................................................................
  • Figure 1: Class example..................................................................................................................... Table of Figure
  • Figure 2: Objects example..................................................................................................................
  • Figure 3: Data Abstraction................................................................................................................
  • Figure 4: Encapsulation example.....................................................................................................
  • Figure 5: Inheritance example..........................................................................................................
  • Figure 6: Type of Polymorphism.......................................................................................................
  • Figure 7: Symbols in use case diagram............................................................................................
  • Figure 8: Diagram.............................................................................................................................
  • Figure 9: Class..................................................................................................................................
  • Figure 10: Active Classes.................................................................................................................
  • Figure 11: Visibility............................................................................................................................
  • Figure 12: Associations.....................................................................................................................
  • Figure 13: Multiplicity........................................................................................................................
  • Figure 14: Constraint........................................................................................................................
  • Figure 15: Composition and Aggregation.........................................................................................
  • Figure 16: Generalization..................................................................................................................
  • Figure 17: Class Diagram.................................................................................................................

Figure 1 : Class example For Example: Consider the Class of Cars. There may be many cars with different names and brands but all of them will share some common properties like all of them will have 4 wheels, Speed Limit, Mileage range, etc. So here, Car is the class, and wheels, speed limits, mileage are their properties. 2.2 Objects It is a basic unit of Object-Oriented Programming and represents the real-life entities. An Object is an instance of a Class. When a class is defined, no memory is allocated but when it is instantiated (i.e. an object is created) memory is allocated. An object has an identity, state, and behavior. Each object contains data and code to manipulate the data. Objects can interact without having to know details of each other’s data or code, it is sufficient to know the type of message accepted and type of response returned by the objects. Figure 2 : Objects example For example “Dog” is a real-life Object, which has some characteristics like color, Breed, Bark, Sleep, and Eats. 2.3 Data Abstraction Data abstraction is one of the most essential and important features of object-oriented programming. Data abstraction refers to providing only essential information about the data to the

outside world, hiding the background details or implementation. Consider a real-life example of a man driving a car. The man only knows that pressing the accelerators will increase the speed of the car or applying brakes will stop the car, but he does not know about how on pressing the accelerator the speed is increasing, he does not know about the inner mechanism of the car or the implementation of the accelerator, brakes, etc in the car. This is what abstraction is. Figure 3 : Data Abstraction 2.4 Encapsulation Encapsulation is defined as the wrapping up of data under a single unit. It is the mechanism that binds together code and the data it manipulates. In Encapsulation, the variables or data of a class are hidden from any other class and can be accessed only through any member function of their class in which they are declared. As in encapsulation, the data in a class is hidden from other classes, so it is also known as data-hiding.

Figure 5 : Inheritance example 2.6 Polymorphism The word polymorphism means having many forms. In simple words, we can define polymorphism as the ability of a message to be displayed in more than one form. For example, A person at the same time can have different characteristics. Like a man at the same time is a father, a husband, an employee. So the same person posses different behavior in different situations. This is called polymorphism. Figure 6 : Type of Polymorphism

2.7 Dynamic Binding In dynamic binding, the code to be executed in response to the function call is decided at runtime. Dynamic binding means that the code associated with a given procedure call is not known until the time of the call at run time. Dynamic Method Binding One of the main advantages of inheritance is that some derived class D has all the members of its base class B. Once D is not hiding any of the public members of B, then an object of D can represent B in any context where a B could be used. This feature is known as subtype polymorphism. 2.8 Message Passing It is a form of communication used in object-oriented programming as well as parallel programming. Objects communicate with one another by sending and receiving information to each other. A message for an object is a request for execution of a procedure and therefore will invoke a function in the receiving object that generates the desired results. Message passing involves specifying the name of the object, the name of the function, and the information to be sent.

3.OOP scenario (P2)

3.1 Scenario

Merchants want software that can handle basic business to reduce their workload because the number of management positions in stores is increasing day by day due to high market demand. The company asked me to create laptop store management software that tracks products, customers, and employees. This software involves employee and customer information such as ID, name, address, and phone number. It also includes information about the product such as ID, name, and price. All product management, customer management, and employee management information can be added, edited, deleted, found and viewed all. This application must offer functionalities through a menu =====================

  1. Manage Employee
  2. Manage Customer
  3. Manage Product
  4. Exit Please choose: The application will end when the user selects 6
  1. Update Product
  2. Delete Product
  3. View all Product
  4. Find Product
  5. Back to main menu ====================== Please choose: For the Employee Management submenu :  When the user selects 1, the program prompts the user to enter the information. After that, the program will validate the input data and if they are valid, the program will add the new employee to the current employee list.  When the user selects 2, the program will let the user enter the id if the list has the user id entered, the program will prompt the user to update the information of that id. the program will remove that id's information from the list.  When the user selects 4, the program will display all the information of each employee in the list.  When the user selects 5, the program will let the user enter the id if the list has the entered user id then the program will display all the information of that id.  When the user selects 6, the program returns to the main menu. For the Customer Management submenu:  When the user selects 1, the program prompts the user to enter the information. After that, the program will validate the input data and if they are valid, the program will add the new customer to the existing customer list.  When the user selects 2, the program will let the user enter the id, if the list has entered the user id, the program will prompt the user to update the information of that id.  When the user selects 3, the program will let the user enter the id, if the list has the user id entered, the program will remove that id's information from the list.  When the user selects 4, the program will display all the information of each customer in the list.  When the user selects 5, the program will let the user enter the id if the list has the entered user id then the program will display all the information of that id.  When the user selects 6, the program returns to the main menu. For the Product Management submenu :

 When the user selects 1, the program prompts the user to enter the information. After that, the program will validate the input data and if they are valid, the program will add the new product to the existing product list.  When the user selects 2, the program will let the user enter the id, if the list has entered the user id, the program will prompt the user to update the information of that id.  When the user selects 3, the program will let the user enter the id, if the list has the user id entered, the program will remove that id's information from the list.  When the user selects 4, the program will display full information of each product in the list.  When the user selects 5, the program will let the user enter the id if the list has the entered user id then the program will display all the information of that id.  When the user selects 6, the program returns to the main menu. 3.2 Usecase Diagram A UML behavior or dynamic diagram is a use case diagram. Employ case diagrams use actors and use cases to represent the functionality of a system. Use cases are a collection of tasks, offerings, and operations the system must handle. A "system" in this context is something that is being created or run, like a website. The "actors" are individuals or groups acting in certain capacities inside the system (smartdraw, 2022) Notations:Actor : A system's interactions with external entities are represented by actors. The actor itself is not fully modeled by the system because it is external to it. However, the latter may have a simplified model of the actor in order to design the interactions between an actor and a system. One typical example of an actor is a system user. Other sorts of actors include external hardware, such as a sensor, software systems that are being integrated with the existing system (for example, a network protocol, a database system, a file system), and so on.  Use Case : A use case indicates a feature that the system is anticipated to implemen. Other than its distinct name, a use case's details are not physically reflected in the diagram; instead, they are described in use case narratives. A use case may be divided into multiple use cases and connected by > or > relationships depending on the application domain and the designer's decision (described later in this document). Typically, use cases are started by the main actors. Through a series of use cases, the system makes use of secondary actors like a database. A two-way communication is represented by the association between a use case and an actor. As a result, if a primary actor initiates a use case, the latter must receive a response. Similar to this, if a secondary actor and a use case are associated, the communication begins with the use case, and the secondary actor is anticipated to reply to the initiation.  Generalization : This illustrates a connection between the actors or use cases. The actor (or use case) at the tail end of the arrow (attached to the base of the triangle) is a customized version of the actor (or use case) at the other end if two actors are related through this connection. The actor (or use case) at the base end, which is attached to the

Figure 7 : Symbols in use case diagram

Diagram: Figure 8 : Diagram