title: Connecting a string input to a switch with charAT
body: <p>I've been stuck on an assignment that I've been working on for a few days (note I'm totally new to java so I'm still learning from the ground up.) I'm trying to make an algorithm that reads the given text file and prints out how many of each vowel there is as well as consonants. It must follow these rules
  Read the text from the file AdventuresInWonderland.txt.
  Use a single while loop to read the lines of the file.
  Use a single for loop to iterate over the characters in each line.
  Use a single switch statement to determine which counter to increment.</p>
  <p>I've made it this far but I can't figure out what I've done wrong I'm specifically having issues around the vowels = line.charAt(count)
  Any tips or help would be extremely appreciated.</p>
  <pre><code>import java.io.File;
  import java.io.FileNotFoundException;
  import java.util.Scanner;
  
  class Main {
  
  public static void main(String[] args) throws FileNotFoundException {
  File file = new File(&quot;AdventuresInWonderland.txt&quot;);
  Scanner sc = new Scanner(file);
  
  int countA = 0;
  int countE = 0;
  int countI = 0;
  int countO = 0;
  int countU = 0;
  int countConsonants = 0;
  char vowels;
  int count;
  
  while (sc.hasNext()) {
    String line = sc.nextLine().toLowerCase();
    
    for (count = 0; count &lt; line.length(); count++);
    }
      vowels = line.charAt(count);
      switch(vowels)
        {
          case 'a':
            countA++;
            break;
  
          case 'e':
            countE++;
            break;
  
          case 'i':
            countI++;
            break;
  
          case 'o':
            countO++;
            break;
  
          case 'u':
            countU++;
            break;
  
          case 'b':
            countConsonants++;
            break;
  
          case 'c':
            countConsonants++;
            break;
  
          case 'd':
            countConsonants++;
            break;
  
          case 'f':
            countConsonants++;
            break;
  
          case 'g':
            countConsonants++;
            break;
  
          case 'h':
            countConsonants++;
            break;
  
          case 'j':
            countConsonants++;
            break;
  
          case 'k':
            countConsonants++;
            break;
  
          case 'l':
            countConsonants++;
            break;
            
          case 'm':
            countConsonants++;
            break;
  
          case 'n':
            countConsonants++;
            break;
  
          case 'p':
            countConsonants++;
            break;
  
          case 'q':
            countConsonants++;
            break;
  
          case 'r':
            countConsonants++;
            break;
  
          case 's':
            countConsonants++;
            break;
  
          case 't':
            countConsonants++;
            break;
  
          case 'v':
            countConsonants++;
            break;
  
          case 'w':
            countConsonants++;
            break;
  
          case 'x':
            countConsonants++;
            break;
  
          case 'y':
            countConsonants++;
            break;
  
          case 'z':
            countConsonants++;
            break;
  
            
        }
          System.out.println (&quot;Vowels found: &quot;);
          System.out.println (&quot;a: &quot; +countA);
          System.out.println (&quot;e: &quot; +countE);
          System.out.println (&quot;i: &quot; +countI);
          System.out.println (&quot;o: &quot; +countO);
          System.out.println (&quot;u: &quot; +countU);
          System.out.println (&quot;Consonants: &quot; + countConsonants);
  
  }
      }
  </code></pre>