You are on page 1of 19

• The above UML diagram represents a University scenario.

The main classes defined are


University,Departments,Rooms,Person. Proffessor and Employee are child classes of
Person.Similarly Assistant,Associate and FullProfessor are child classes of Professor.Rooms also
have two child classes namely Office and ClassRoom.Child classes can inherit the properties of a
superclass or parent class.It can be shown by an arrow which is pointing to the parent from child as
shown in figure. From Department to Professor there is a cardinality given as 1 *,that mean one or
more,that is Department have more than one Professors.Professors may be Assistant,Associate or
Full professors.Department is part of university,that aggregation is denoted by the arrow from
Department to University.Similarly cardinality shows that University may have more than one
department,but departments are associated to the single university. A solid line with a filled
diamond at the association end, which is connected to the class that represents the whole or
composite,as shown from Rooms to University. This means that, a special type of aggregation
where parts are destroyed when the whole is destroyed. Similarly cardinality shows that university
have more than one rooms and all rooms are part of same university. There you can see a works in
relationship between Office and Person,and cardinality shows that a person work for a single office.
For UML class diagram given below (Figure 1), identify the
classes and their relationships and multiplicity. Based on your
understanding of the class diagram in Figure 1, write a
paragraph explaining all classes and their relationships.
The number of Classes are :
1.Customer Class
2.PointOFSale Class
3.Merchandise Class
4.Mall Class
5.Store Class
6.Store Catalog Class
7.Store Website Class
8.Employee Class
9.Department Class
Multiplicity between Classes:
1.There are 0..1 : 0..* multiplicity between Customer class and
Merchandise class. As 0..1 customer purchase from 0 or more
merchandise.
2.There are 1...* : 1...* multiplicity between Customer class and
PointOFSale class. As one or more customer can take product
and pay money for 1 or more product at the shop.
3.There are 1:1..* multiplicity between Mall class and store
class. As there are multiple store exist in the mall
4.There are 1:1..* multiplicity between Store class and
Employee class . As there are one to many employee in the
Store.
5.There are 1:0...* multiplicity between Store class and
Department class. As There are multiple department exist in the
store .
6.There are 1:1...* multiplicity between Department class and
SalesPerson . As there are one or more sales person is aggigned
to the department .
7.There are 1..* : 1..* multiplicit between Merchandise class
and PointOfSale.
Relationships exists between Classes
1.There are direct assoication relationship between Customer class and Merchandise class.
Like "Customer can purchase product from merchandise".
2.There are assoication relationshio between Customer class amd PointOFSale class.
3.There are assoication relationship between Department class and SalesPerson. As S"ales
Person are assigned to department "
4.There are Aggregation relationship between Merchandise class and PointOFSale class.
5.There are Aggregation relationship between Store class and Employee class. The
Aggregation relationship is same as has a relationship. Like " A store has a employee who
work for it ".
6.There are  Composition relationship between Store class and Mall class
7.There are Composition relationship between Store class and department class
8.There are Generalization relationship between PointOfSale class and Store class, store
catalog class , store website class . In this relationshio PointOfSale class act as parent class
and other are child classes.
9.There are Generalization relationship between Employee class and Manager class ,
SalesPerson class. The Employee class act as parent class and other are child classes.
https://www.chegg.com/homework-help/questions-and-
answers/draw-class-diagram-following-code-diagram-must-
include-classes-attributes-visibility-priva-q17778468

https://bootcamp.uxdesign.cc/association-composition-and-
aggregation-in-c-3ca70336e992

https://blog.devgenius.io/association-composition-and-
aggregation-in-c-925465987061

https://www.infoworld.com/article/3029325/exploring-
association-aggregation-and-composition-in-oop.html
Object Relationship in Code
• Association
public class A {
private B b1;
public A()
{}
}

• Aggregation
public class A {
private B b1;
public A(B b)
{ b1 = b; }
}

• Composition
public class A {
private B b1;
public A() {
b1 = new B();
}}
Object Relationship in Code
• Generalization
public class A {
...
} // class A
public class B extends A {
....
} // class B

• Realization
public interface A {
...
} // interface A
public class B implements A {
...
} // class B

You might also like