Structural Models Class Diagram Part 2 Reflection College

  • Slides: 13
Download presentation
Structural Models Class Diagram Part 2

Structural Models Class Diagram Part 2

Reflection College administering students has its own name and address. It keeps counting students

Reflection College administering students has its own name and address. It keeps counting students registered to college. Registered student in a college have information such as id, name and room number. Consider also the relationship between the classes.

Relationship between Classes 2. Association (ii) Composition • A special type of aggregation where

Relationship between Classes 2. Association (ii) Composition • A special type of aggregation where parts are destroyed when the whole is destroyed. • Represents “ is entirely made of” relationship • Objects of Class 2 live and die with Class 1. • Class 2 cannot stand by itself If class 1 die, class 2 dies too Book Page

Differences between aggregation vs. composition

Differences between aggregation vs. composition

Relationship between Classes 2. Association (iii) Dependency • Exists between two classes if changes

Relationship between Classes 2. Association (iii) Dependency • Exists between two classes if changes to the definition of one may cause changes to the other (but not the other way around). • Represent “uses temporarily” relationship • Class 1 depends on Class 2

Example of Complete Class Diagram Class w op prototype but not implementation; useful for

Example of Complete Class Diagram Class w op prototype but not implementation; useful for identifying functionalities across classes

Example of Complete Class Diagram The following can be observed from the above diagram:

Example of Complete Class Diagram The following can be observed from the above diagram: 1. Shape is an abstract class. It is shown in Italics. 2. Shape is a superclass. Circle, Rectangle and Polygon are derived from Shape. In other words, a Circle is-a Shape. This is a generalization / inheritance relationship. 3. There is an association between Dialog. Box and Data. Controller. 4. Shape is part-of Window. This is an aggregation relationship. Shape can exist without Window. 5. Point is part-of Circle. This is a composition relationship. Point cannot exist without a Circle. 6. Window is dependent on Event. However, Event is not dependent on Window. 7. The attributes of Circle are radius and center. This is an entity class. 8. The method names of Circle area(), circum(), set. Center() and set. Radius(). 9. The parameter radius in Circle is an in parameter of type float. 10. The method area() of class Circle returns a value of type double. 11. The attributes and method names of Rectangle are hidden. Some other classes in the diagram also have their attributes and method names hidden.

Exercise Illustrate UML Class diagram for ATM Machine. The classes involved in the system

Exercise Illustrate UML Class diagram for ATM Machine. The classes involved in the system are: Bank, Account, Customer Info, Debit Card, Current Account, Saving Account, ATM Info, ATM Transaction, Withdraw Transaction, Change Pin, Transfer Money, Check Balance. The Bank maintains personal and ATM information of each customer. The customer can access their account using Debit Card issued by the Bank. In this system there could be two types of Account: Current Account and Saving Account. Both use to share many of the properties and methods. The ATM Machine can perform multiple transactions such as Withdrawing cash, change pin, check balance and Transfer Money to each account.

Exercise : Answer

Exercise : Answer

Final Exam Sem 2 2017/2018 Question 3 b • An automated greenhouse is especially

Final Exam Sem 2 2017/2018 Question 3 b • An automated greenhouse is especially designed to grow strawberry in Malaysia. The greenhouse is able to determine the strawberry plants’ age and, analyze their growth and health. The plants’ age, growth and health data are stored in the database. The intelligent software will automatically replenish the water and nutrients of the plants when those essentials depleted. Four cameras are also installed inside the greenhouse to monitor the greenhouse 24/7. The videos from the camera are saved in the database and can be played in the automated greenhouse webpage. Create a class diagram from the use case diagram given in Figure 4.

ANSWER intelligent engine can have many injector intelligent engine can have many camera

ANSWER intelligent engine can have many injector intelligent engine can have many camera