OOP Lab Task 1

De la WikiLabs
Jump to navigationJump to search

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 your 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 will be evaluated automatically by the WebCat platform.
  • You could access the Web-Cat platform using the username and the password with which you acces the studenti.pub.ro intranet.
  • To be granted the acces to the Web-Cat platform you should first add your identification info (intranet username, name, surname, group, e-mail address) into the user registration document. Your registration is checked by the administrator, therefore it may finish after a couple of days.
  • Once you are granted the acces you may submit your work to the active task assignemnts.
  • To submit your work you upload a single .zip archive containing only the Java source code files.
  • If your work contains a single Java file you may directly upload that single file, unarchived.
  • Attention Any deviation from these instructions may lead to the loss of the entire amount of points.