0% found this document useful (0 votes)
3 views1 page

Polymorpism and Domain Models

The document outlines two case studies focusing on object-oriented programming concepts, specifically polymorphism and domain models. The first case study involves implementing a Vehicle Rental System with various vehicle types and rental calculation rules, while the second case study details a Notification System for a mobile app that handles notifications through multiple channels. Both systems emphasize the management of unique user or customer information and the use of common interfaces for varying functionalities.

Uploaded by

kifayetali070
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
3 views1 page

Polymorpism and Domain Models

The document outlines two case studies focusing on object-oriented programming concepts, specifically polymorphism and domain models. The first case study involves implementing a Vehicle Rental System with various vehicle types and rental calculation rules, while the second case study details a Notification System for a mobile app that handles notifications through multiple channels. Both systems emphasize the management of unique user or customer information and the use of common interfaces for varying functionalities.

Uploaded by

kifayetali070
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 1

Object oriented programming

Session 2024
Topics: polymorphism and domain models

 Iden fy where to use sta c polymorphism.


 Iden fy where to use dynamic polymorphism.
 Draw the domain model diagram.

Case study # 1

You have to implement a Vehicle Rental System. The vehicle can be a Car, Bike, or Truck. Each vehicle has a
unique number, brand, model, and rental price. A customer can rent any vehicle based on availability.
Each vehicle type has different rental calculation rules. Cars and Bikes are charged per day. Trucks are charged
per day plus an extra load fee. You can deposit and return vehicles.

While calculating the rental:

 Cars and bikes use a flat daily rate.


 Trucks apply an additional charge based on cargo.
The system provides a RentCalculator utility. This utility can calculate rent in multiple ways:
You can calculate just the rent, or you can calculate rent with a discount, or calculate rent with a discount and
insurance charges.

The system manages Customer information. Customers have unique IDs, names, driving license details, and
contact information

Case study #2

You have to implement a Notification System for a mobile productivity app. Notifications can be sent through
multiple channels: Email, SMS, and Push Notifications.
Each notification type has a unique sending process. Emails are sent using SMTP, SMS via an SMS gateway,
and Push Notifications.

The system should allow each type to send messages using a common interface. The behavior of sending varies
with the channel.

 You also need to implement a Notification Logger.


 You can log just the message, or log the message with timestamp. This allows developers to debug and
monitor notifications effectively.

The system manages User profiles. Each user has a unique ID, name, email, phone number, and preferences for
how they want to receive notifications.

You might also like