The method should repeatedly ask the user to enter the next word until the user signals the end of the series of words by entering a "*".
The method should then calculate the average length of all the words (not including the "*") and then return the average as a double value.
public static double averageLength()
int count = 0;
boolean numberOfCharacters = 0;
String word = "";
word = OUDialog.request("Please enter next word");
numberOfCharacters = numberOfCharacters + word.length();
return numberOfCharacters / count;
For some reason it seems to include the "*" as a word and I only want "*" to end the while loop. Please help