Question: Write a program that reads a file a character at a time and prints out how many times the vowels a e i o u
Write a program that reads a file a character at a time and prints out how many times the vowels a e i o u occur (in upper- or lowercase).
Complete the following file:
Vowels.java
import java.io.File; import java.io.FileNotFoundException; import java.io.PrintWriter; import java.util.Scanner;
public class Vowels { public static void main(String[] args) throws FileNotFoundException { String vowels = "aeiou"; int[] counters = new int[vowels.length()];
Scanner console = new Scanner(System.in); System.out.print("Input file: "); String inputFileName = console.next();
. . .
for (int i = 0; i < vowels.length(); i++) { System.out.println(vowels.charAt(i) + ": " + counters[i]); } } }
(The "..." is where code needs to be added)
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
