title: Finding a word with the most consecutive vowels in a text file, using Java
body: <p>I have a problem in Java that must be solved without anything but the most basic code. It cannot include arrays, and I can't really import anything other than what's showing in my code. The question is this:</p>
  
  <p>The file words.txt on the book’s website contains 87,314 words from the English language.
  Write a program that reads through this file and finds the word that has the most consecutive vowels.</p>
  
  <p>I'm brand new to programming, so I've got some ideas of what to do but not precisely how to put it all together. I'm really stuck on this question. Any help would be much appreciated.</p>
  
  <p>Here's what I've come up with, but it's clearly incorrect, and I've already spent many hours on it, including researching here and other places, and trying the code I found. I'm not expecting anyone to do the homework for me, but if you could give me some guidance, it would be very much appreciated. Here's what I have so far:</p>
  
  <pre><code>package vowels;
  
  import java.util.Scanner;
  import java.io.FileInputStream;
  import java.io.FileNotFoundException;
  
  public class Vowels
  {
      public static void main(String[] args)
      {
          Scanner fileIn = null;
          try
          {
              fileIn = new Scanner(new FileInputStream("words.txt")); 
          }
          catch (FileNotFoundException e)
          {
              System.out.println("File not found");
              System.exit(0);
          }
          String eachWord = fileIn.next();
          String mostConsecutiveVowels = "";
          int w = 0;
          int z;
          int consecutiveVowels = 0;
          int mostConsecutiveVowelsInWord = 0;
          int wordWithMostConsecutiveVowels = 0;
          boolean vowel;
          boolean previousVowel;
          boolean mostVowels;
  
          while (fileIn.hasNext())
          {
              while(consecutiveVowels &gt;= mostConsecutiveVowelsInWord)
              {
                  mostVowels = true;
              }
  
              char a = eachWord.charAt(w);
              if (a=='a'||a=='e'||a=='i'||a=='o'||a=='u')
              {
                 consecutiveVowels++;
                 consecutiveVowels = mostConsecutiveVowelsInWord;
              }
  
  
              for(z = 1; z &lt;= eachWord.length(); z++)
              {
                  char b = eachWord.charAt(z);
                  char c = eachWord.charAt(z-1);
  
                  while (b=='a'||b=='e'||b=='i'||b=='o'||b=='u')
                  {
                      vowel = true;
                  }
  
                  while (c=='a'||c=='e'||c=='i'||c=='o'||c=='u')
                  {
                      previousVowel = true;
                  }
  
                  if (vowel = false &amp;&amp; previousVowel = true &amp;&amp; mostVowels = false;)
                  {
                      consecutiveVowels = 0;
                  }
                  else if (vowel = false &amp;&amp; previousVowel = true &amp;&amp; mostVowels = true;)
                  {
                      consecutiveVowels = mostConsecutiveVowelsInWord;
                  }
                  else if (vowel = true &amp;&amp; previousVowel = false)
                  {
                      consecutiveVowels = 1;   
                  }
                  else if (vowel = true &amp;&amp; previousVowel = true &amp;&amp; mostVowels = true;)
                  {
                      consecutiveVowels++;
                      consecutiveVowels = mostConsecutiveVowelsInWord;
                  }
                  else if (vowel = true &amp;&amp; previousVowel = true &amp;&amp; mostVowels = false;)
                  {
                      consecutiveVowels++;
                  }
              }
          }
          if (mostVowels)
          {   
              if(eachWord.length()&gt;mostConsecutiveVowels.length())
              {
                  mostConsecutiveVowels = eachWord;
              }
          }
              System.out.println("The word in words.txt with the most consecutive vowels is " + mostConsecutiveVowels);
                  fileIn.close();
      } 
  }
  </code></pre>