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
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started