Advanced Programming - ASSIGNMENT 1 (Pass + Merit + Distintion), Assignments of Programming Languages

This document reports about Advanced Programming subject with parts Pass, Merit and Distintion. With this document, you completely finish your assignment well. #btec #greenwich #advancedprogrammming #IT

Typology: Assignments

2020/2021

Available from 07/13/2021

trannguyentansang
trannguyentansang 🇻🇳

4.4

(130)

15 documents

1 / 52

Toggle sidebar

This page cannot be seen from the preview

Don't miss anything!

bg1
FRM03_Assignment brief_14.11.2012 Page 1
Higher Nationals in Computing
Advanced Programming - 1651
ASSIGNMENT
No.1
Learner’s Name:Trần Nguyễn Tấn Sang
Assessor Name: NGUYEN VAN SON
Class: GCS0804_NX
ID: GCS190019
Assignment due: 1 7/ 0 4/ 20 21
Assignment submitted: 1 0/0 4 /20 2 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

Partial preview of the text

Download Advanced Programming - ASSIGNMENT 1 (Pass + Merit + Distintion) and more Assignments Programming Languages in PDF only on Docsity!

Higher Nationals in Computing

Advanced Programming - 1651

ASSIGNMENT

No.

Learner’s Name: Trần Nguyễn Tấn Sang

Assessor Name: NGUYEN VAN SON

Class: GCS0804_NX ID: GCS Assignment due: 1 7 / 0 4 / 2 0 2 1 Assignment submitted: 1 0 / 0 4 / 2 0 2 1

ASSIGNMENT 1 FRONT SHEET Qualification BTEC HND Diploma in Computing and Systems Development Unit number and title Unit 20: Advanced Programing Assignment due 17/04/2021 Assignment submitted 10/04/ Learner’s name Tran Nguyen Tan Sang Assessor name Nguyen Van Son Learner declaration: I certify that the work submitted for this assignment is my own and research sources are fully acknowledged. Learner signature TAN SANG Date Grading grid P1 P2 M1 M2 D1 D Assignment title Assignment 1: OOP principles, features and design. In this assignment, you will have opportunities to provide evidence against the following criteria. Indicate the page numbers where the evidence can be found. Assessment criteria Expected evidence Task no. Assessor’s Feedback

Assessor’s Signature : Date:

