Skip to main content

Video rental shop class diagram

Short answer

The class diagram includes Partner (Importer, ChainTrade) linked to Agreement (date, copies, leaseTime, price) which links to Video (name, id, rentalPrice). Video generalizes to ActionVideo (violenceDegree), ArtVideo (awards), ChildrenVideo (ageLimit) with overlapping between Action and Art. Customer generalizes to RandomCustomer, RegularCustomer (cumulativeRentals), ClubMember (memberAddress, advertise). Rental links Customer and Video with rentalPeriod and calcPrice().

The Premier Video Rental Shop (PVRS) decides to implement a database-based information system. PVRS acquires the video from the importer or chain trade. An agreement will be signed with both partners and it defines the date, number of copies, time frame of the lease and purchase price. As an additional info of importer also the address and bank details will be recorded. The customer rents a video from the PVRS. From each video the name, ID and rental price information will be recorded. The rental price is calculated from the rental period, the purchase price and the customer relationship. Video types include action, art and children's video. Video may also be a blend of action and art videos. As an action video info the degree of violence will be recorded, and from art videos the awards and from children's videos the age limit. The customer relationship can be a random customer, regular or member of PVRS club. As an overarching customer info the name will be recorded and from regular customer the cumulative sum of the number of rental events. From the members of PVRS club information, the member address is used in order to advertise new products and offers. Draw a class diagram, which presents the main classes, properties, methods, and relationships between classes.

Assumptions: PVRS is the shop; an Agreement is made for each acquisition from a Partner (importer or chain trade); a Rental links a customer with videos.

Classes, attributes and methods

ClassAttributesMethods
Partner (abstract)name-
Importeraddress, bankDetails-
ChainTrade--
Agreementdate, copies, leaseTime, purchasePricesign()
Video (abstract)name, id, rentalPricecalcRentalPrice()
ActionVideoviolenceDegree-
ArtVideoawards-
ChildrenVideoageLimit-
Customer (abstract)name-
RandomCustomer--
RegularCustomercumulativeRentals-
ClubMembermemberAddressadvertise()
RentalrentalPeriod, datecalcPrice()

Class diagram

Partner (importer or chain trade)
 +----------+ 1   * +-----------+ *   1..* +--------+
 | Partner  |-------| Agreement |----------| Video  |
 |----------|       |-----------|          |--------|
 | name     |       | date      |          | name   |
 +----------+       | copies    |          | id     |
   ^      ^         | leaseTime |          | rental |
   |      |         | price     |          | Price  |
 Importer Chain     +-----------+          +--------+
 -address Trade                            ^   ^   ^
 -bank                              Action Art Children
                                    -viol. -awards -ageLimit
                                    {overlapping: Action, Art}

 +----------+ 1   * +--------+ *   1..* +--------+
 | Customer |-------| Rental |----------| Video  |
 |----------|       |--------|          +--------+
 | name     |       | period |
 +----------+       | price()|
   ^    ^    ^      +--------+
 Random Regular  ClubMember
        -total   -address
        Rentals  +advertise()

Relationships

  • Partner generalizes Importer and ChainTrade; a Partner has many Agreements; each Agreement covers one or more Videos.
  • Video is generalized into ActionVideo, ArtVideo, ChildrenVideo. Since a video may be a blend of action and art, the generalization is marked {overlapping}.
  • Customer is generalized into RandomCustomer, RegularCustomer, ClubMember ({disjoint}).
  • Customer 1 to many Rental; Rental many to 1..* Video.
  • Rental price is derived: calcRentalPrice() = f(rentalPeriod, purchasePrice, customer type) (the customer relationship gives the discount).

✓ Answer checked by Claude Opus 5.5 (high effort)

All Object Oriented Analysis and Design chapter 2 questions →