How Would We Fix That – Intro to Java Programming


The answer is, we want to set inside vowel group to false when letter is not a vowel. If we always increment count for vowels, then words like peach would be counted as having two syllables. These two vowels, e and a, are in the same vowel group. So even though there are two, we only want one syllable. If we change the condition of the inner if block from inside vowel group to count equals equals one, Will only increment count when there’s already one syllable counted. So we’ll never increment count. If we set inside vowel group to false right after count++, we’ll never be inside of a vowel group. Every vowel would be counted as a syllable, so this would be a lot like the first option. It wouldn’t work well for words that have two vowels together. The last answer is the correct one. When we see a non-vowel, we want to change insideVowelGroup to false. For example, in hello, we see the e and enter a vowel group, but then we see an l, so that ends the vowel group.

Leave a Reply

Your email address will not be published. Required fields are marked *