Write an interface Notifier with String send(String message), int cost() (in fen) and String channel(), and three classes that implement it:
EmailNotifier(address)—To lina@wku.edu.cn: message, free;SmsNotifier(phone)—SMS 13800001111: message, 10 fen; a text longer thanLIMIT = 20characters is cut to 17 characters plus...;PushNotifier(device)—[phone-1] MESSAGEin upper case, 1 fen.
Notifications.main reads n, then n subscribers (email ADDRESS, sms PHONE or push DEVICE) into an ArrayList<Notifier>, then sends every following non-empty line to all of them and prints the number of notifications and the total cost in yuan.
For the input
3
email lina@wku.edu.cn
sms 13800001111
push phone-1
Lab moved to room B204
Quiz on Friday
the program prints
To lina@wku.edu.cn: Lab moved to room B204
SMS 13800001111: Lab moved to room...
[phone-1] LAB MOVED TO ROOM B204
To lina@wku.edu.cn: Quiz on Friday
SMS 13800001111: Quiz on Friday
[phone-1] QUIZ ON FRIDAY
6 notifications sent
Cost: 0.22 yuan