C# - C Sharp: Practical 9: Readers Management System
Giải phóng thời gian, khai phóng năng lực
READERS MANAGEMENT SYSTEM
1. Design delegate ReadNewsDelegate that can references to methods as below:
void TestMethod(string news)
2. Design class PostOffice:
· Has an event NewsEvent that can use ReadNewsDelegate delegate
· Has property ReaderList ( System.Collections.ArrayList)
· Has method void UpdateNews(string news) that use to invoke the event NewsEvent
3. Design interface Ireader:
+ Properties:
· Int ID
· String Name
· DateTime BirthDate
· String Email
+ Methods:
· void ReadNews(string news)
· void Register(PostOffice p)
· void Unregister(PostOffice p)
4. Design class Reader implements interface Ireader:
· Method ReadNews prints Name, BirthDate, Email of reader, after that print content of news to the console.
· Method Register adds reader to ReaderList of the PostOffice, and suscribers method ReadNews of reader to event NewsEvent of the PostOffice.
· Method Unregister removes reader from ReaderList of the PostOffice, and removes method ReadNews of reader from event NewsEvent of the PostOffice.
5. Design a menu:
1. Add new reader
2. Remove a reader
3. Publish new news
4. Exit
· When users choose 1: create an instant of class Reader, ask users to input Name, BirthDate, Email, the ID of instant is auto increment (ID++). Call method Register of the user.
· When users choose 2: ask them to input a name, afterthat search the user whose Name equals the name was inputted. Call method Unregister of the user.
· When users choose 3: ask them to input content of the news. After that pass the news to method UpdateNews of the PostOffice ( there is only an instant of the PostOffice was created).
Giải phóng thời gian, khai phóng năng lực