You are on page 1of 57

lOMoARcPSD|14796373

Docsity advanced programming 1651 assignment 1 pass

Information Technology (FPT University)

Studocu is not sponsored or endorsed by any college or university


Downloaded by Duy Nam Võ Nguy?n (duynam515@gmail.com)
lOMoARcPSD|14796373

Advanced Programming -
1651- Assignment 1 - Pass
Advanced Data Analysis
FPT University
55 pag.

Document shared on www.docsity.com


Downloaded by: trang-tran-46 (trangtrandemo123@gmail.com)
Downloaded by Duy Nam Võ Nguy?n (duynam515@gmail.com)
lOMoARcPSD|14796373

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.

Student9s signature
Grading grid
P1 P2 M1 M2 D1 D2

Document shared on www.docsity.com


Downloaded by: trang-tran-46 (trangtrandemo123@gmail.com)
Downloaded by Duy Nam Võ Nguy?n (duynam515@gmail.com)
lOMoARcPSD|14796373

ò Summative Feedback: ò Resubmission Feedback:

Grade: Assessor Signature: Date:


Lecturer Signature:

Document shared on www.docsity.com


Downloaded by: trang-tran-46 (trangtrandemo123@gmail.com)
Downloaded by Duy Nam Võ Nguy?n (duynam515@gmail.com)
lOMoARcPSD|14796373

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 2018-2019

Unit Tutor Doan Trung Tung

Issue date 25 April 2019 Submission date 7 May 2019

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 Document shared libraries which were developed with very poor
on www.docsity.com
Downloaded by: trang-tran-46 (trangtrandemo123@gmail.com)
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
UML diagrams in OOAD and Design Patterns in usages.

Downloaded by Duy Nam Võ Nguy?n (duynam515@gmail.com)


lOMoARcPSD|14796373

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 M1 Determine a design pattern D1 Analyse the relationship


characteristics of the from each of the creational, between the object-
object-orientated paradigm structural and behavioural orientated paradigm and
as well as the various class pattern types. design patterns.
relationships.

LO2 Design a series of UML class diagrams

P2 Design and build class M2 Define class diagrams for D2 Define/refine class
diagrams using a UML tool. specific design patterns using a diagrams derived from a given
UML tool. code scenario using a UML tool.

Document shared on www.docsity.com


Downloaded by: trang-tran-46 (trangtrandemo123@gmail.com)

Downloaded by Duy Nam Võ Nguy?n (duynam515@gmail.com)


lOMoARcPSD|14796373

Table of Contents
Chapter 1: Examine the key components related to the object-orientated programming paradigm,
analyzing design pattern types........................................................................................................................ 8
1. OOP general concepts ............................................................................................................................ 8
2. Class ....................................................................................................................................................... 8
3. Object ..................................................................................................................................................... 9
4. Data Abstraction ................................................................................................................................... 12
5. Encapsulation ....................................................................................................................................... 14
6. Inheritance ............................................................................................................................................ 17
7. Polymorphism....................................................................................................................................... 19
8. Method Overloading ............................................................................................................................. 20
9. Method Overriding ............................................................................................................................... 22
10. Interface .............................................................................................................................................. 24
Chapter 2: Design a series of UML class diagrams ..................................................................................... 26
Scenario .................................................................................................................................................... 26
1. Use case diagram .................................................................................................................................. 28
2. Class Diagram ...................................................................................................................................... 42
References .................................................................................................................................................... 55

Document shared on www.docsity.com


Downloaded by: trang-tran-46 (trangtrandemo123@gmail.com)

Downloaded by Duy Nam Võ Nguy?n (duynam515@gmail.com)


lOMoARcPSD|14796373

Figure 1 Class example .................................................................................................................................. 8


Figure 2 Output of class ................................................................................................................................. 9
Figure 3 Object example .............................................................................................................................. 10
Figure 4 Output of object ............................................................................................................................. 12
Figure 5 Data Abstraction example .............................................................................................................. 13
Figure 6 Output of Data Abstraction ............................................................................................................ 14
Figure 7 Encapsulation example .................................................................................................................. 15
Figure 8 Ouptput of Encapsulation............................................................................................................... 16
Figure 9 Inheritance example ....................................................................................................................... 17
Figure 10 Output of Inheritance ................................................................................................................... 18
Figure 11 Polymorphism example................................................................................................................ 19
Figure 12 Output of polymorphism .............................................................................................................. 20
Figure 13 Method Overloading example ...................................................................................................... 21
Figure 14 Output of method overloading ..................................................................................................... 22
Figure 15 Method Overriding example ........................................................................................................ 23
Figure 16 Output of method overriding........................................................................................................ 24
Figure 17 Interface example ......................................................................................................................... 24
Figure 18 Output of interface ....................................................................................................................... 25
Figure 19 An example of a use case diagram's symbols .............................................................................. 30
Figure 20 My use-case.................................................................................................................................. 31
Figure 21 Notation Class(1) ......................................................................................................................... 43
Figure 22 Notation Class(2) ......................................................................................................................... 43
Figure 23 Notation Class(3) ......................................................................................................................... 43
Figure 24 Notation Class(4) ......................................................................................................................... 44
Figure 25 Notation Class(5) ......................................................................................................................... 44
Figure 26 Notation Class(6) ......................................................................................................................... 44
Figure 27 Notation Class(7) ......................................................................................................................... 45
Figure 28 Notation Class(8) ......................................................................................................................... 45
Figure 29 Class diagram ............................................................................................................................... 46

Document shared on www.docsity.com


Downloaded by: trang-tran-46 (trangtrandemo123@gmail.com)

Downloaded by Duy Nam Võ Nguy?n (duynam515@gmail.com)


lOMoARcPSD|14796373

Table 1 The information of customer ........................................................................................................... 26


