OOP Lab Task 1

De la WikiLabs
Jump to navigationJump to search
Versiunea pentru tipărire nu mai este suportată și poate avea erori de randare. Vă rugăm să vă actualizați bookmarkurile browserului și să folosiți funcția implicită de tipărire a browserului.

Required Tutorials

Requirements

  • Write a class Message (that may be used later as a data carrier between a chat client and all the other clients connected to a server). This class needs to:
    • Store the name of the sender and a message content.
    • Be immutable (once an object of this type is created, its contents can't be changed).
    • Allow reading of the sender and content information from the Message objects in a way specific to chat programs: "sender: contents". This must be done using only one method call. Try first with a method of your own. Add another method, that does exactly the same thing but whose signature is <style="font-family:'Lucida Console', monospace">public String toString()</style>.
  • Write another class called Main (the default class created if you created a project within NetBeans), which should contain only the main method, which instantiates at least three objects of type Message and then display their formatted string on the screen.

Notes:

  • Each class and class member must have one of the two access modifiers public or private.
  • The names of the classes must be identical to the ones specified above.

Submitting:

  • The assignment is submitted attaching the Java source code files exclusively to an e-mail sent to arhitectura_procesoarelor@yahoo.com.
  • The subject of the e-mail will be [OOP_1]
  • The body of the e-mail will contain the name 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.