ASSIGNMENT 1 BRIEF Unit Number and Title 20: Advance Programming Academic Year 2020 Unit Tutor Nguyễn Văn Sơn Assignment Title Assignment 1 Issue Date Submission Date 17/04/ IV Name & Date Pass Merit Distinction LO1 Examine the key components related to the object-orientated programming paradigm, analysing design pattern types D1 Analyse the relationship between the object-orientated paradigm and design patterns. P1 Examine the characteristics of the object-orientated paradigm as well as the various class relationships. M1 Determine a design pattern from each of the creational, structural and behavioural pattern types. LO2 Design a series of UML class diagrams D2 Define/refine class diagrams derived from a given code scenario using a UML tool. P2 Design and build class diagrams using a UML tool. M2 Define class diagrams for specific design patterns using a UML tool. Specific requirements (see Appendix for Scenario You’ve just made a contract with FPT Academy International, and are about to be appointed as a Project Leader for a group of programmers to

  1. Search students
  2. Delete students
  3. Update student
  4. Back to main menu ======================= Please choose: When user selects 2, the program will display submenu for managing lecturers: =======================
  5. Add new lecturer
  6. View all lecturers
  7. Search lecturers
  8. Delete lecturers
  9. Update lecturer
  10. Back to main menu ======================= Please choose: For the submenu: When user chooses 1, program will prompt user to input student’s/lecturer’s information (specified previously). After that, program will validate the input data and if they are all valid, program will add a new student/lecturer to the current list of students/lecturers. Program should inform to the user corresponding messages. When user chooses 2, the program will list all the students/lecturers to the screen, each student/lecturer in a row and student’s/lecturer’s data fields are separated by ‘|’. When user chooses 3, the program will ask user to input student’s/lecturer’s name to search for, the user can just type part of the name in order to search for complete student/lecturer information. When user chooses 4, program will ask user to input student/lecturer id to delete the student/lecturer with the specified id if it exists, otherwise,

it will display a message to inform users that the student/lecturer with such id doesn’t exist. When user chooses 5, program will first ask user to input student/lecturer id to update, once inserted and a student/lecturer with the inserted id exists, it will display current data for each field of the student/lecturer and user can type in new data to update or just press enter to keep the current data for the field. When user chooses 6, program will back to the main menu. Task 1 Produce a written, self-learning course for managers/senior developers that explain the principles and features of OOP and that show how OOP is good for code re-use. You can include appropriate sample Java code where it aids your points and/or provides further clarification. Ensure that any diagrams that are included have captions and are referenced in the text. Hint: You must include the following terms

  • Object/Class,
  • Abstraction,
  • Encapsulation,
  • Inheritance,
  • Polymorphism (Overloading and Overriding),
  • Abstract classes,
  • Interfaces Task 2 Problem Analysis, for the scenario above. You need to produce a full design for the requirements given. The design must include
  • Use-case diagrams for the most important features;
  • Class diagrams for all objects identified as well as class relationships.
  • Pseudo-code for the Algorithms for the main functionalities ( flowcharts for most complex functions). Example code can be used to help clarify OOP features.

D1 Analyse the relationship between the object-orientated paradigm and design patterns. D2 Define/refine class diagrams derived from a given code scenario using a UML tool. This brief has been verified as being fit for purpose Internal Verifier 1 Signature Date Internal Verifier 2 Signature Date

Table of Contents

  • relationships.............................................................................................................................................. P1. Examine the characteristics of the object-oriented paradigm as well as the various class
    • I. What are the characteristics of Object-Oriented programming language?
    • II. The various class relationships
  • types. M1. Determine a design pattern from each of the creational, structural and behavioral pattern
    • I. What are Design Patterns in software development?..................................................................
    • II. Creational Design Pattern
    • III. Structural Design Patterns
    • IV. Behavioral Design Patterns
  • D1. Analyze the relationship between the object-orientated paradigm and design patterns.
  • P2. Design and build class diagrams using a UML tool.
    • I. Use-case Diagram:
    • II. Class Diagram and Explanation
    • III. Pseudo-code..............................................................................................................................
  • M2. Define class diagrams for specific design patterns using a UML tool.
    • I. Creational Design patterns
    • II. Structural Design patterns
    • III. Behavioral Design patterns
  • D2. Define/refine class diagrams derived from a given code scenario using a UML tool.
  • References:

2) Abstraction : − Abstraction is one of the key concepts of object-oriented programming (OOP) languages. Its main goal is to handle complexity by hiding unnecessary details from the user. That enables the user to implement more complex logic on top of the provided abstraction without understanding or even thinking about all the hidden complexity. − That’s a very generic concept that’s not limited to object-oriented programming. You can find it everywhere in the real world. − Objects in an OOP language provide an abstraction that hides the internal implementation details. Similar to the coffee machine in your kitchen, you just need to know which methods of the object are available to call and which input parameters are needed to trigger a specific operation. But you don’t need to understand how this method is implemented and which kinds of actions it has to perform to create the expected result. − Let’s implement the coffee machine example in Java. You do the same in any other object-oriented programming language. The syntax might be a little bit different, but the general concept is the same. − Advantages of Abstraction

  • The main benefit of using an Abstraction in Programming is that it allows you to group several related classes as siblings.
  • Abstraction in Object Oriented Programming helps to reduce the complexity of the design and implementation process of software. − Implementation in C#: − 3) Encapsulation : − Encapsulation Meaning: In object-oriented computer programming languages, the notion of encapsulation (or OOP Encapsulation) refers to the bundling of data, along

with the methods that operate on that data, into a single unit. Many programming languages use encapsulation frequently in the form of classes. A class is a program- code-template that allows developers to create an object that has both variables (data) and behaviors (functions or methods). A class is an example of encapsulation in computer science in that it consists of data and methods that have been bundled into a single unit. − Encapsulation may also refer to a mechanism of restricting the direct access to some components of an object, such that users cannot access state values for all of the variables of a particular object. Encapsulation can be used to hide both data members and data functions or methods associated with an instantiated class or object. − Implementation in C#: −

