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

Program description: Write a Java program name word.java toread the input from a

ID: 3610654 • Letter: P

Question

Program description:

Write a Java program name word.java toread the input from a file and output the results toboth an output file and the screen.The input file name must be supplied by theuser and the output file must be namedoutput.txt, to be supplied inside of yourprogram as part of the code, i.e. it is "built in" inside of theprogram .

Requirements:

<!--[if !supportLists]-->1.    <!--[endif]-->The program must test to see if the files areopened. If not successful upon opening the files, it must print thefollowing message and terminate then program.
            

C:java word [PressENTER]
The file you entered either do not exist or the name is spelledwrong. Goodbye!

<!--[if!supportLists]-->2.    <!--[endif]-->After opening both input file and output filesuccessfully, the program will do the following with the data thatis in the input file.

<!--[if!supportLists]-->3.    <!--[endif]-->Output all of these values both on the screenand in the output file.

Explanation / Answer

please rate - thanks import java.util.*; import java.io.*; public class word{ public static void main(String[] args)throwsFileNotFoundException {String filename,input; int lcount=0,vcount=0,pcount=0,ccount=0,wcount=0,scount=0; int i,j; char ch; char vowel[]={'A','a','E','e','I','i','O','o','U','u'}; char punct[]={'.','!',',','?',':',';'}; char white[]={' ',' ',' '}; Scanner in=new Scanner(System.in); System.out.print("Enter input file name: "); filename=in.next(); try{PrintStream foutput=new PrintStream(newFile("output.txt"));    Scanner finput=new Scanner(newFileReader(filename));    if(!finput.hasNext())       {System.out.println(filename+"empty-program aborting");       System.exit(1);        }    while(finput.hasNextLine())       {input=finput.nextLine();         wcount++;        for(i=0;i
Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Chat Now And Get Quote