Menu

[solved]-Need Help Writing Java Program Textread Analyze Text File Two Commands User Select Specifi Q39094989

I need help writing a java program (textread) that will analyzea text file.

Here are the two commands that the user can select:
-a <string> : If specified, will add the number of times thestring appears to the start of each line within the file.
-b <int>: If specified, will output the word duplicated themost. If pos int is provided, the number of most common words willbe shown in the output, starting with the most common.
If none of the commands are selected, the program will output thelongest line in the file.

Example 1:
textread fileA.txt
File Content:
door room room 4
room room

Output: “door room room 4”

Example 2:
textread -b 2 -a “oom” fileB.txt
File content:
door door room room 4
room room

Result file:
2 door door room room 4
2 room room

Output: “room door”

Example 3:
textread -b fileB.txt
File content:
door door room room 4
room room

Output: “room”

Expert Answer


Answer to I need help writing a java program (textread) that will analyze a text file. Here are the two commands that the user can… . . .

OR


Leave a Reply

Your email address will not be published. Required fields are marked *