Question: Problem 2: (25 points) For the situation listed below, draw a UML Class Diagram using Lucid Chart to design the system. Animals In this problem,
Problem 2: (25 points) For the situation listed below, draw a UML Class Diagram using Lucid Chart to design the system. Animals In this problem, first we will consider the relationships and properties of Animals. All Animals should have the following attributes: Height Weight Year born Gender When an animal is born (i.e. instantiated with a constructor), all 4 properties should be set. The Year born cannot be modified afterwards. However, Height, Weight, and Gender can be changed. Ensure you have functions that can return the value of all of these properties, and functions that only modify Height, Weight, and Gender. Add in a speak function as well: a pure virtual function. The types of animals in this problem can be separated into two categories: mammals and reptiles.
Mammals contain the following attributes upon creation: hair type name bipedal Reptiles contain the following attributes upon creation: scale type Biome fear factor The following 6 animals are considered in this problem: Human, Bear, Dog, Alligator, Snake, Gecko Remember to override the speak function in each of these subclasses.
Next, lets create a Building class with the attributes: Location Size Capacity The types of buildings in this problem can be separated into two categories: houses and zoos.
Houses contain the following attribute upon creation: residents (vector of Animals [humans, dogs, snakes, and geckos] only)
Zoos contain the following attributes upon creation: exhibits (vector of Animals [humans, bears, alligators, snakes, geckos] only) Time open_time Time close_time
Finally, lets create a Time class with the attributes: Hour Minute Second
All Building classes must have functions to access each attribute, but not all attributes should be able to be modified. The Time class should have a constructor to set the initial attributes as well as a print function to get the time accordingly. Create the UML class diagram that relates animals, mammals, reptiles, the six animals, buildings, the building types, and the Time class considered in this problem. Make sure to encapsulate all of the properties and functions specified above. Remember that youre just making a UML class diagram. You are not coding this! Make use of annotations in your UML class diagram to cover some of the non obvious aspects of your system.
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
