Programming Drill #14

Due: Thursday, June 12
Goal:  Read a text file

Can you think of any words that have more than 4 consecutive vowels?

In this drill you will write a program to answer this burning question.  To help you, here is a method that will return back the number of consecutive vowels in the String that is passed in.

	public static int numConsecutiveVowels(String s)
		if (s.length() == 0)
			return 0;

		int vowelCount = 0;
		int maxCount = 0;
		for (int i = 0; i < s.length(); i++)
			switch (s.charAt(i))
				case 'a':
				case 'e':
				case 'i':
				case 'o':
				case 'u':
					vowelCount = 0;
			if (vowelCount > maxCount)
				maxCount = vowelCount;
		return maxCount;

Use the WordFinder program given in the notes as a starting point.  The file word.txt with the list of English words is here:   words.txt

Modify the Word Finder program to call the numConsecutiveVowels method for each word that is read in. If the return value is greater than 4 then print out the word.