Diferență între revizuiri ale paginii „OOP Lab Task 1”

De la WikiLabs
Jump to navigationJump to search
Linia 9: Linia 9:
 
== Requirements==
 
== Requirements==
  
* Write a class called '''Message''' which should abstract out a physical letter. Class '''Message''' should have fields for '''sender''', '''receiver''' and '''content''', of type ''string of characters''.
+
* Write a class '''Message''' that will be used as a data carrier between a chat client and all the other clients connected to a server. This class needs to:
* Write a method called '''print()''', member of class '''Message''', which will output in the standard stream (console), the information related to Message objects, in the format: ''From <sender> to <receiver>: <content>'' (use ''System.out.println()'');
+
** Store the name of the sender and a message content.
* Write a class called '''TestClass''' which should only contain the '''main''' method as a member, in which you should instantiate 3 objects of type '''Message''', initialize their fields with different values and call, for each object, the method '''print()'''.
+
** 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 with only one method call.
 +
 
 +
* Write an executable class called '''Main''', which should contain only the '''main''' method, which must instantiate at least three objects of type '''Message''' and 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 radu.hobincu@upb.ro.
 +
* The subject of the e-mail will be [POO_1]
 +
* The body of the e-mail will contain the name and group of the student and any additional command you want to make.
 +
* <font color="red">'''Attention'''</font> Any deviation from these instructions may lead to the loss of the entire amount of points.

Versiunea de la data 23 noiembrie 2014 20:07

Required Tutorials

Requirements

  • Write a class Message that will be used 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 with only one method call.
  • Write an executable class called Main, which should contain only the main method, which must instantiate at least three objects of type Message and 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 radu.hobincu@upb.ro.
  • The subject of the e-mail will be [POO_1]
  • 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.