018-001-003

Interface vs Abstract Class: Notification System

Hard

Problem Description

Interface vs abstract class: Notification System

In this problem, you will create a program that designs a notification system by defining common notification processing in an abstract class and implementing concrete notification types (Email or SMS) as subclasses, and displays the result to standard output.

Learning Objective: Appropriately combine interface and abstract class

Design notification system with abstract class for common processing and interface for additional features.

Input

Line 1: Notification type (email or sms)
Line 2: Destination
Line 3: Message

Output

Preparing notification...
Sending [TYPE] to [destination]
Message: [message]
Notification sent!

Example

Input:

email
user@example.com
Hello World

Output:

Preparing notification...
Sending EMAIL to user@example.com
Message: Hello World
Notification sent!

Ready to Try Running Code?

Log in to access the code editor and execute your solutions for this problem.

Don't have an account?

Sign Up