Advanced Programming - 1651- Assignment 1 - Pass, Study Guides, Projects, Research of Advanced Data Analysis

Advanced Programming - 1651 - Pass. Game is so easy!!!

Typology: Study Guides, Projects, Research

2021/2022

Uploaded on 09/13/2022

ke-danh-cap-trai-tim
ke-danh-cap-trai-tim 🇻🇳

4.6

(31)

7 documents

1 / 55

Toggle sidebar

This page cannot be seen from the preview

Don't miss anything!

bg1
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
Student ID
Class
Assessor name
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
P1
P2
M1
M2
D1
D2
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
pf36
pf37

Partial preview of the text

Download Advanced Programming - 1651- Assignment 1 - Pass and more Study Guides, Projects, Research Advanced Data Analysis in PDF only on Docsity!

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 Student ID Class Assessor name 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 P1 P2 M1 M2 D1 D

 Summative Feedback:  Resubmission Feedback:

Grade: Assessor Signature: Date: Lecturer Signature:

Tasks You and your team need to explain characteristics of Object-oriented programming paradigm by applying Object-oriented analysis and design on a given (assumed) scenario. The scenario can be small but should be able to presents various characteristics of OOP (such as: encapsulation, inheritance, polymorphism, override, overload, etc.). The second task is to introduce some design patterns (including 3 types: creational, structural and behavioral) to audience by giving real case scenarios, corresponding patterns illustrated by UML class diagrams. To summarize, you should analyze the relationship between the object-orientated paradigm and design patterns. The presentation should be about approximately 20-30 minutes and it should be summarized of the team report. Learning Outcomes and Assessment Criteria Pass Merit Distinction LO1 Examine the key components related to the object-orientated programming paradigm, analysing design pattern types 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. D1 Analyse the relationship between the object- orientated paradigm and design patterns. LO2 Design a series of UML class diagrams P2 Design and build class diagrams using a UML tool. M2 Define class diagrams for specific design patterns using a UML tool. D2 Define/refine class diagrams derived from a given code scenario using a UML tool.

Table of Contents

  • analyzing design pattern types........................................................................................................................ Chapter 1: Examine the key components related to the object-orientated programming paradigm,
      1. OOP general concepts
      1. Class
      1. Object
      1. Data Abstraction
      1. Encapsulation
      1. Inheritance
      1. Polymorphism.......................................................................................................................................
      1. Method Overloading
      1. Method Overriding
      1. Interface
  • Chapter 2: Design a series of UML class diagrams
    • Scenario
      1. Use case diagram
      1. Class Diagram
  • References
  • Figure 1 Class example
  • Figure 2 Output of class
  • Figure 3 Object example
  • Figure 4 Output of object
  • Figure 5 Data Abstraction example
  • Figure 6 Output of Data Abstraction
  • Figure 7 Encapsulation example
  • Figure 8 Ouptput of Encapsulation...............................................................................................................
  • Figure 9 Inheritance example
  • Figure 10 Output of Inheritance
  • Figure 11 Polymorphism example................................................................................................................
  • Figure 12 Output of polymorphism
  • Figure 13 Method Overloading example
  • Figure 14 Output of method overloading
  • Figure 15 Method Overriding example
  • Figure 16 Output of method overriding........................................................................................................
  • Figure 17 Interface example
  • Figure 18 Output of interface
  • Figure 19 An example of a use case diagram's symbols
  • Figure 20 My use-case..................................................................................................................................
  • Figure 21 Notation Class(1)
  • Figure 22 Notation Class(2)
  • Figure 23 Notation Class(3)
  • Figure 24 Notation Class(4)
  • Figure 25 Notation Class(5)
  • Figure 26 Notation Class(6)
  • Figure 27 Notation Class(7)
  • Figure 28 Notation Class(8)
  • Figure 29 Class diagram
  • Table 1 The information of customer
  • Table 2 The information of employee
  • Table 3 The information of product
  • Table 4 Use-case manage menu
  • Table 5 Use-case manage employee.............................................................................................................
  • Table 6 Use-case manage product
  • Table 7 Use-case exit....................................................................................................................................
  • Table 8 Use-case add employee
  • Table 9 Use-case update employee
  • Table 10 Use-case delete employee
  • Table 11 Use-case find employee.................................................................................................................
  • Table 12 Use-case view all employee
  • Table 13 Use-case back to menu (in Manage Employee)
  • Table 14 Use-case add customer
  • Table 15 Use-case update customer
  • Table 16 Use-case delete customer
  • Table 17 Use-case find customer
  • Table 18 Use-case view all customer
  • Table 19 Use-case back to menu(in Manage Customer)
  • Table 20 Use-case add product.....................................................................................................................
  • Table 21 Use-case update product
  • Table 22 Use-case delete product
  • Table 23 Use-case find product
  • Table 24 Use-case view all product..............................................................................................................
  • Table 25 Use-case back to menu

Chapter 1: Examine the key components related to the object-orientated programming paradigm, analyzing design pattern types

