Question: Again consider the domain model class diagram shown in Figure 2. How many attributes does an active cart object have? Can an on-reserve cart contain cart items? Explain.
FIGURE 2 RMO Sales subsystem domain model class diagram
Solution: Refer the “figure 4-21” in the textbook which describes about the domain model class diagram for the RMO CSMS sales subsystem.
• From the figure 4-21, OnLineCart is the superclass and it consists of two subclasses such as ActiveCart and OnReserveCart.
• The superclass OnLineCart contains the four attributes such as startDateTime, noofItems, valueOfItems and status.
• The subclass ActiveCart contains the attribute elapsedTime.
• The subclass OnReserveCart contains the attribute holdForDays.
Attributes of active cart object:
The active cart object totally contains five attributes.
• It includes the four attributes such as startDateTime, noofItems, valueOfItems and status from the OnLineCart class and additionally it includes its own attribute elapsedTime.
• The OnLineCart class attributes are included because OnLineCart class is the superclass of ActiveCart class.
• So while adding OnLineCart class attributes with ActiveCart attributes (4+1 = 5) totally the ActiveCart includes five attributes.
Therefore, when an ActiveCart object is created, it includes
Cart items in “ OnReserveCart ” class:
• This is because “OnReserveCart” is also a subset of “OnLineCart”.