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!
Test Cases
※ Output examples follow programming industry standards
Input:
email user@example.com Hello World
Expected Output:
Preparing notification... Sending EMAIL to user@example.com Message: Hello World Notification sent!
Input:
sms 090-1234-5678 Meeting at 3pm
Expected Output:
Preparing notification... Sending SMS to 090-1234-5678 Message: Meeting at 3pm Notification sent!
Input:
email admin@test.org System Alert
Expected Output:
Preparing notification... Sending EMAIL to admin@test.org Message: System Alert Notification sent!
Input:
sms 080-9876-5432 Urgent update
Expected Output:
Preparing notification... Sending SMS to 080-9876-5432 Message: Urgent update Notification sent!
❌ Some tests failed
Your Solution
Current Mode:● My Code
Sendable.java🔒
Notification.java🔒
EmailNotification.java🔒
SmsNotification.java🔒
Main.java🔒
5/6 ファイル354B
⚠️警告
- No main method found
9
1
2
3
4
5
›
⌄
import java.util.Scanner;
interface Sendable {
void send(String destination, String message);
}
0 B / 5 MB
You have 2 free executions remaining
