OOP Lab Task 2

De la WikiLabs
Jump to navigationJump to search

Required Tutorials

Requirements

  • Write a class called PrivateMessage which will be used as a data carrier between a chat client and a specific recipient. This class needs to:
    • Store the name of the sender, a message content and the name of the recipient;
    • Be immutable
    • Allow reading of the sender and content information from the Message objects in a way specific to private messages in chat programs: "(priv) sender: contents". This must be done with only one method call.
    • Have a way to read the message recipient from objects of type PrivateMessage.
  • In the existing class Main, instantiate at least 3 objects of type PrivateMessage, and print for each one the formatted string and the recipient.

Notes:

  • Each class and class member must have one of the three access modifiers public, private or protected.
  • The names of the classes must be identical to the ones specified above.
  • Use inheritance and overriding.

Submitting:

  • The assignment is submitted attaching the Java source code files exclusively to an e-mail sent to radu.hobincu@upb.ro.
  • The subject of the e-mail will be [POO_2]
  • The body of the e-mail will contain the name and group of the student and any additional command you want to make.
  • Attention: Any deviation from these instructions may lead to the loss of the entire amount of points.