Hey guys I keep getting the "no return statement error in two places, I have commented them for you
/**
* A WordsCompare object stores Strings. It is used to determine if the first word
* should be placed before or after the second word in the dictionary
*/
public class WordsCompare
{
//instance fields
private String wordOne, wordTwo;
/**
*Input for word one and word two
*@param one enter word one
*@param two enter word two
*/
public WordsCompare(String one, String two)
{
wordOne=one;
wordTwo=two;
}
/**
*compares the two strings
*
*/
public String getComparison()
{
// You must use an if..else statement in this method
// If you would like to test for the strings being the same, use an if..else..else,
// but that is optional. It is not tested in this particular data set.
if(wordOne.compareTo(wordTwo)>0)
{
return wordOne+" should be placed after "+wordTwo;
}
else if(wordOne.compareTo(wordTwo)<0)
{
return wordOne+" should be placed before "+wordTwo;
}
else if(wordOne.compareTo(wordTwo)==0)
{
return wordOne+" is the same as "+wordTwo;
}
}[B]//no return statement[/B]
public String getCompareLength()
{
// You must use an if..else..else statement in this method
if (wordOne.length()>wordTwo.length())
{
return wordOne+" is longer than "+wordTwo;
}
else if (wordOne.length()<wordTwo.length())
{
return wordOne+" is shorter than "+wordTwo;
}
else if(wordOne.length()==wordTwo.length())
{
return wordOne+" is equal to "+wordTwo;
}
}[B]//No return statement[/B]
}