0% found this document useful (0 votes)
131 views32 pages

Assignment 1 Front Sheet: Qualification BTEC Level 5 HND Diploma in Computing

This document is an assignment front sheet for a BTEC Level 5 HND Diploma in Computing unit on advanced programming. It includes the student and assessor details, learning outcomes, and space for feedback and grading. The accompanying document contains 29 figures explaining object-oriented programming concepts like classes, objects, abstraction, interfaces, inheritance, polymorphism and encapsulation through examples of class diagrams and code.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
131 views32 pages

Assignment 1 Front Sheet: Qualification BTEC Level 5 HND Diploma in Computing

This document is an assignment front sheet for a BTEC Level 5 HND Diploma in Computing unit on advanced programming. It includes the student and assessor details, learning outcomes, and space for feedback and grading. The accompanying document contains 29 figures explaining object-oriented programming concepts like classes, objects, abstraction, interfaces, inheritance, polymorphism and encapsulation through examples of class diagrams and code.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 32

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 Hoang Minh Hoan Student ID GCD18317

Class GCD0703 Assessor name Hoang Nhu Vinh

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 Hoan

Grading grid

P1 P2 M1 M2 D1 D2
 Summative Feedback:  Resubmission Feedback:

Grade: Assessor Signature: Date:


Lecturer Signature:
Table of Contents
P1 Examine the characteristics of the object-orientated paradigm as well as the various class relationships. .............................................................. 5
P2 Design and build class diagrams using a UML tool. ................................................................................................................................................ 5
1. Definition of Class and Object: .......................................................................................................................................................................... 5
2. Abstraction ......................................................................................................................................................................................................... 7
3. Interface ........................................................................................................................................................................................................... 12
4. Inheritance........................................................................................................................................................................................................ 15
5. Polymorphism .................................................................................................................................................................................................. 23
6. Encapsulation ................................................................................................................................................................................................... 27

Figure 1 Class People..................................................................................................................................................................................................... 5


Figure 2 objects .............................................................................................................................................................................................................. 6
Figure 3 Class diagram of People .................................................................................................................................................................................. 7
Figure 4 abstract class Vehicle....................................................................................................................................................................................... 8
Figure 5 Class oto .......................................................................................................................................................................................................... 9
Figure 6 Class Motobyke ............................................................................................................................................................................................... 9
Figure 7 program.......................................................................................................................................................................................................... 10
Figure 8 Class dỉagram of Transport............................................................................................................................................................................ 11
Figure 9 Class Receipt ................................................................................................................................................................................................. 12
Figure 10 Class receipt................................................................................................................................................................................................. 13
Figure 11 Program ....................................................................................................................................................................................................... 14
Figure 12 Class diagram of IReceipt............................................................................................................................................................................ 15
Figure 13 Class Smartphone ........................................................................................................................................................................................ 16
Figure 14 Class smartphone' method ........................................................................................................................................................................... 17
Figure 15 Class nokia................................................................................................................................................................................................... 18
Figure 16 Xiaomi class ................................................................................................................................................................................................ 19
Figure 17 Iphone class ................................................................................................................................................................................................. 20
Figure 18 Program ....................................................................................................................................................................................................... 21
Figure 19 Diagram of overload .................................................................................................................................................................................... 24
Figure 20 Lion class ..................................................................................................................................................................................................... 24
Figure 21 Animal class ................................................................................................................................................................................................ 25
Figure 22 Tiger class .................................................................................................................................................................................................... 26
Figure 23 class of tonghaiso ........................................................................................................................................................................................ 29
Figure 24 Program ....................................................................................................................................................................................................... 29
Figure 25 diagram of tonghaiso ................................................................................................................................................................................... 30
Figure 26 Class of People ............................................................................................................................................................................................ 30
Figure 27 Class of self ................................................................................................................................................................................................. 31
Figure 28 Program ....................................................................................................................................................................................................... 31
Figure 29 diagram of People ........................................................................................................................................................................................ 32
P1 Examine the characteristics of the object-orientated paradigm as well as the various class
relationships.

