Question: Create the UML class diagram associated with the classes defined in the file. Your diagrams must include both private and public attributes and methods. You

Create the UML class diagram associated with the classes defined in the file. Your diagrams must include both private and public attributes and methods. You may opt to not show a private attribute when a public property exists for it. Submit your answer as a file: PNG or JPG image, or PDF document.

class Warehouse: """ Contains a number of boxes """ def __init__(self): self._boxes = [Box(f"Box number {idx}", 1, 1, 1) for idx in range (10)]

class Box: """ A box with given dimensions """ def __init__(self, id, name_, length_, width_, height_): self.id = id_ self._name = name_

for attr in (length_, width_, height_): if type(attr) is not int: raise TypeError

if int(attr) < 0: raise ValueError

self._length = int(length_) self._width = int(width_) self._height = int(height_) @property def name(self): return self._name def set_name(self, new_name): self._name = new_name

def get_volume(self): """ :returns: The volume of the box """ return self._length * self._width * self._height

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!