Table 2 The information of employee .......................................................................................................... 26
Table 3 The information of product ............................................................................................................. 26
Table 4 Use-case manage menu ................................................................................................................... 32
Table 5 Use-case manage employee............................................................................................................. 32
Table 6 Use-case manage product ................................................................................................................ 33
Table 7 Use-case exit.................................................................................................................................... 33
Table 8 Use-case add employee ................................................................................................................... 34
Table 9 Use-case update employee .............................................................................................................. 34
Table 10 Use-case delete employee ............................................................................................................. 35
Table 11 Use-case find employee................................................................................................................. 35
Table 12 Use-case view all employee .......................................................................................................... 36
Table 13 Use-case back to menu (in Manage Employee) ............................................................................ 36
Table 14 Use-case add customer .................................................................................................................. 37
Table 15 Use-case update customer ............................................................................................................. 37
Table 16 Use-case delete customer .............................................................................................................. 38
Table 17 Use-case find customer ................................................................................................................. 38
Table 18 Use-case view all customer ........................................................................................................... 39
Table 19 Use-case back to menu(in Manage Customer) .............................................................................. 39
Table 20 Use-case add product..................................................................................................................... 40
Table 21 Use-case update product ................................................................................................................ 40
Table 22 Use-case delete product ................................................................................................................. 41
Table 23 Use-case find product .................................................................................................................... 41
Table 24 Use-case view all product.............................................................................................................. 42
Table 25 Use-case back to menu .................................................................................................................. 42

Document shared on www.docsity.com


Downloaded by: trang-tran-46 (trangtrandemo123@gmail.com)

Downloaded by Duy Nam Võ Nguy?n (duynam515@gmail.com)


lOMoARcPSD|14796373

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
Document shared on www.docsity.com
Downloaded by: trang-tran-46 (trangtrandemo123@gmail.com)
(Mangal, 2022)

Downloaded by Duy Nam Võ Nguy?n (duynam515@gmail.com)


lOMoARcPSD|14796373

namespace TESTASM1
{
public class Test
{
public int a, b;
public void display()
{
Console.WriteLine("Nguyen Tuc Tri");
}
}

namespace TESTASM1
{
class Program
{
static void Main(string[] args)
{
Test test = new Test();
test.display();
Console.ReadLine();
}
}
}
Output:

Figure 2 Output of class

3. Object
It is a fundamental building block of Object-Oriented Programming and represents actual physical entities.
A Class is an instance of an Object. No memory is allocated when a class is specified, but it is allocated
when an object is generated, or when the class is instantiated. Objects have identities, states, and
behaviors. Each object has code to alter the data as well as data itself. It is sufficient to know the sort of
message an object accepts and the type of response it returns for objects to communicate with one another
without knowing specifics about each other's data or programming (sambhav228, 2020)

Document shared on www.docsity.com


Downloaded by: trang-tran-46 (trangtrandemo123@gmail.com)

Downloaded by Duy Nam Võ Nguy?n (duynam515@gmail.com)


lOMoARcPSD|14796373

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:

Document shared on www.docsity.com


Downloaded by: trang-tran-46 (trangtrandemo123@gmail.com)

Downloaded by Duy Nam Võ Nguy?n (duynam515@gmail.com)


lOMoARcPSD|14796373

// 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;
} Document shared on www.docsity.com
Downloaded by: trang-tran-46 (trangtrandemo123@gmail.com)

// Property 4
public String GetColor()
{

Downloaded by Duy Nam Võ Nguy?n (duynam515@gmail.com)


lOMoARcPSD|14796373

return color;
}

// Method 1
public String ToString()
{
return ("Hi my name is " + this.GetName()
+ ".\nMy breed, age and color are " + this.GetBreed()
+ ", " + this.GetAge() + ", " + this.GetColor());
}

// Main Method
public static void Main(String[] args)
{

// Creating object
Dog tuffy = new Dog("tuffy", "papillon", 5, "white");
Console.WriteLine(tuffy.ToString());
}
}
Output:

Figure 4 Output of object

(Mangal, 2022)
4. Data Abstraction
One of object-oriented programming's most fundamental and significant characteristics is data abstraction.
By hiding the implementation or background information and simply revealing the data's core
characteristics to the outside world, this practice is known as data abstraction. Take a look at a man
operating a vehicle in the real world. The man only understands that pressing the accelerators will make
the car go faster and that applying the brakes will make the car stop, but he is unaware of the inner
workings of the car or how the accelerator, brakes, and other driving controls are implemented.
Abstraction is just this (sambhav228, 2020)
Example: Take the example of a traditional "form," which may be found in a computer-aided design
system or gaming simulation. Each shape has a color, size, and other attributes, and "shape" is the base
Document shared on www.docsity.com
type. The circle, square, triangle, andDownloaded
other sorts of shapes are derived (inherited) from this and may each
by: trang-tran-46 (trangtrandemo123@gmail.com)

have extra traits and behaviors. One can flip some shapes, for instance. Certain behaviors, such when you
try to figure out a square's area, might be different (saini, 2021)

Downloaded by Duy Nam Võ Nguy?n (duynam515@gmail.com)


lOMoARcPSD|14796373

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; Document shared on www.docsity.com
Downloaded by: trang-tran-46 (trangtrandemo123@gmail.com)

// method of square class