− Implementation in C#: − − Ouput: − 5) Polymorphism : − The word polymorphism is used in various contexts and describes situations in which something occurs in several different forms. In computer science, it describes the concept that objects of different types can be accessed through the same interface. Each type can provide its own, independent implementation of this interface. It is one of the core concepts of object-oriented programming (OOP). − If you’re wondering if an object is polymorphic, you can perform a simple test. If the object successfully passes multiple is-a or instanceof tests, it’s polymorphic. As I’ve described in my post about inheritance, all Java classes extend the class Object. Due to this, all objects in Java are polymorphic because they pass at least two instanceof checks. − Different types of polymorphism

  • static or compile-time
  • dynamic − Static polymorphism
  • C#, like many other object-oriented programming languages, allows you to implement multiple methods within the same class that use the same name but a different set of parameteabe hat
  • keyrs. That is called method overloading and represents a static form of polymorphism.
  • The parameter sets have to differ in at least one of the following three criteria: o They need to have a different number of parameters, e.g. one method accepts 2 and another one 3 parameters. o The types of the parameters need to be different, e.g. one method accepts a String and another one a Long. o They need to expect the parameters in a different order, e.g. one method accepts a String and a Long and another one accepts a Long and a String. This kind of overloading is not recommended because it makes the API difficult to understand.
  • In most cases, each of these overloaded methods provides a different but very similar functionality.
  • Due to the different sets of parameters, each method has a different signature. That allows the compiler to identify which method has to be called and to bind it to the method call. This approach is called static binding or static polymorphism. − Dynamic polymorphism
  • This form of polymorphism doesn’t allow the compiler to determine the executed method. The JVM needs to do that at runtime.
  • Within an inheritance hierarchy, a subclass can override a method of its superclass. That enables the developer of the subclass to customize or completely replace the behavior of that method.
  • It also creates a form of polymorphism. Both methods, implemented by the super- and subclass, share the same name and parameters but provide different functionality. − Implementation in C#:

classes using the override keyword. After overriding the abstract method is in the non- Abstract class. We can derive this class in another class and again we can override the same abstract method with it. − Abstract Class Features:

  1. An abstract class can inherit from a class and one or more interfaces.
  2. An abstract class can implement code with non-Abstract methods.
  3. An Abstract class can have modifiers for methods, properties etc.
  4. An Abstract class can have constants and fields.
  5. An abstract class can implement a property.
  6. An abstract class can have constructors or destructors.
  7. An abstract class cannot be inherited from by structures.
  8. An abstract class cannot support multiple inheritance. − Implementation in C#: − 7) Interfaces: − An interface is a description of the actions that an object can do... for example when you flip a light switch, the light goes on, you don't care how, just that it does. In Object Oriented Programming, an Interface is a description of all functions that an object must have in order to be an "X". Again, as an example, anything that "ACTS LIKE" a light, should have a turn_on() method and a turn_off() method. The purpose of interfaces is to allow the computer to enforce these properties and to know that an object of TYPE T (whatever the interface is ) must have functions called X,Y,Z, etc.

− An interface is a programming structure/syntax that allows the computer to enforce certain properties on an object (class). For example, say we have a car class and a scooter class and a truck class. Each of these three classes should have a start_engine() action. How the "engine is started" for each vehicle is left to each particular class, but the fact that they must have a start_engine action is the domain of the interface. − Implmentation in C#: − II. The various class relationships − Code reuse is one of the many benefits of OOP (object-oriented programming). Reusability is feasible because of the various types of relationships that can be implemented among classes. This article will demonstrate the types of relationships (from weak to strong) using Java code samples and the symbols in the UML (unified modeling language) class diagram. − Dependency

  • Is a relationship when objects of a class work briefly with objects of another class. Normally, multiplicity doesn’t make sense on a dependency.

Association