• 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

Business, Finance, Economics, Accounting, Operations Management, Computer Science, Electrical Engineering, Mechanical Engineering, Civil Engineering, Chemical Engineering, Algebra, Precalculus, Statistics and Probabilty, Advanced Math, Physics, Chemistry, Biology, Nursing, Psychology, Certifications, Tests, Prep, and more.
Post Reply
answerhappygod
Site Admin
Posts: 899603
Joined: Mon Aug 02, 2021 8:13 am

• 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

Post 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 24 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 }
Join a community of subject matter experts. Register for FREE to view solutions, replies, and use search function. Request answer by replying!
Post Reply