How to express that some person keeps animals as pets ?

2014

How to express that some person keeps animals as pets ?

Attempted by 1032 students.

Show answer & explanation

Correct representation: an association named "pet" between Person and Animal with multiplicity 0..* at the Animal end. This means a person may keep zero or many animals as pets.

  • Place the role name "pet" near the Animal end to indicate the animal plays the role of a pet.

  • Use multiplicity 0..* at the Animal end to express that a single person can have zero or many animals as pets.

  • Do not use an arrow or an informal phrase for this simple association; a standard association with a role name and multiplicity is clearer.

Why the other diagrams are incorrect:

  • A diagram that places the label "pet" next to the Person class incorrectly suggests the person is the pet; role names should be placed to describe the opposite end.

  • A diagram that renames the right-hand class to "Pet" while using "animal" as the association name swaps class and role and changes the intended meaning; keep the class as Animal and use "pet" as the role/association name.

  • A diagram that uses an arrow labeled with a phrase like "keep pet as" is nonstandard and ambiguous; arrows introduce directionality and the phrase is informal—use a standard association with the role name and multiplicity instead.

Explore the full course: Mppsc Assistant Professor