Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

Need help with java. Thank you 9. Complete the following program which is suppos

ID: 3793554 • Letter: N

Question

Need help with java. Thank you 9. Complete the following program which is supposed to count the number of lines, number of words and the number of vowels o,ujin a file. Some codes are missing. Insert ALL of the missing code. DO NOT CHANGE THE CoDE TO USE THE SCANNER METHoD. Cie points) import jpb. public class InputFile public static void main(String0 args) String line- fileName System out println("Enter the file name to get input from: fileName Simplelo.readline0; int wordcount-o; Buffered Reader input- new BufferedReader(new FileReader(fileName); while(input ready0) line input readLine0, linecount++;

Explanation / Answer

Hi buddy, plase find the below Console java program. You can make changes in the program

import java.util.*;
import java.lang.*;
import java.io.*;

class Main
{
public static void main (String[] args) throws java.lang.Exception
{
  
String line = " ";
int lineCount = 0,words = 0,vowels=0;
BufferedReader input = new BufferedReader(new InputStreamReader(System.in));
try{
while(input.ready()){
line = input.readLine();
lineCount++;
String str[] = line.trim().split(" ");
words = words + str.length;
for(int i=0;i<str.length;i++){
for(int j=0;j<str[i].length();j++){
char ch = str[i].charAt(j);
if(ch=='a'||ch=='e'||ch=='i'||ch=='o'||ch=='u'){
vowels++;
}
}
}
}
System.out.println("Total number of lines are "+lineCount);
System.out.println("Total number of words are "+words);
System.out.println("Total number of vowels are "+vowels);
}
catch(IOException io){
  
}
}
}

INPUT: :

OUTPUT :