# Whiteboarding Question: Notification System
# Problem Statement
You are designing a notification system that sends messages through different channels. The system should support multiple types of notifications while ensuring all notifications follow a common structure.
# Requirements:
Every notification must have a recipient (who receives the message).
Every notification must have a message body.
Each notification type must have a
send()method that prints a formatted message to the console.Different types of notifications format their messages differently:
EmailNotification should print:
1 2 3Sending Email to user@example.com: Subject: Important Update Body: "You've got mail!"SMSNotification should print:
1 2Sending SMS to +1234567890: Message: "New message received!"PushNotification should print:
1 2Sending Push Notification to user123: Alert: "Check your app for updates!"All notifications should log their delivery after being sent. Example:
1Notification sent successfully.The system should be easily extendable to support new notification types without modifying existing code.
# Example Expected Usage
| |
# Expected Console Output
| |
# Task
- Design and implement the
Notificationstructure so that all notifications share common behavior and data. - Ensure that new notification types can be added without modifying existing code.
- Implement shared functionality (such as logging) in a way that applies to all notifications without duplicating code.