P2 Design and build class diagrams using a UML tool.

1. Definition of Class and Object:


1.1. Definition of class.

Classes and objects are the basic principles of object-oriented programming that frequently occur in real life. A class is like a constructor of an
entity or a model to build an entity. As always, a class is identified by a class name, and surrounded by curly braces. Below is a photo of my code
which declares a class name People

Figure 1 Class People


1.2. Definition of Object.
An object shall be generated from a class. The image below is a class of People, the layer can create objects. To build an object for
People, we define the first name of the class then the name of the object and use new:

Figure 2 objects

1.3. ClassDiagram.
Figure 3 Class diagram of People

2. Abstraction
Abstraction means allowing the display of relevant information to achieve the level of abstraction desired. People sometimes use abstract classes
in c # for abstraction. By deriving from it, you can construct abstract classes which are used to provide partial class implementation of the
interface. And, eventually, derived classes can incorporate abstract classes in abstract methods. Additionally, some primary abstraction points are
as follows:

- It is impossible to create an instance of an abstract class.


- Can not claim a process outside the abstract. (The Will, 2020)
2.1. Abtract Class
An abstract class, since it can not be instantiated, is an incomplete class. The aim of this class is to provide for a plan to implement
derived classes when expanding the abstract class.
Figure 4 abstract class Vehicle
Figure 5 Class oto

Figure 6 Class Motobyke


Figure 7 program
2.2. Class diagram.

Figure 8 Class dỉagram of Transport


3. Interface
3.1. What is interface:
An interface implies the syntax that must be adopted by all interface inheritance classes. The interface will specify the "what" part of
the syntax, and the "how" will be determined by the properties of the derived classes, specified by interfaces, and the interface will
include methods and events.

Figure 9 Class Receipt


Figure 10 Class receipt
Figure 11 Program

3.2. Class Diagram.


Figure 12 Class diagram of IReceipt

4. Inheritance
4.1. Definition of Inheritance:
Inheritance is one of the key principles of object-oriented programming, as it allows one class to be described in the context of another. It leads
enable faster reuse of tasks and speed up execution times.

We are not going to need to rewrite new data, we can specify that class will inherit existing class members. The new class is considered a
derivative class, and the current one is considered a base one
Figure 13 Class Smartphone
Figure 14 Class smartphone' method
Figure 15 Class nokia
Figure 16 Xiaomi class
Figure 17 Iphone class
Figure 18 Program

4.2. Class diagram.


5. Polymorphism
5.1. Definition of Polymorphism.

Polymorphism means a whole lot of forms. Through object-oriented programming, several different functions express polymorphism in the
form of an interface. Besides, polymorphism can be either static or dynamic. Static polymorphism is a answer to the compile time rule, while
dynamic polymorphism is decided at runtime

5.1.1. Overload
Figure 19 Diagram of overload

5.2. Override
When you want to implement the virtual function in an inheritance class which has a predefined function, you just need to use it. Virtual
functions in various inheritance classes can be implemented differently, and the command will be calculated at runtime.

Figure 20 Lion class


Figure 21 Animal class
Figure 22 Tiger class

5.3. Class diagram.


6. Encapsulation
6.1. Definition of encapsulation:

Combining a member of the data and a method into one unit (i.e., a class) is called encapsulation. The packaging is like I got a bag that could hold
books and notebooks. That means this is the property of the members and functions being packed.

Packed in container like sackcloth. Activities and data relating to an object are followed into that object.

The package uses the access to execute defined. An access specifier which identifies the class members domain and visibility. Indications of the
link are:

- Public
- Private
- Protected
- Internal
- Protected internal

6.2. Public
6.2.1. Diagram of public
6.3. Private

Figure 23 class of tonghaiso

Figure 24 Program
6.4. Diagram of tonghaiso

Figure 25 diagram of tonghaiso

6.5. Protected,

Figure 26 Class of People


Figure 27 Class of self

Figure 28 Program

6.6. Diagram of protected.


Figure 29 diagram of People

You might also like