import java.io.BufferedReader; import java.io.InputStreamReader; import java.io.File; import java.io.FileReader; import java.io.FileNotFoundException; class Vowels { public static void main(String[] args) throws java.io.IOException{ int VA = 0; int VE = 0; int VI = 0; int VO = 0; int VU = 0; int NV = 0; try{ File f=new File("input.txt"); FileReader file = new FileReader(f); BufferedReader input = new BufferedReader(file); //I miss unix pipes, they make life so much nicer int c = 0; while((c = input.read()) != -1){ char character = (char) c; switch(character){ case 'A': VA++; break; case 'a': VA++; break; case 'E': VE++; break; case 'e': VE++; break; case 'I': VI++; break; case 'i': VI++; break; case 'O': VO++; break; case 'o': VO++; break; case 'U': VU++; break; case 'u': VU++; break; default: NV++; break; }} System.out.println("A " + VA); System.out.println("E " + VE); System.out.println("I " + VI); System.out.println("O " + VO); System.out.println("U " + VU); System.out.println("No Vowels " + NV); }catch(FileNotFoundException e) { System.out.println("No Inputfile Provided"); } } } //By msglm; Licensed under the AGPL v3