Professional Documents
Culture Documents
Asm1-1651-
Asm1-1651-
Date Received
Submission Date
1st submission
Date Received 2nd
Re-submission Date
submission
Grading grid
P1 P2 M1 M2 D1 D2
Assessor Feedback:
*Please note that constructive and useful feedback should allow students to understand:
a) Strengths of performance
b) Limitations of performance
c) Any improvements needed in future assessments
Feedback should be against the learning outcomes and assessment criteria to help students understand how these
inform the process of judging the overall grade.
Feedback should give full guidance to the students on how they have met the learning outcomes and
assessment criteria.
Resubmission Feedback:
*Please note resubmission feedback is focussed only on the resubmitted work
* Please note that grade decisions are provisional. They are only confirmed once internal and external
moderation has taken place and grades decisions have been agreed at the assessment.
Programmed:
BTEC
Plagiarism
Plagiarism is a particular form of cheating. Plagiarism must be avoided at all costs and students who break the
rules, however innocently, may be penalised. It is your responsibility to ensure that you understand correct
referencing practices. As a university level student, you are expected to use appropriate references throughout
and keep carefully detailed notes of all your sources of materials for material you have used in your work,
including any material downloaded from the Internet. Please consult the relevant unit lecturer or your course
tutor if you need any further advice.
Student Declaration
Student declaration
I certify that the assignment submission is entirely my own work and I fully understand the consequences of
plagiarism. I declare that the work submitted for assessment has been carried out without assistance other than
that which is acceptable according to the rules of the specification. I certify I have clearly referenced any
sources and any artificial intelligence (AI) tools used in the work. I understand that making a false declaration is
a form of malpractice.
I. Introduction........................................................................................................................................................... 8
a) Class: ........................................................................................................................................................... 9
b) Object: ....................................................................................................................................................... 10
c) Attribute .................................................................................................................................................... 10
d) Methods ..................................................................................................................................................... 11
e) Encapsulation: ........................................................................................................................................... 11
f) Inheritance: ................................................................................................................................................ 13
g) Polymorphism: .......................................................................................................................................... 16
h) Abstraction: ............................................................................................................................................... 18
a) Association ................................................................................................................................................ 20
d) Dependencies............................................................................................................................................. 22
e) Aggregation ............................................................................................................................................... 22
f) Composition .............................................................................................................................................. 23
III. Design and build class diagrams using a UML tool. ..................................................................................... 26
1. Scenario ......................................................................................................................................................... 26
References .................................................................................................................................................................. 31
Figure 2.Encapsulation................................................................................................................................................ 11
Figure 3.Encapsulation................................................................................................................................................ 12
Figure 8.Abstraction.................................................................................................................................................... 18
Figure 14.Aggregation................................................................................................................................................. 23
Figure 16 Include......................................................................................................................................................... 24
a) Advantages of OOP:
• Modularization: OOP allows dividing source code into separate objects, thereby reducing
complexity and making it easier to manage and reuse source code.
• Reusability: Classes and objects in OOP can be reused in many different projects, saving
programming time and effort.
• Encapsulation: OOP allows hiding information inside objects and class details, allowing access
only through public methods, helping to protect data and ensure consistency of the system.
• Flexibility: OOP allows source code to be easily changed and extended by adding or changing
classes and objects, without affecting other parts of the system.
b) Disadvantages of OOP:
• Complexity: OOP can become complex and confusing if not designed and implemented properly.
• Overhead: OOP can require more resources than other programming methods, such as memory
and execution time.
a) Class:
• A class is a data type that is defined by the user. By making an instance of that class, you can
access and use its member functions and data members. It symbolizes the collection of attributes or
operations shared by every item of a certain kind. An object's blueprint is analogous to a class.
• For instance, think about the car class. Even while different automobiles may have different names
and brands, they will all have certain characteristics in common, such as four wheels, a speed limit,
a mileage range, etc. In this case, the class is car, and the attributes are wheels, speed restrictions,
and mileage.
• example:
public class Car
{
public string Brand { get; set; }
public string Color { get; set; }
Figure 1.Object
• example:
Car myCar = new Car();
myCar.Brand = "Toyota";
myCar.Color = "Red";
myCar.StartEngine();
c) Attribute
• A property is a declarative tag that you can use to inform your program runtime about the behavior
of various elements such as collections, enumerators, classes, methods, and structures. Using an
attribute, you can provide program declaration information. Square brackets ([]) above the element
they are intended to serve as a visual cue that the tag is declarative.
• Compiler instructions and such additional data, comments, descriptions, methods and classes can
be added to the program using attributes. Predefined properties and custom built properties are two
types of properties provided by Net Framework.
• Methods are used to perform certain actions, and they are also known as functions.
e) Encapsulation:
• Data encapsulation is the process of grouping related information into a single unit. It is the
connection point between the code and the data it works with. When a class is encapsulated, its
variables and data are not visible to other classes and are only accessible via the member functions
of the class in which they are specified. It's also called data-hiding because, similar to
encapsulation, the data in a class is concealed from other classes.
Figure 2.Encapsulation
• The 'name' and 'age' are declared private, meaning they can only be accessed from within the
'Person' class. This prevents other parts of the program from directly accessing and changing their
values.
• 'SetName' and 'SetAge' are used to assign values to 'name' and 'age'. Make sure not to assign a
Negative value to 'age'.
• 'GetName' and 'GetAge' return the current values of 'name' and 'age'.
Figure 4.Inheritance
• Class 'Dog' is a derived class that inherits from the 'Anima'l class using the ':Animal' syntax. 'Dog'
has a constructor that takes a name and passes it to the base class using the 'base' keyword. The
'MakeSound' method is overridden to provide specific behavior to the 'Dog' class. 'Dog' has a
private method 'WagTail' that is only available in the 'Dog' class.
• Create a 'Animal' object, then use the 'Eat' and 'MakeSound' methods. Make an instance of the
'Dog' object and invoke the override 'MakeSound' method, the private 'Dog.WagTail' method, and
the methods inherited from 'Animal.Eat'. This illustrates polymorphism by using the 'Dog' object
as the type of 'Animal,' using the 'MakeSound' method of 'Dog' rather than the 'Animal' method.
Figure 6.Polymorphism
• The base class 'Animal' has a virtual MakeSound function that derived classes can override, as well
as a 'name' field."Dog" and "Cat" are derived from the Animal class and implement their own
actions by overriding the MakeSound function.
• Generate objects of type "Animal," such as "Dog" and "Cat."
• Make an array called "Animal" that includes the "Dog" and "Cat" objects.
• As you traverse the array, invoke the 'MakeSound' function. The 'Animal' method is called instead
of the proper 'MakeSound' method of each object (bark for 'Dog' and meow for 'Cat') because of
polymorphism.
Figure 8.Abstraction
• The abstract class 'Vehicle' contains an abstract method 'Drive'. In order to override the 'Drive'
method, subclasses must implement the abstract class, which cannot be created directly.
The 'Car' and 'Motorcycle' classes extend the 'Drive' function and are derived from the 'Vehicle'
class.
• Two objects, "Car" and "Motorcycle," are created as types of "Vehicle" in the "Main" method.
Each object has a 'Drive' method that when called, uses polymorphism to run the proper method
(motorcycle or automobile) for that kind of object.
3.1. Definition
• A class diagram is a kind of UML (Unified Modeling Language) diagram that is used to show the
relationships and structure of classes in a system graphically in software engineering. Software system
design and documentation are aided by the standard modeling language known as UML. They provide
help for both the design and documentation phases of the software development process, making them
an essential component.
• Layers are related to each other in specific ways. In particular, relationships in class diagrams
include many different types of logical connections. The following are the types of logical
connections that can be made in
Figure 10.Association
• One-way relationships, often known as self-associations, have an arrow in UML diagrams, while
bidirectional associations might have two arrows or none at all. \
• To show how many items are in the respective class in a multiplicity connection, you may add a
number straight to the corresponding line.
o 1..1: Only one
o 0..*: Zero or more
o 1..*:one or more
o 0..1: No or only one
o m..n: at least m, at most n (m<=n)
b) Inheritance
• Inheritance, also known as generalization, refers to the relationship between a parent class and a
child class. The terms "base class" and "derived class" refer to the parent class and child class,
respectively.
• In an inheritance relationship, the parent class has all the properties, methods, and subclasses, and
the subclass inherits all the functions of the parent class. In addition to the same information as the
parent class, subclasses also contain additional information.
• For example: buses, taxis, and cars are cars, they all have names, and they can all be on the road.
c) Realization / Implementation
• Implementation (Implementation) is mostly used to define the link between interfaces and
implementation classes.
• An interface is a group of methods, which also includes an abstract class. A class implements an
interface and its methods implement every method in the interface declaration in an
implementation relationship.
• For example, automobiles and ships are vehicles, and the vehicle is only an abstract idea of a
mobile tool, whereas the ship and vehicle perform particular mobile duties.
• Dependencies are often represented in class methods that take an object from another class as
input.
• The "using" connection is a dependency relationship. When something is changed, it can have an
impact on other things that depend on it. Dependencies are used to show when one item depends
on another item. For example: Vehicles run on fuel. The car will not start if it runs out of gas.
Figure 13.Dependencies
e) Aggregation
• Aggregation: The connection between a whole and a component that allows them to be separated.
• Member objects are a component of the overall object, but they can also exist separately from that
object. Aggregate relationships also represent the relationship between the whole and part of the
class.
• For example, although they are generally related, bus drivers, work clothes, and hats are not. On
other drivers, protective clothing and helmets are fine. Bus drivers are also allowed to wear other
business attire, including baseball caps.
f) Composition
• Composition is the relationship between the whole and the inseparable parts.
• An associative connection describes a relationship between the entire class and a subset of it, both
of which have a constant lifetime. Some things will cease to exist once the total entity disappears,
and they will all disappear in the same lifetime. For example, humans consist of a head and a body.
Both exist together and are inseparable.
Figure 15.Composition
Figure 16 Include
Figure 17.Extend
• I was tasked with creating UML diagrams and system design for a self-driving car rental
management system.
• The system needs to manage different types of cars, rental transactions, and customer information.
Here is a high-level description of the scenario:
o The car rental system offers various types of cars, including sports cars, electric cars, and
regular cars.
o Customers can register with the system by providing their personal information, such as
name, address, and contact details.
o Customers can rent cars from the rental system by specifying the type of car and the rental
period.
o Each rental transaction includes the customer, the rented car, the rental start date, and the
return date.
o The system should track the availability of cars and calculate rental fees based on the type
of car and rental duration.
o Vehicle search: Customers can search for vehicles in the vehicle list system.
o Car loan: Customers can borrow to buy a car according to the list. This use case involves
"Checking vehicle eligibility", meaning the dealership will verify if the vehicle is available
to borrow.
o Return the car: Customers can return the car to the store. This use case also involves
"Check vehicle eligibility" as the employee will need confirmation for the vehicle return to
be successful.
o Add new vehicle: Employees can add new vehicles to the system.
• This diagram effectively captures the core functions of a self-driving car rental system as well as
the roles of both customers and employees within that system.
Figure 19.ClassDiagram
• Encapsulation: Each class creates a distinct boundary for accessing and manipulating data by
encapsulating its own data and methods.
• Abstraction: Class diagrams hide internal implementation details while illustrating the main
components of the system.
References
Anon., 2023. geeksforgeeks. [Online]
Available at: https://www.geeksforgeeks.org/introduction-of-object-oriented-programming/
[Accessed 16 6 2024].