Menu

[solved]-Need Help Writing Java Program Textutil Analyzes Text File Input 3 Commands R S M R Add Nu Q39037002

I need help writing a java program (textutil) that analyzes atext file input. There are 3 commands  -r <string>or -s<integer> or -m<integer>.  

“-r <string>” will add the number times the string appearswithin the line to the start of each line within the text file.

“-s<integer>” will only keep the shortest integer lines inthe file depending on <integer> input.

“-m<integer>” will only keep the longest integer lines inthe file depending on <integer> input.

-s and -m are mutually exclusive.

If none are selected, textutil will output the longest line ofthe file.

Example 1:

textutil -m 2 fileA.txt

Input text:

house house house pool

pool house house

pool pool pool

Result text:

house house house pool

pool house house

Example 2:

textutil -r “h” -m 1 fileA.txt

Input text:

house house house pool

pool house house

pool pool pool

Result text:

3 house house house pool

Expert Answer


Answer to I need help writing a java program (textutil) that analyzes a text file input. There are 3 commands -r or -s or -m. “-r … . . .

OR


Leave a Reply

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