Write the message class

Assignment Help JAVA Programming
Reference no: EM131589055

The Message Class

Every message contains some content ("The British are coming! The British are coming!") and a creator, or author ("Paul Revere").

1. Write the Message class.  The class should have the following:

Public Static Class Constants

Define a full set of limits and defaults, like MAX_MSG_LENGTH and DEFAULT_AUTHOR, for both min, max lengths and default data of every member.  Set the maximum message length to a large number (at least a million) and the maximum author length to a reasonable value like 40 or 65, not 5 or 200.

Private Member Data

   String message;
   String author;

Public Methods

  • Default and 2-parameterconstructors.
  • MutatorandAccessorfor each member.
  • atoString()method that provides a formatted return String.

Private Methods

  • private staticvalidation helpersto filter client parameters. These will support your public methods.

Test of  Class Message

2. Write a program TestMessage.java.  Instantiate two or more Message objects, some using the default constructor and some using the parameter-taking constructor.  Mutate one or more of the members, and after that use the toString() to assist a screen output so we can see what all of your objects contain.

Next, test one or more accessors.  Finally, test two or more mutators, providing both legal and illegal arguments and testing the return values (thus demonstrating that the mutators do the right thing). 

 3. Create a zip file which contains the following files:

  • Message.java
  • TestMessage.java

4. Upload the zip file to Canvas

Sample Run:

/* ---------------------------------------------------------
The Message Class Testing ******************************

Author: Kinnard
 Message ---------------------- 
Some messages just aren't worth sending.

Author: Johnson
 Message ---------------------- 
hello world

testing Message accessors:
Kinnard

hello world

testing Message mutators:
too long (as expected)
Author: Kinnard
 Message ---------------------- 
Some messages just aren't worth sending.

acceptable length (shoud  be)
Author: Kinnard
 Message ---------------------- 
LONG STRING abcde abcde abcde abcde  abcde abcde abcde  abcde  abcde  abcde  abc
de  abcde abcde  abcde abcde abcde
-------------------------------------------------

Reference no: EM131589055

Questions Cloud

Which of these two theories feels the most comfortable : Pretend you are good Utilitarian who is more interested in the results than in the intention to do the right thing, what course of action would you take ?
Components of aggregate demand : What components of aggregate demand were affected and what was the impact on real output? What were the policy options?
What response or solution does the hgp provide criticisms : What response or solution does the HGP provide for the concerns and criticisms of the above issue. Do they identify any of their own concerns
Briefly describe how a company is using the strategy : Briefly describe how a company is using this strategy, and provide your own observation (why are they doing this? Do you think it will be effective?
Write the message class : Write the Message class - Define a full set of limits and defaults, like MAX_MSG_LENGTH and DEFAULT_AUTHOR, for both min, max lengths and default data of every
Determining the structural unemployment : In your answers, please make sure to define what structural unemployment is and why it occurs.
Demand for desktop computers : A decrease in the price of tablet computers will decrease the demand for desktop computers." This statement is an example of a normative economic statement
Evaluate the impact of regulations and business plans : Evaluate the impact of regulations, business plans, and economic dynamics on the working capital requirements of the business
What do i believe i still need to work on more : What have I taken for granted about my writing skill; how may my perception about how well I write hinder my academic and professional success?

Reviews

Write a Review

JAVA Programming Questions & Answers

  Recursive factorial program

Write a class Array that encapsulates an array and provides bounds-checked access. Create a recursive factorial program that prompts the user for an integer N and writes out a series of equations representing the calculation of N!.

  Hunt the wumpus game

Reprot on Hunt the Wumpus Game has Source Code listing, screen captures and UML design here and also, may include Javadoc source here.

  Create a gui interface

Create GUI Interface in java programing with these function: Sort by last name and print all employees info, Sort by job title and print all employees info, Sort by weekly salary and print all employees info, search by job title and print that emp..

  Plot pois on a graph

Write a JAVA program that would get the locations of all the POIs from the file and plot them on a map.

  Write a university grading system in java

University grading system maintains number of tables to store, retrieve and manipulate student marks. Write a JAVA program that would simulate a number of cars.

  Wolves and sheep: design a game

This project is designed a game in java. you choose whether you'd like to write a wolf or a sheep agent. Then, you are assigned to either a "sheep" or a "wolf" team.

  Build a graphical user interface for displaying the image

Build a graphical user interface for displaying the image groups (= cluster) in JMJRST. Design and implement using a Swing interface.

  Determine the day of the week for new year''s day

This assignment contains a java project. Project evaluates the day of the week for New Year's Day.

  Write a java windowed application

Write a Java windowed application to do online quiz on general knowledge and the application also displays the quiz result.

  Input pairs of natural numbers

Java program to input pairs of natural numbers.

  Create classes implement java interface

Interface that contains a generic type. Create two classes that implement this interface.

  Java class, array, link list , generic class

These 14 questions covers java class, Array, link list , generic class.

Free Assignment Quote

Assured A++ Grade

Get guaranteed satisfaction & time on delivery in every assignment order you paid with us! We ensure premium quality solution document along with free turntin report!

All rights reserved! Copyrights ©2019-2020 ExpertsMind IT Educational Pvt Ltd