Question: Please provide answer in Java :) Write a program Reverse.java that reads the name of a text file from a command line argument and then

Please provide answer in Java :)

Write a program Reverse.java that reads the name of a text file from a command line argument and then proceed to write a new file that reverses every word in the file and writes it to a new file with the same name as the original with REV prefaced to the name. Suppose we have the following text in a file called C:/info/poem.txt.

The woods are lonely dark and deep

But I have promises to keep

If provided C:/info/poem.txt as a command line argument, then a new file C:/info/REVpoem.txt should will be created that has the following lines.

ehT sdoow era ylenol krad dna peed

tuB I evah sesimorp ot peek

Your program should exit with an appropriate error message and program status 1 if no command line arguments are provided. The program will exit with an appropriate error message and program status of 2 if the given file does not exist.

Thanks in advance for any help!

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!