OOP Lab Task 1: Diferență între versiuni

De la WikiLabs
Linia 9: Linia 9:
 
== Requirements==
 
== 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:
+
* Create a Java application project whose name contains your name and group using the format ''group_surname_name'' (use a single name and a single surname). Student John Codebreaker from 421G will create a project named 421G_Codebreaker_John .
 +
* Add to you project a class '''Message''' (that may be used some time in the future 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.
 
** 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).
 
** 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 <span style="font-family:'Lucida Console', monospace">public String toString()</span>.
+
** Allow reading of the sender and content information from Message objects in a way specific to chat programs: "sender: contents". This must be done using only one method call that returns the formatted string, ready to be displayed by any print method. Try first with a method of your own. Then, add another method, that does exactly the same thing but whose declaration is <span style="font-family:'Lucida Console', monospace">public String toString()</span>.
  
* 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.
+
* Write another class called '''Main''' (the default class created if you created a project within NetBeans), which should contain only the '''main''' method, that instantiates at least three objects of type '''Message''' and then displays their formatted string on the screen.
  
 
Notes:
 
Notes:
 
* Each class and class member must have one of the two access modifiers ''public'' or ''private''.
 
* 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.
 
* The names of the classes must be identical to the ones specified above.
 +
* Follow the coding rules stated in Java Coding Conventions.
  
 
Submitting:
 
Submitting:
* The assignment is submitted attaching the Java source code files exclusively to an e-mail sent to arhitectura_procesoarelor@yahoo.com.
+
* The assignment is submitted attaching the Java source code files to an e-mail sent to arhitectura_procesoarelor@yahoo.com
* The subject of the e-mail will be [OOP_1]
+
* 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.
+
* Leave empty the body of the e-mail.
 
* <font color="red">'''Attention'''</font> Any deviation from these instructions may lead to the loss of the entire amount of points.
 
* <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 20 octombrie 2015 23:40

Required Tutorials

Requirements

  • Create a Java application project whose name contains your name and group using the format group_surname_name (use a single name and a single surname). Student John Codebreaker from 421G will create a project named 421G_Codebreaker_John .
  • Add to you project a class Message (that may be used some time in the future 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 Message objects in a way specific to chat programs: "sender: contents". This must be done using only one method call that returns the formatted string, ready to be displayed by any print method. Try first with a method of your own. Then, add another method, that does exactly the same thing but whose declaration is public String toString().
  • Write another class called Main (the default class created if you created a project within NetBeans), which should contain only the main method, that instantiates at least three objects of type Message and then displays 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.
  • Follow the coding rules stated in Java Coding Conventions.

Submitting:

  • The assignment is submitted attaching the Java source code files to an e-mail sent to arhitectura_procesoarelor@yahoo.com
  • The subject of the e-mail will be: OOP_1
  • Leave empty the body of the e-mail.
  • Attention Any deviation from these instructions may lead to the loss of the entire amount of points.