Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

CS 111C Data Structures & Algo.: Java Section 001 Fall 2018 Midterm Exam 1 Prof.

ID: 3754763 • Letter: C

Question

CS 111C Data Structures & Algo.: Java Section 001 Fall 2018 Midterm Exam 1 Prof. Johnson 5 Questions/250 points) Programming and Short Answer Questions (11) Write a brief description explaining what the classes, associations, and visibilities are for the UML class diagram below. Specifically, explain the meaning of the names in inside the class rectangles, arrows, lines, and number ranges as well as the + and -signs 3 a: sting dob: De address: sing phone:string deperto:shing sedFieldsD vod gEmai): string

Explanation / Answer

UML Class diagrams are used to describe the classes(i.e. entities) of a particular system, their attributes, methods(operations) and their relationships of thier objects.

Class: It is an abstraction of entity with its characteristics(attributes & operations).

Note: The diagram here provided(in the question) contains 4 classes with its attributes and operations.

Classes are illustrated with rectangle which is divided into 3 sections.

1) Name of the Class (denoted with Bold font and centered )

2) Class Attributes

3) Class operations

Example: Here I am taking Senor Employee class for explaining each section

1st section: Senor Employee is the name of the class

2nd section: bonus is an attribute. Note: details provided beside(after colon) to attribute denotes attribute data-type.

3rd section: sefFields, calculatePayPresent, displayData, getBonus are Class operations(methods). Note: details provide beside to class operation denotes return datatype of the operation/method.

Associations: Denotes static relationship between two classes

Two types of Associations:

1. UniDirectional: Less common relationship, one class of aware of other and interacts with it. Usually denoted with straight connecting line that points an open arrow head from knowing class to the known class.

Note: There are no unidirectional associations are in the above diagram

2. BiDirectional: Default relationship and both classes aware of each other and has relationship with the other. Usually denoted with the straight line between two classes.

Note: There are three BiDirectional associations present in the above image which are places with multiplicity notations(0..* and 1) in each end of the assocation. Multiplicity notations indicates the number of instances of one class linked to one instance of the other class.

Here 0..* denotes Zero or more and 1 represents Only one.

The closed arrow heading with the line indicates inheritance. Here closed arrow heading pointing towards the super-class.

Inheritance: The process of a child or sub-class taking on the functionality of a parent or superclass also known as generalization.

Note: In the above diagram there are two inheritances, one between (Senior Employee, Employee) and (Ordinary employee, Employee). Here Employee is the super class.

Visibilities: It signifies who can access the information. plus(+) sign represents the public access, minus(-) represent private access, # denotes protected and ~ denotes package.