Question: Consider a chatroom application where multiple users can send messages to a chat room and it is the responsibility of the chat room to show

 Consider a chatroom application where multiple users can send messages to

Consider a chatroom application where multiple users can send messages to a chat room and it is the responsibility of the chat room to show the messages to all users. This is best achieved using the Mediator Pattern which provides a mediator class that handles all the communications between the different classes (or the many objects of the same class) and supports easy maintenance of the code by loose coupling. The class diagram is shown in Fig. Q3. 3. MediatorPatternDemo User ChatRoom uses uses name: String +User(String): void +getName): String +setName(String) void +sendMessage(String): void +showMessage(User, String): void main(): void Fig. Q3 Assume that when the ChatRoom class performs a System.out.println() action, every User is able to see it. Write the Java code for all the three classes shown above. In the main() method, instantiate two users and make each one send a message

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!