Vowel Counter

Write a program called VowelCounter that has the user enter a one-word String value. The program then counts and displays the number of vowels in the word.

For the purposes of this exercise, the standard vowels are a, e, i, o, and u.

Variation

As long as you are counting values, count the number of y letters in the word as well. If a word has no standard vowels, indicate the number of y letters in the word.

Note that this doesn't always yield the correct number of vowel sounds in a word. The word why has a single vowel in it, the y. The word yellow has two vowels, e and o. The word mystery has three vowels it in: the e and the two ys.

It's tricky!

Variation

Instead of writing a program, write a class VowelCounter with a single method, countVowels(str) that counts the vowels in the String str and returns that result as an integer.