public Square(int x = 0)
{

Downloaded by Duy Nam Võ Nguy?n (duynam515@gmail.com)


lOMoARcPSD|14796373

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 Document shared on www.docsity.com
Downloaded by: trang-tran-46 (trangtrandemo123@gmail.com)
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-

Downloaded by Duy Nam Võ Nguy?n (duynam515@gmail.com)


lOMoARcPSD|14796373

hiding is another name for encapsulation since it involves keeping a class's data private from other classes
(sambhav228, 2020)

Figure 7 Encapsulation example

Code example:
// C# program to illustrate encapsulation
using System;

public class DemoEncap {

// private variables declared


// these can only be accessed by
// public methods of class
private String studentName;
private int studentAge;

// using accessors to get and


// set the value of studentName
public String Name
{
get
{
return studentName;
}
set
{
studentName = value;
}
}
Document shared on www.docsity.com
Downloaded by: trang-tran-46 (trangtrandemo123@gmail.com)
// using accessors to get and
// set the value of studentAge
public int Age
{

Downloaded by Duy Nam Võ Nguy?n (duynam515@gmail.com)


lOMoARcPSD|14796373

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:
Document shared on www.docsity.com
Downloaded by: trang-tran-46 (trangtrandemo123@gmail.com)

Figure 8 Ouptput of Encapsulation

Downloaded by Duy Nam Võ Nguy?n (duynam515@gmail.com)


lOMoARcPSD|14796373

(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; Document shared on www.docsity.com
Downloaded by: trang-tran-46 (trangtrandemo123@gmail.com)

// public method of base class


public void readers(string name, string subject)
{

Downloaded by Duy Nam Võ Nguy?n (duynam515@gmail.com)


lOMoARcPSD|14796373

this.name = name;
this.subject = subject;
Console.WriteLine("Myself: " + name);
Console.WriteLine("My Favorite Subject is: " + subject);
}
}

// inheriting the GFG class using :


class GeeksforGeeks : GFG {

// constructor of derived class


public GeeksforGeeks()
{
Console.WriteLine("GeeksforGeeks");
}
}

// Driver class
class Sudo {

// Main Method
static void Main(string[] args)
{

// creating object of derived class


GeeksforGeeks g = new GeeksforGeeks();

// calling the method of base class


// using the derived class object
g.readers("Kirti", "C#");
}
}
}
Output:

Document shared on www.docsity.com


Downloaded by: trang-tran-46 (trangtrandemo123@gmail.com)
Figure 10 Output of Inheritance

(Mangal, 2019)

Downloaded by Duy Nam Võ Nguy?n (duynam515@gmail.com)


lOMoARcPSD|14796373

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)


{ Document shared on www.docsity.com
public void animalSound() Downloaded by: trang-tran-46 (trangtrandemo123@gmail.com)

{
Console.WriteLine("The pig says: wee wee");
}

Downloaded by Duy Nam Võ Nguy?n (duynam515@gmail.com)


lOMoARcPSD|14796373

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
Document shared that are supplied to the methods as arguments,
on www.docsity.com
Downloaded by: trang-tran-46 (trangtrandemo123@gmail.com)
overloaded methods are distinguished.
÷ More than one method definition cannot share the same name, order, or argument type. A compiler
error would result.

Downloaded by Duy Nam Võ Nguy?n (duynam515@gmail.com)


lOMoARcPSD|14796373

÷ When differentiating the overloaded method, the compiler does not take the return type into
account. However, you are unable to specify two methods with identical signatures but various
return types. A compile-time error will be generated. It is impossible if both methods have the
same parameter types but a different return type.
(Akanksha_Rai, 2021)

Figure 13 Method Overloading example

Code:
static int Multiply(int a, int b)
{
int product = a * b;
return product;
}

static int Multiply(int a, int b, int c)


{
int product = a * b * c;
return product;
}

static double Multiply(double a, double b, double c, double d)


{
double product = a * b * c * d;
return product;
}

public static void Main()


{
int product_one = Multiply(4, 5);
int product_two = Multiply(4, 5, 6);
double product_three = Multiply(10, 3.14, 5.25,shared
Document 4);on www.docsity.com
Downloaded by: trang-tran-46 (trangtrandemo123@gmail.com)

Console.WriteLine("One Method, Different Uses\n");


Console.WriteLine("Multiplying 2 integers : {0}", product_one);
Console.WriteLine("Multiplying 3 integers : {0}", product_two);

Downloaded by Duy Nam Võ Nguy?n (duynam515@gmail.com)


lOMoARcPSD|14796373

Console.WriteLine("Multiplying 4 doubles : {0}", product_three);


}
Output:

Figure 14 Output of method overloading

(Romig, 2019)
9. Method Overriding
When two or more methods share the same name in a piece of code yet perform distinct tasks from one
another, this is referred to as method overriding. Accordingly, if we interpret the name in its literal sense,
one approach must take precedence over another. Redefining a base class method in a derived class using
the same method signature is what this idea refers to (ShikharMathur1, 2019)
One approach Perl uses to provide Run Time Polymorphism is method overriding. The object that is used
to invoke a method will determine which version of it is executed. If a method is invoked by an object of a
parent class, the method in the parent class will be utilized; however, if a method is invoked by an object
of a subclass, the method in the child class will be used. In other words, which version of an overridden
method will be executed depends on the type of the object being referred to, not the type of the reference
variable (ShikharMathur1, 2019)

Document shared on www.docsity.com


Downloaded by: trang-tran-46 (trangtrandemo123@gmail.com)

Downloaded by Duy Nam Võ Nguy?n (duynam515@gmail.com)


lOMoARcPSD|14796373

Figure 15 Method Overriding example

Code:
class base_class
{
public void gfg()
{
Console.WriteLine("Base class");
}
}

class derived_class : base_class


{
public void gfg()
{
Console.WriteLine("Derived class");
}

class Main_Method Document shared on www.docsity.com

{ Downloaded by: trang-tran-46 (trangtrandemo123@gmail.com)

static void Main()


{
derived_class d = new derived_class();

Downloaded by Duy Nam Võ Nguy?n (duynam515@gmail.com)


lOMoARcPSD|14796373

d.gfg();
}
}
Output:

Figure 16 Output of method overriding

(Mondal, 2022)
10. Interface
Interface can have members that are methods, properties, events, and indexers, much like a class.
However, interfaces will only include the members' declarations. The class that either explicitly or
indirectly implements the interface will provide the implementation of its members (Kumar, 2020)
÷ Interfaces specify what a class must do and not how.
÷ Interfaces can9t have private members.
÷ By default all the members of Interface are public and abstract.
÷ The interface will always defined with the help of keyword 8interface8.
÷ Interface cannot contain fields because they represent a particular implementation of data.
÷ Multiple inheritance is possible with the help of Interfaces but not with classes.
(Kumar, 2020)

Document shared on www.docsity.com


Downloaded by: trang-tran-46 (trangtrandemo123@gmail.com)

Figure 17 Interface example

Downloaded by Duy Nam Võ Nguy?n (duynam515@gmail.com)


lOMoARcPSD|14796373

Code:
// C# program to demonstrate working of
// interface
using System;

// A simple interface
interface inter1
{
// method having only declaration
// not definition
void display();
}

// A class that implements interface.


class testClass : inter1
{

// providing the body part of function


public void display()
{
Console.WriteLine("Sudo Placement GeeksforGeeks");
}

// Main Method
public static void Main (String []args)
{

// Creating object
testClass t = new testClass();

// calling method
t.display();
}
}
Output:

Figure 18 Output of interface


Document shared on www.docsity.com
Downloaded by: trang-tran-46 (trangtrandemo123@gmail.com)

(Kumar, 2020)

Downloaded by Duy Nam Võ Nguy?n (duynam515@gmail.com)


lOMoARcPSD|14796373

Chapter 2: Design a series of UML class diagrams


Scenario
Due to high market demand, the number of management positions in stores is increasing day by day, so
merchants want software that can handle basic business to reduce their workload. The company wanted
me to create laptop store management software to track products, customers, and employees. Involves
employee and customer information such as id, name, address and phone number. 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.
Information that will be stored for each customer:
Table 1 The information of customer

Name Description
Id Customer code: C001
Name Name of customer: Nguyen Van A
Address Address of customer: Can Tho
Phone Phone of customer: 0924817779
Information that will be stored for each employee:
Table 2 The information of employee

Name Description
Id Employee code: E001
Name Name of employee: Nguyen Van B
Address Address of employee: Hau Giang
Phone Phone of employee: 0817726472

Information that will be stored for each product:


Table 3 The information of product

Name Description
Id Product code: P001
Name Name of product: Macbook M1
Price Price of product: 1700$

This application must offer functionalities through a menu

=====================
1. Manage Employee
2. Manage Customer
3. Manage Product
4. Exit Document shared on www.docsity.com
===================== Downloaded by: trang-tran-46 (trangtrandemo123@gmail.com)

Please choose:
The application will end when the user selects 6

Downloaded by Duy Nam Võ Nguy?n (duynam515@gmail.com)


lOMoARcPSD|14796373

The program will show a submenu for managing Employee when the user picks option 1:
======== Employee ======
1. Add Employee
2. Update Employee
3. Delete Employee
4. View all Employee
5. Find Employee
6. Back to main menu
======================
Please choose:

The program will show a submenu for managing Customer when the user picks option 2:
======== Customer ======
1. Add Customer
2. Update Customer
3. Delete Customer
4. View all Customer
5. Find Customer
6. Back to main menu
======================
Please choose:

The program will show a submenu for managing Product when the user picks option 3:
======== Product ======
1. Add Product
2. Update Product
3. Delete Product
4. View all Product
5. Find Product
6. 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.
÷ When the user selects 3, the program Document shared on www.docsity.com
will
Downloaded by: let the
trang-tran-46 user enter the id, if the list has the user id entered,
(trangtrandemo123@gmail.com)

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.

Downloaded by Duy Nam Võ Nguy?n (duynam515@gmail.com)


lOMoARcPSD|14796373

÷ 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.
1. Use case 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.
Document shared on www.docsity.com
÷ Use Case: A use case indicates a feature
Downloaded that the
by: trang-tran-46 system is anticipated to implement (usually a
(trangtrandemo123@gmail.com)

need). 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

Downloaded by Duy Nam Võ Nguy?n (duynam515@gmail.com)


lOMoARcPSD|14796373

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 triangle's base, is occasionally referred to as a
specialized variation of the actor (or use case) at the other end. The generalization means that the
specialized version includes all of the features of the general version and possibly even more. Take
note that there is no communication between the two actors (or two use cases) connected by the
generalization relationship. In other words, the designer simply makes use of this relationship to
streamline the implementation's coding.
÷ Associating: This shows a two-way dialogue between an actor and a use case, and is thus a binary
relation. Every use case that a primary actor initiates must respond back to the actor because it is a
two-way communication. Similar to this, every time a use case initiates contact with a secondary
actor, the secondary actor is required to respond to the use case. Information about cardinality, or
how many actors or use cases are involved in the communication, may be included in an
association. For further information on cardinality, see the rules below.
÷ Include: This unique arrangement between the two use cases. When a use case A includes a related
use case B, the effort of implementing A depends on the implementation of B. B, on the other
hand, can stand on its own. Therefore, B is not required to be familiar with A. Any other use case
may also include B.
÷ Extend: This unique relationship between two use cases is yet another unusual type. The
implementation of A may conditionally incorporate the implementation of B in order to
accomplish its objective if a use case B extends a different use case A. That is, in some
circumstances, A might finish the job without B. But A might need B based on the condition that
was mentioned. In this instance, B is reliant on A and is unable to exist independently. B cannot
extend more than one use case because of this. The execution phase at which A's use case narrative
depends on B is referred to as an extension point.
(uwlax, 2022)

Document shared on www.docsity.com


Downloaded by: trang-tran-46 (trangtrandemo123@gmail.com)

Downloaded by Duy Nam Võ Nguy?n (duynam515@gmail.com)


lOMoARcPSD|14796373

Figure 19 An example of a use case diagram's symbols

Document shared on www.docsity.com


Downloaded by: trang-tran-46 (trangtrandemo123@gmail.com)

Downloaded by Duy Nam Võ Nguy?n (duynam515@gmail.com)


lOMoARcPSD|14796373

Diagram:

Document shared on www.docsity.com


Figure 20 My use-case
Downloaded by: trang-tran-46 (trangtrandemo123@gmail.com)

Downloaded by Duy Nam Võ Nguy?n (duynam515@gmail.com)


lOMoARcPSD|14796373

Table 4 Use-case manage menu

Use-case name: Manage Menu ID:MM Priority: High


Actor: Admin
Description: This use case demonstrates how an admin can access four key options by using the Manage
Menu.
Trigger: Administrator wants to use one of the five primary choices.
Type: External
Preconditions:
Normal Course:
1. The manage menu is displayed.
Alternative Flow:
Postconditions:
2.1. The Manage Product, Manage Customer, Manage Employee, and Exit choices will all be visible.
Exception:

Table 5 Use-case manage employee

Use-case name: Manage Employee ID:ME Priority: High


Actor: Admin
Description: This use case demonstrates how an administrator can access six key parameters by using
the Manage Employee.
Trigger: Administrator wants to use one of the six primary choices.
Type: External
Preconditions:
Normal Course:
1. The Manage Employee is displayed.
2. Select Manage Employee option.
Alternative Flow:
Postconditions:
2.1. Add Employee, Find Employee, View all Employee, Update Employee, Delete Employee, and
Return to manage menu are the six options that will be visible.
Exception:

Document shared on www.docsity.com


Downloaded by: trang-tran-46 (trangtrandemo123@gmail.com)

Downloaded by Duy Nam Võ Nguy?n (duynam515@gmail.com)


lOMoARcPSD|14796373

Table 6 Use-case manage product

Use-case name: Manage Product ID:MP Priority: High


Actor: Admin
Description: This use case demonstrates how an administrator can access six key parameters by using
the Manage Employee.
Trigger: Administrator wants to use one of the six primary choices.
Type: External
Preconditions:
Normal Course:
1. The Manage Product is displayed.
2. Select Manage Product option.
Alternative Flow:
Postconditions:
2.1. Add Product, Find Product, View all Product, Update Product, Delete Product, and Return to
manage menu are the six options that will be visible.
Exception:

Table 7 Use-case exit

Use-case name: Exit ID:EX Priority: High


Actor: Admin
Description: This use case describes how an administrator can terminate the program by using the Exit.
Trigger: Admin wants to exit the program.
Type: External
Preconditions:
Normal Course:
1. The Manage Product is displayed.
2. Select Exit option.
Alternative Flow:
Postconditions:
2.1. The program will be exit.
Exception:

Document shared on www.docsity.com


Downloaded by: trang-tran-46 (trangtrandemo123@gmail.com)

Downloaded by Duy Nam Võ Nguy?n (duynam515@gmail.com)


lOMoARcPSD|14796373

Table 8 Use-case add employee

Use-case name: Add Employee ID:AE Priority: High


Actor: Admin
Description: This use case demonstrates how a program administrator might add a new employee.
Trigger: Admin wants to add employee to the program.
Type: External
Preconditions:
Normal Course:
1. The Manage Employee is displayed.
2. Select Manage Employee option.
3. Select Add Employee option.
Alternative Flow:
Postconditions:
3.1. One after another, the lines of data that the administrator must enter are displayed.
3.2. When an import is successful, a notification will appear.
Exception:

Table 9 Use-case update employee

Use-case name: Update Employee ID:UE Priority: High


Actor: Admin
Description: This use case demonstrates how a program administrator might update an employee.
Trigger: Admin wants to update employee to the program.
Type: External
Preconditions:
Normal Course:
1. The Manage Employee is displayed.
2. Select Manage Employee option.
3. Select Update Employee option.
4. Select Employee to update.
Alternative Flow:
Postconditions:
4.1. One after another, the lines of data that the administrator must enter are displayed.
4.2. When an import is successful, a notification will appear.
Exception:
E1: The admin did not select employee to update.
÷ Users will see the warning <Please select driver!=
E2: The admin did not input information or input incorrect information.
÷ Users will see the warning "Please Document
enter correct information."
shared on www.docsity.com
Downloaded by: trang-tran-46 (trangtrandemo123@gmail.com)

Downloaded by Duy Nam Võ Nguy?n (duynam515@gmail.com)


lOMoARcPSD|14796373

Table 10 Use-case delete employee

Use-case name: Delete Employee ID:DE Priority: High


Actor: Admin
Description: This use case demonstrates how a program administrator might delete an employee.
Trigger: Admin wants to delete employee to the program.
Type: External
Preconditions:
Normal Course:
1. The Manage Employee is displayed.
2. Select Manage Employee option.
3. Select Delete Employee option.
4. Select Employee to delete.
Alternative Flow:
Postconditions:
4.1. When an import is successful, a notification will appear.
Exception:
E1: The admin did not select employee to delete.
÷ Users will see the warning <Please select driver to delete!=

Table 11 Use-case find employee

Use-case name: Find Employee ID:FE Priority: High


Actor: Admin
Description: This use case demonstrates how a program administrator might find an employee.
Trigger: Admin wants to find employee to the program.
Type: External
Preconditions:
Normal Course:
1. The Manage Employee is displayed.
2. Select Manage Employee option.
3. Select Find Employee option.
4. Input employee to find.
Alternative Flow:
Postconditions:
4.1. The admin must fill out the information lines that are displayed.
4.2. The entered keyword will be displayed together with details about the employee.
Exception:
E1: The admin did not input keyword to find.
÷ Users will see the warning <PleaseDocument
input shared
keyword to find!=
on www.docsity.com
Downloaded by: trang-tran-46 (trangtrandemo123@gmail.com)

Downloaded by Duy Nam Võ Nguy?n (duynam515@gmail.com)


lOMoARcPSD|14796373

Table 12 Use-case view all employee

Use-case name: View all Employee ID:VAE Priority: High


Actor: Admin
Description: This use case demonstrates how a program administrator might view all employee.
Trigger: Admin wants to view all employee to the program.
Type: External
Preconditions:
Normal Course:
1. The Manage Employee is displayed.
2. Select Manage Employee option.
3. Select View all Employee option.
Alternative Flow:
Postconditions:
3.1. All employee9s information will be shown.
Exception:

Table 13 Use-case back to menu (in Manage Employee)

Use-case name: Back to menu (in ID:BTME Priority: High


Manage Employee)
Actor: Admin
Description: This use case describes how a program administrator might use the Back to main menu
option.
Trigger: Admin wants to back to main menu in the program.
Type: External
Preconditions:
Normal Course:
1. The Manage Employee is displayed.
2. Select Manage Employee option.
3. Select Back To Menu option.
Alternative Flow:
Postconditions:
3.1. Back to menu
Exception:

Document shared on www.docsity.com


Downloaded by: trang-tran-46 (trangtrandemo123@gmail.com)

Downloaded by Duy Nam Võ Nguy?n (duynam515@gmail.com)


lOMoARcPSD|14796373

Table 14 Use-case add customer

Use-case name: Add Customer ID:AC Priority: High


Actor: Admin
Description: This use case demonstrates how a program administrator might add a new customer.
Trigger: Admin wants to add customer to the program.
Type: External
Preconditions:
Normal Course:
1. The Manage Customer is displayed.
2. Select Manage Customer option.
3. Select Add Customer option.
Alternative Flow:
Postconditions:
3.1. One after another, the lines of data that the administrator must enter are displayed.
3.2. When an import is successful, a notification will appear.
Exception:
E1: The admin did not input information or input not correct information.
÷ Users will see the warning= Please enter correct information=.

Table 15 Use-case update customer

Use-case name: Update Customer ID:UC Priority: High


Actor: Admin
Description: This use case demonstrates how a program administrator might update customer.
Trigger: Admin wants to update customer to the program.
Type: External
Preconditions:
Normal Course:
1. The Manage Customer is displayed.
2. Select Manage Customer option.
3. Select Update Customer option.
4. Select customer to update.
Alternative Flow:
Postconditions:
4.1. One after another, the lines of data that the administrator must enter are displayed.
4.2. When an import is successful, a notification will appear.
Exception:
E1: The admin did not select customer to update.
÷ Users will see the warning= PleaseDocumentselectsharedcustomer=.
on www.docsity.com
Downloaded by: trang-tran-46 (trangtrandemo123@gmail.com)
E2: The admin did not input information or input incorrect information.
÷ Users will see the warning= Please enter correct information=.

Downloaded by Duy Nam Võ Nguy?n (duynam515@gmail.com)


lOMoARcPSD|14796373

Table 16 Use-case delete customer

Use-case name: Delete Customer ID:DC Priority: High


Actor: Admin
Description: This use case demonstrates how a program administrator might delete customer.
Trigger: Admin wants to delete customer to the program.
Type: External
Preconditions:
Normal Course:
1. The Manage Customer is displayed.
2. Select Manage Customer option.
3. Select Delete Customer option.
4. Select customer to delete.
Alternative Flow:
Postconditions:
4.1. When an import is successful, a notification will appear.
Exception:
E1: The admin did not select customer to delete.
÷ Users will see the warning= Please select customer to delete!=.

Table 17 Use-case find customer

Use-case name: Find Customer ID:FC Priority: High


Actor: Admin
Description: This use case demonstrates how a program administrator might find customer.
Trigger: Admin wants to find customer to the program.
Type: External
Preconditions:
Normal Course:
1. The Manage Customer is displayed.
2. Select Manage Customer option.
3. Select Find Customer option.
4. Input customer to Find.
Alternative Flow:
Postconditions:
4.1. The admin must fill out the information lines that are displayed.
4.2. The entered keyword will be shown together with details about the customer.
Exception:
E1: The admin did not input keyword to find.
÷ Users will see the warning= PleaseDocument
input shared
keyword to search!=.
on www.docsity.com
Downloaded by: trang-tran-46 (trangtrandemo123@gmail.com)

Downloaded by Duy Nam Võ Nguy?n (duynam515@gmail.com)


lOMoARcPSD|14796373

Table 18 Use-case view all customer

Use-case name: View all Customer ID:VAC Priority: High


Actor: Admin
Description: This use case demonstrates how a program administrator might view all customer.
Trigger: Admin wants to view all customer to the program.
Type: External
Preconditions:
Normal Course:
1. The Manage Customer is displayed.
2. Select Manage Customer option.
3. Select View all Customer option.
Alternative Flow:
Postconditions:
3.1. All customer9s information will be shown.
Exception:

Table 19 Use-case back to menu(in Manage Customer)

Use-case name: Back To Menu (in ID:BTMC Priority: High


Manage Customer)
Actor: Admin
Description: This use case describes how a program administrator might use the Back to main menu
option.
Trigger: Admin wants to back to main menu in the program.
Type: External
Preconditions:
Normal Course:
1. The Manage Customer is displayed.
2. Select Manage Customer option.
3. Select Back To Menu option.
Alternative Flow:
Postconditions:
3.1. Back to menu
Exception:

Document shared on www.docsity.com


Downloaded by: trang-tran-46 (trangtrandemo123@gmail.com)

Downloaded by Duy Nam Võ Nguy?n (duynam515@gmail.com)


lOMoARcPSD|14796373

Table 20 Use-case add product

Use-case name: Add Product ID:AP Priority: High


Actor: Admin
Description: This use case demonstrates how a program administrator might add a new product.
Trigger: Admin wants to add product to the program.
Type: External
Preconditions:
Normal Course:
4. The Manage Product is displayed.
5. Select Manage Product option.
6. Select Add Product option.
Alternative Flow:
Postconditions:
3.1. One after another, the lines of data that the administrator must enter are displayed.
3.2. When an import is successful, a notification will appear.
Exception:
E1: The admin did not input information or input not correct information.
÷ Users will see the warning= Please enter correct information=.

Table 21 Use-case update product

Use-case name: Update Product ID:UP Priority: High


Actor: Admin
Description: This use case demonstrates how a program administrator might update product.
Trigger: Admin wants to update product to the program.
Type: External
Preconditions:
Normal Course:
1. The Manage Product is displayed.
2. Select Manage Product option.
3. Select Update Product option.
4. Select product to update.
Alternative Flow:
Postconditions:
4.1. One after another, the lines of data that the administrator must enter are displayed.
4.2. When an import is successful, a notification will appear.
Exception:
E1: The admin did not select customer to update.
÷ Users will see the warning= PleaseDocumentselectsharedproduct=.
on www.docsity.com
Downloaded by: trang-tran-46 (trangtrandemo123@gmail.com)
E2: The admin did not input information or input incorrect information.
÷ Users will see the warning= Please enter correct information=.

Downloaded by Duy Nam Võ Nguy?n (duynam515@gmail.com)


lOMoARcPSD|14796373

Table 22 Use-case delete product

Use-case name: Delete Product ID:DP Priority: High


Actor: Admin
Description: This use case demonstrates how a program administrator might delete product.
Trigger: Admin wants to delete product to the program.
Type: External
Preconditions:
Normal Course:
1. The Manage Product is displayed.
2. Select Manage Product option.
3. Select Delete Product option.
4. Select product to delete.
Alternative Flow:
Postconditions:
4.1. When an import is successful, a notification will appear.
Exception:
E1: The admin did not select customer to delete.
÷ Users will see the warning= Please select product to delete!=.

Table 23 Use-case find product

Use-case name: Find Product ID:FP Priority: High


Actor: Admin
Description: This use case demonstrates how a program administrator might find product.
Trigger: Admin wants to find product to the program.
Type: External
Preconditions:
Normal Course:
1. The Manage Product is displayed.
2. Select Manage Product option.
3. Select Find Product option.
4. Input product to Find.
Alternative Flow:
Postconditions:
4.1. The admin must fill out the information lines that are displayed.
4.2. The entered keyword will be shown together with details about the product.
Exception:
E1: The admin did not input keyword to find.
÷ Users will see the warning= PleaseDocument
input shared
keyword to search!=.
on www.docsity.com
Downloaded by: trang-tran-46 (trangtrandemo123@gmail.com)

Downloaded by Duy Nam Võ Nguy?n (duynam515@gmail.com)


lOMoARcPSD|14796373

Table 24 Use-case view all product

Use-case name: View all Product ID:VAP Priority: High


Actor: Admin
Description: This use case demonstrates how a program administrator might view all product.
Trigger: Admin wants to view all product to the program.
Type: External
Preconditions:
Normal Course:
1. The Manage Product is displayed.
2. Select Manage Product option.
3. Select View all Product option.
Alternative Flow:
Postconditions:
3.1. All product9s information will be shown.
Exception:

Table 25 Use-case back to menu

Use-case name: Back To Menu (in ID:BTMP Priority: High


Manage Product)
Actor: Admin
Description: This use case describes how a program administrator might use the Back to main menu
option.
Trigger: Admin wants to back to main menu in the program.
Type: External
Preconditions:
Normal Course:
1. The Manage Product is displayed.
2. Select Manage Product option.
3. Select Back To Menu option.
Alternative Flow:
Postconditions:
3.1. Back to menu
Exception:

2. Class Diagram
A class diagram is a specific kind of diagram and a component of the unified modeling language (UML),
which specifies and presents the overview and structure of a system in terms of classes, characteristics,
Document shared on www.docsity.com
and methods, as well as the connections between
Downloaded various
by: trang-tran-46 classes. It is used as a system development
(trangtrandemo123@gmail.com)

resource throughout the software development life cycle to illustrate and generate a functional diagram of
the system classes (techopedia, 2021)
Notations:

Downloaded by Duy Nam Võ Nguy?n (duynam515@gmail.com)


lOMoARcPSD|14796373

Classes: An abstraction of entities with similar traits is represented by classes. The connections between
classes are represented by associations (smartdraw, 2020)

Figure 21 Notation Class(1)

Active Classes: While passive classes merely store data and provide services to other classes, active
classes start the action and manage its flow. Classes that are active should have a thicker border
(smartdraw, 2020)

Figure 22 Notation Class(2)

Visibility: To indicate who has access to the information in a class, use visibility markers. Information that
is private visibility, indicated by a minus sign, is hidden from anyone outside the class partition. The
marked information is visible to all other classes when it is marked with the plus sign (public visibility).
Child classes can access data they inherited from a parent class thanks to protected visibility, which is
indicated by a # symbol (smartdraw, 2020)

Figure 23 Notation Class(3)

Associations: Associations show the fixed connections between classes. Put association names on the
association line, above it, or below it.Downloaded
To show the relationship's direction, use a full arrow. Place the roles
Document shared on www.docsity.com
by: trang-tran-46 (trangtrandemo123@gmail.com)
at the association's conclusion. Roles illustrate how the two classes view one another (smartdraw, 2020)

Downloaded by Duy Nam Võ Nguy?n (duynam515@gmail.com)


lOMoARcPSD|14796373

Figure 24 Notation Class(4)

Multiplicity (Cardinality): Put multiplicity notations close to an association's ends. These symbols show
how many instances of one class are connected to one instance of another. As an illustration, one company
might employ one or more people, but they all work for the same business (smartdraw, 2020)

Figure 25 Notation Class(5)

Constraint: Place constraints inside curly braces {} (smartdraw, 2020)

Figure 26 Notation Class(6)

Composition and Aggregation: A unique kind of aggregation called composition indicates a strong
ownership relationship between Class A, theDocumentwhole, sharedand Class B, its component. Give an example of
on www.docsity.com

composition using a filled diamond. Use a hollow diamond to symbolize an easy aggregation relationship
Downloaded by: trang-tran-46 (trangtrandemo123@gmail.com)

where the "whole" class is more significant than the "part" class but there is no dependency between the
two classes. The diamond's final relationships in terms of composition and aggregation point to the
"whole" class (i.e., the aggregation) (smartdraw, 2020)

Downloaded by Duy Nam Võ Nguy?n (duynam515@gmail.com)


lOMoARcPSD|14796373

Figure 27 Notation Class(7)

Generalization: Generalization is another term for inheritance or a relationship where "is a" is present.
When one class is a specialized variation of another, it alludes to the relationship between the two classes.
For instance, a type of car is a Honda. As a result, there would be a generalization between the class
Honda and the class automobile (smartdraw, 2020)

Figure 28 Notation Class(8)

Document shared on www.docsity.com


Downloaded by: trang-tran-46 (trangtrandemo123@gmail.com)

Downloaded by Duy Nam Võ Nguy?n (duynam515@gmail.com)


lOMoARcPSD|14796373

Figure 29 Class diagram

Explain: For clarity, I've divided the class diagram shown above into three sections. The menu portion
comes first. To give classes that implement it access to its ShowMenu() and SelectMenu() functions, I
employ an interface called IMenu in the menu section. EmployeeMenu (used to call features of the
Employee class), CustomerMenu (used to call features of the Customer class), ProductMenu (used to call
features of the Product class), and MainMenu (used to call features of the MainMenu class) are the classes
that implement the IMenu interface (used to jump to the Menu classes mentioned above). Second, I then
build a Person class, followed by Employee and Customer classes, all of which inherit from the Person
class (inherited properties include id (type string), name (type string)) , address (type string) and phone
(string type).In the Product class there are 3 properties: id(type string), name(type string), price(type
string). Finally, in the Product class, there are 6 functions including AddProduct(), UpadateProduct(),
DeleteProduct(), FindProduct(), ViewAllProduct(), BackToMenu(). In Customer class, there are 6
functions including AddCustomer(), UpadateCustomer(), DeleteCustomer(), FindCustomer(), ViewAll(),
BackToMenu(). At Employee class, there are 6 functions including AddEmployee(), UpadateEmployee(),
DeleteEmployee(), FindEmployee(), ViewAll(), BackToMenu().
My PowerPoint presents

Document shared on www.docsity.com


Downloaded by: trang-tran-46 (trangtrandemo123@gmail.com)

Downloaded by Duy Nam Võ Nguy?n (duynam515@gmail.com)


lOMoARcPSD|14796373

Document shared on www.docsity.com


Downloaded by: trang-tran-46 (trangtrandemo123@gmail.com)

Downloaded by Duy Nam Võ Nguy?n (duynam515@gmail.com)


lOMoARcPSD|14796373

Document shared on www.docsity.com


Downloaded by: trang-tran-46 (trangtrandemo123@gmail.com)

Downloaded by Duy Nam Võ Nguy?n (duynam515@gmail.com)


lOMoARcPSD|14796373

Document shared on www.docsity.com


Downloaded by: trang-tran-46 (trangtrandemo123@gmail.com)

Downloaded by Duy Nam Võ Nguy?n (duynam515@gmail.com)


lOMoARcPSD|14796373

Document shared on www.docsity.com


Downloaded by: trang-tran-46 (trangtrandemo123@gmail.com)

Downloaded by Duy Nam Võ Nguy?n (duynam515@gmail.com)


lOMoARcPSD|14796373

Document shared on www.docsity.com


Downloaded by: trang-tran-46 (trangtrandemo123@gmail.com)

Downloaded by Duy Nam Võ Nguy?n (duynam515@gmail.com)


lOMoARcPSD|14796373

Document shared on www.docsity.com


Downloaded by: trang-tran-46 (trangtrandemo123@gmail.com)

Downloaded by Duy Nam Võ Nguy?n (duynam515@gmail.com)


lOMoARcPSD|14796373

Document shared on www.docsity.com


Downloaded by: trang-tran-46 (trangtrandemo123@gmail.com)

Downloaded by Duy Nam Võ Nguy?n (duynam515@gmail.com)


lOMoARcPSD|14796373

Document shared on www.docsity.com


Downloaded by: trang-tran-46 (trangtrandemo123@gmail.com)

Downloaded by Duy Nam Võ Nguy?n (duynam515@gmail.com)


lOMoARcPSD|14796373

References
Akanksha_Rai, 2021. geeksforgeeks. [Online]
Available at: https://www.geeksforgeeks.org/c-sharp-method-overloading/
Kumar, M., 2020. geeksforgeeks. [Online]
Available at: https://www.geeksforgeeks.org/c-sharp-interface/
Mangal, K., 2019. geeksforgeeks. [Online]
Available at: https://www.geeksforgeeks.org/c-sharp-inheritance/?ref=lbp
Mangal, K., 2022. geeksforgeeks. [Online]
Available at: https://www.geeksforgeeks.org/c-sharp-class-and-object/?ref=gcse
Mondal, S., 2022. geeksforgeeks. [Online]
Available at: https://www.geeksforgeeks.org/c-sharp-method-overriding/?ref=gcse
Romig, A., 2019. dev. [Online]
Available at: https://dev.to/aromig/c-oop-primer-method-overloading-1d0f
Saini, A., 2019. geeksforgeeks. [Online]
Available at: https://www.geeksforgeeks.org/c-sharp-encapsulation/?ref=lbp
saini, a., 2021. geeksforgeeks. [Online]
Available at: https://www.geeksforgeeks.org/c-sharp-abstraction/?ref=lbp
sambhav228, 2020. geeksforgeeks. [Online]
Available at: https://www.geeksforgeeks.org/introduction-of-object-oriented-programming/
ShikharMathur1, 2019. geeksforgeeks. [Online]
Available at: https://www.geeksforgeeks.org/perl-method-overriding-in-oops/
smartdraw, 2020. smartdraw. [Online]
Available at: https://www.smartdraw.com/class-diagram/
smartdraw, 2022. smartdraw. [Online]
Available at: https://www.smartdraw.com/use-case-diagram/
techopedia, 2021. techopedia. [Online]
Available at: https://www.techopedia.com/definition/16466/class-diagram
uwlax, 2022. uwlax. [Online]
Available at: https://cs.uwlax.edu/~mzheng/CS743Fall19/UseCaseDiagrams.html
w3schools, 2022. w3schools. [Online]
Available at: https://www.w3schools.com/cs/cs_polymorphism.php

Document shared on www.docsity.com


Downloaded by: trang-tran-46 (trangtrandemo123@gmail.com)

Downloaded by Duy Nam Võ Nguy?n (duynam515@gmail.com)

You might also like