In: Computer Science
5. Draw an entity-relationship diagram, including minimum and maximum cardinality, for the following: The system stores information about two things: cars and owners. A car has attributes for make, model, and year. The owner has attributes for name and address. Assume that a car must be owned by one owner and an owner can own many cars, but an owner might not own any cars (perhaps she just sold them all, but you still want a record of her in the system).
6. Draw a class diagram for the cars and owners described in problem 5, but include subclasses for sports car, sedan, and minivan, with appropriate attributes.
7. Consider a system that needs to store information about computers in a computer lab at a university, such as the features and location of each computer. What are the domain classes that might be included in a model? What are some of the associations among these classes? What are some of the attributes of each class? Draw a domain model class diagram for this system.
8. Consider the classes involved when modeling a car and all its parts. Draw a domain model class diagram that shows the whole-part relationships involved, including multiplicity. Which type of whole-part relationships is involved?
(5)
(6)
(7)
Domain model class diagram:
Domain model class diagram is that the class exhibits in the problem domain about the objects.
• The associations and attributes are contained in the domain class.
Notation of domain model class diagram:
The domain model class diagram notations are used based on the following rules:
• Classes may represent the physical object, event, or concept and the first letter of the class must start in capital letter.
• A property of a class is called the attribute.
• The link between the classes is denoted by relationship.
• Multiplicity constraint represents the relationship between classes through following relationships such as,
• 0…1 (Zero or one)
• 0…* (Zero or more (optional))
• 1 (One and only one (mandatory))
• * (Zero or more alternate(optional))
• 1…1(One and only one alternate (mandatory))
• 1…*(One or more (mandatory))
step: 2
Considering the system needs to store the information about the computer in the computer lab at a university with specific attributes such as location, feature of the computer.
Domain classes in the model:
The following three domain classes are required in this model to store the information.
• Block class
• Laboratory class
• Computer class
step: 3
Associations among the classes:
There are two relationships created between these three classes. They are as follows:
Relationship between class Block and class Laboratory :
• From the Block to Laboratory the association is one-to-many relationship because the multiplicity is shown as one-to-many relationship in one direction.
• From Laboratory to Block the association is shown as many-to-one relationship beacuse the multiplicity is shown as many-to-one relationship in another direction.
Relationship between class Laboratory and Computer :
• From the Laboratory to Computer the association is one-to-many relationship because the multiplicity is shown as one-to-many relationship in one direction.
• From Computer to Laboratory the association is shown as many-to-one relationship because the multiplicity is shown as many-to-one relationship in another direction.
step: 4
Attributes of classes:
The following are the attributes for each classes. They are as follows:
• The Block class contains the attributes blockNumber and blockName.
• The Laboratory class contains the attributes labaoratoryLocation, numberOfHours, and laboratoryNumbers.
• The Computer class contains the attributes such as computerNumber, seatNumber, model, speedOfComputer, and typeOfMonitor.
step: 5
Domain model class diagram to store the information about the computer in university:
(8)
Domain model class diagram:
Domain model class diagram is that the class exhibits in the problem domain about the objects.
• The associations and attributes are contained in the domain class.
Whole-part:
Whole-part relationship is the association between the classes in which one class act as a component or part for another class.
• For example, “Car” is made up of parts such as body, wheels, breaking mechanism, and steering mechanism.
Notation used for whole-part relationship:
• The diamond shape in the diagram represents that the classes are divided into subclasses and it shows the whole-part relationship between the classes.(Refer below)
Domain model class diagram:
Considering the following domain model class diagram uses the whole-part relationship to model the car and its parts:
In the above diagram,
• The “Car” is the superclass and it is further divided into five classes.
• The diamond shape in the diagram represents that the superclass is “Car” and it is further subdivided into classes such as CarFrame, CarEngine, CarBody, Wheels, and InteriorDecoration.
• The superclass Car has its own attributes such as ProductDeveloper, year, and modelOfCar.
• The subclass CarFrame has its own attributes such as sizeOfFrame and specifications.
• The subclass CarEngine has its own attributes such as engineType and sizeOfEngine.
• The subclass CarBody has its own attributes such as numberOfDoors, roofStructure, and sizeOfCar.
• The subclass wheels has its own attributes such as numberOfWheels.
• The subclass InteriorDecoration has its own attributes such as colorOfCar and typeOfCar.
• Additionally the multiplicity constraint for all the classes will be “1” because the engine, frame, body, interior decoration are one except the class wheels.
• This is because the car contains four wheels so the multiplicity constraint will be “4” for “wheels”.
step: 2
Aggregation whole-part relationship:
From the above domain model diagram, aggregation is the type of whole-part relationship involved in the diagram. Because, the “Car” being the individual component , its parts are defined separately as carFrame, carEngine, carBody, Wheels, and InteriorDecoration.