java.lang.Object | +--Word
The Word class represents a single word. It provides a method to count the number of syllables in the word as well as a convenience method that determines if a particular character is a vowel.
| Constructor Summary | |
Word(String w)
Construct a new Word based on the parameter w. |
|
| Method Summary | |
int |
countSyllables()
Count and return the number of syllables in this Word. |
String |
getWord()
Get the word represented by this Word object. |
static boolean |
isVowel(char ch)
Determine if ch is a vowel. |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
public Word(String w)
w - the String which constitutes the new word.| Method Detail |
public int countSyllables()
There is one exception to the above rule. A single 'e' appearing at the end of a word does not count as a separate syllable. For example:
All non-letter's such as digits and punctuation should be treated as non-vowels. For example:
All words must have at least 1 syllable. So, if by the above calculations a word would have 0 syllables it should be reported to have 1 syllable. For example:
public String getWord()
public static boolean isVowel(char ch)
ch - the character to be checked.