Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Write a java application that will open an input file and open an output file. The file names can be entered from the command line,
Write a java application that will open an input file and open an output file. The file names can be entered from the command line, if a command line parameter is included, it will be used as the input file name. If a second command line parameter is included, it will be used as the output file name. Any missing parameters will be prompted for and read by the program. When the input file does not exist the user will be prompted to reenter an input file name. When nothing is entered for the input file name, on a prompt, the program will proceed to the end of the program and terminate. DO NOT USE ANY BREAKS OR EXITS. The program will continue until a va;id input file name is entered or the user decided to quit. When the output file exists the user will have a choice of entering a new output file name, backing up the existing output file first, overwriting the existing output file, or quitting the program without opening any files. Again, not entering a file name will also terminate the program. The program will catch any file open error and print a message.
Using StringTokenizer, the program will parse the input file and identify words and integers. Words are not case sensitive and can only contain letters, apostrophes, hyphens, and digits but must start with a letter. The numbers are a sequence of digits. They can be positive or negative integers. If the number is negative, there is no space between the negative sign, and the first digit. A sum will be made form the integers contained in the input file.
An object will be created for each unique word. This object will contain the word and a count. The count will represent the total number of times the word occurred in the input file. These objects will be stored in an array with a maximum size of
The output file will contain each unique word and it's count. The list will be the order in which the words were encountered. At the end of the file the total number of unique words will be printed followed by the sum of the integers. Appropriate messages and headings will be provided in the output file.
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