1. OOP general concepts Programming languages that use objects are known as "object-oriented programming," or OOPs. The objective of object-oriented programming is to incorporate real-world ideas like inheritance, hiding, polymorphism, etc. into computer code. The main objective of OOP is to connect the functions that use the data and the data itself, ensuring that only that function and no other part of the code can access the data (sambhav228, 2020) OOPs Concepts:  Class  Objects  Data Abstraction  Encapsulation  Inheritance  Polymorphism  Dynamic Binding  Message Passing (sambhav228, 2020) 2. Class An individual data type is a class. When a class instance is created, its data members and member functions can be accessed and used. It stands for the collection of traits or operations that all objects of a particular type share. A class is comparable to an object's blueprint (sambhav228, 2020) Figure 1 Class example Code example: New objects are initialized in class constructors. Methods are used to implement the action of the class and its objects, whereas fields are variables that supply the state of the class and its objects (Mangal, 2022)

Figure 3 Object example Example : A class is said to be instantiated when its object is produced. Every instance shares the traits and behaviors of the class. The states of such properties, or their values, are unique to each object. There is no limit to how many instances there can be of a single class (Mangal, 2022) Code :

// C# program to illustrate the // Initialization of an object using System; // Class Declaration public class Dog { // Instance Variables String name; String breed; int age; String color; // Constructor Declaration of Class public Dog(String name, String breed, int age, String color) { this.name = name; this.breed = breed; this.age = age; this.color = color; } // Property 1 public String GetName() { return name; } // Property 2 public String GetBreed() { return breed; } // Property 3 public int GetAge() { return age; } // Property 4 public String GetColor() {

Figure 5 Data Abstraction example // C# program to calculate the area // of a square using the concept of // data abstraction using System; namespace Demoabstraction { // abstract class abstract class Shape { // abstract method public abstract int area(); } // square class inheriting // the Shape class class Square : Shape { // private data member private int side; // method of square class public Square(int x = 0) {

side = x; } // overriding of the abstract method of Shape // class using the override keyword public override int area() { Console.Write("Area of Square: "); return (side * side); } } // Driver Class class GFG { // Main Method static void Main(string[] args) { // creating reference of Shape class // which refer to Square class instance Shape sh = new Square(4); // calling the method double result = sh.area(); Console.Write("{0}", result); } } } Output: Figure 6 Output of Data Abstraction (saini, 2021) 5. Encapsulation Data wrapped up into a single unit is referred to as encapsulation. It serves as the link between the code and the data that it works with. With encapsulation, a class's variables or data are kept private from other classes and are only accessible through member functions of the class in which they were declared. Data-

get { return studentAge; } set { studentAge = value; } } } // Driver Class class GFG { // Main Method static public void Main() { // creating object DemoEncap obj = new DemoEncap(); // calls set accessor of the property Name, // and pass "Ankita" as value of the // standard field 'value' obj.Name = "Ankita"; // calls set accessor of the property Age, // and pass "21" as value of the // standard field 'value' obj.Age = 21; // Displaying values of the variables Console.WriteLine("Name: " + obj.Name); Console.WriteLine("Age: " + obj.Age); } } Output: Figure 8 Ouptput of Encapsulation

(Saini, 2019) 6. Inheritance A crucial OOP tenet is inheritance (Object-Oriented Programming). Inheritance refers to a class's capacity to inherit traits and properties from another class. The properties of other classes are inherited when we create a class. Therefore, since properties and functions can be inherited from another class that already has them, we do not need to write them all by hand when we build a class. The user can reuse code and lessen its redundancy by using inheritance whenever possible (sambhav228, 2020) Figure 9 Inheritance example Example: The base class in the inheritance example below is called GFG, the derived class is called GeeksforGeeks, and the driver class is called Sudo (Mangal, 2019) Code: // C# program to illustrate the // concept of inheritance using System; namespace ConsoleApplication1 { // Base class class GFG { // data members public string name; public string subject; // public method of base class public void readers(string name, string subject) {

7. Polymorphism Polymorphism refers to the existence of various forms. Polymorphism can be simply defined as a message's capacity to be presented in multiple forms. One person may, for instance, exhibit several different traits at once. A father, a husband, and an employee are all dual roles that a man plays. Therefore, the same person exhibits diverse behavior depending on the circumstance. Polymorphism is the term for this (sambhav228, 2020) Example: Take the Animal base class, for example, which has a function called animalSound (). Animals that are descended from pigs, cats, dogs, and birds each have their own unique animal sound (the pig oinks, while the cat meows). Figure 11 Polymorphism example class Animal // Base class (parent) { public void animalSound() { Console.WriteLine("The animal makes a sound"); } } class Pig : Animal // Derived class (child) { public void animalSound() { Console.WriteLine("The pig says: wee wee"); }

class Dog : Animal // Derived class (child) { public void animalSound() { Console.WriteLine("The dog says: bow wow"); } } class Program { static void Main(string[] args) { Animal myAnimal = new Animal(); // Create a Animal object Animal myPig = new Pig(); // Create a Pig object Animal myDog = new Dog(); // Create a Dog object myAnimal.animalSound(); myPig.animalSound(); myDog.animalSound(); } } Output: Figure 12 Output of polymorphism (w3schools, 2022)

8. Method Overloading Polymorphism is typically implemented by method overloading. It is the capacity to reinterpret a function in several ways. By specifying two or more functions in a class with the same name, a user can implement function overloading. The varied method signatures in C# allow for method differentiation. In other words, methods inside the same class can have the same name but distinct parameter lists (i.e., the number of parameters, their order, and their data types) (Akanksha_Rai, 2021)  Based on the quantity and kind of parameters that are supplied to the methods as arguments, overloaded methods are distinguished.  More than one method definition cannot share the same name, order, or argument type. A compiler error would result.