310414 OO MODELING WITH UML 1 EXAMPLE The classes shown have some attributes that are internal...

Post on 19-Jan-2018

217 views 0 download

description

OO MODELING WITH UML 3

Transcript of 310414 OO MODELING WITH UML 1 EXAMPLE The classes shown have some attributes that are internal...

310414310414 OO MODELING WITH UMLOO MODELING WITH UML1

EXAMPLEEXAMPLE

The classes shown have some attributes that are internal object identifiers (OIDs) that should not appear at the conceptual level and should either be deleted or be replaced with relationships. All such attributes conveniently have names ending in ID.

Some further information about the application follows. A person may work for any number of companies. Persons, companies, or banks may own cars. The car owner ID represents either the person, company, or bank who owns the car. A car may have only one owner (person, company, or bank). A car loan given by a bank is for the purchase of a car. A car may have multiple car loans.

Prepare a class diagram in which the OIDs are either deleted or replaced with relationships. Use associations and generalizations as necessary. Show the most likely multiplicities for all associations and the final attributes for each class.

Note: Your final class diagram should contain no OIDs.

310414310414 OO MODELING WITH UMLOO MODELING WITH UML2

EXAMPLEEXAMPLE

Person

nameageemployer1IDemployer2IDemployer3IDpersonIDaddress

Car

ownerIDvehicleIDownerTypemodelyear

CarLoan

vehicleIDcustomerTypecustomerIDaccountNumberbankIDinterestRatecurrentBalance

Company

namecompanyID

Bank

namebankID

310414310414 OO MODELING WITH UMLOO MODELING WITH UML3

310414310414 OO MODELING WITH UMLOO MODELING WITH UML4

310414310414 OO MODELING WITH UMLOO MODELING WITH UML5

EXAMPLE SOLUTIONEXAMPLE SOLUTION

It is important to realize that some IDs represent associations while others are simply internal OIDs and so should not appear as attributes at all.

Carmodelyear

CarLoan

accountNumberinterestRatecurrentBalance

Ownername

WorksForIsFor

Lends

Owns

Personageaddress

Company*

1

*

*

*

1

*

Bank1

{disjoint, complete}

{incomplete}