Page 1 of 1

• 8. Write a program that reads a file one character at a time and prints out how many times each of the vowels a e io u

Posted: Fri May 20, 2022 12:53 pm
by answerhappygod
8 Write A Program That Reads A File One Character At A Time And Prints Out How Many Times Each Of The Vowels A E Io U 1
8 Write A Program That Reads A File One Character At A Time And Prints Out How Many Times Each Of The Vowels A E Io U 1 (132.43 KiB) Viewed 26 times
• 8. Write a program that reads a file one character at a time and prints out how many times each of the vowels a e io u occur (in upper- or lowercase). Complete the following code. Vowels.java 1 import java.io.File; 2 import java.io.FileNotFoundException; 3 import java.io.PrintWriter; 4 import java.util.Scanner; 5 6 public class Vowels 7 { 8 public static void main(String[] args) throws FileNotFoundException 9 { 10 String vowels = "aeiou"; 11 int[] counters = new int [vowels. length()]; 12 13 Scanner console = new Scanner(System.in); 14 System.out.print("Input file: "); 15 String inputFileName = console.next(); 16 Scanner in = ...; 17 18 19 while (...) 20 { 21 String ch = : : : 22 int n = vowels.indexOf(ch.toLowerCase(); 23 24 } 25 26 in.close(); 27 28 for (int i = 0; i < vowels.length(); i++) 29 { 30 System.out.println(vowels.charAt(i) + ": " + counters); 31 } 32 33 }