Question: Write a program in java which prompts the user for an input and output text file as well as an integer n which serves as

Write a program in java which prompts the user for an input and output text file as well as an integer n which serves as a line width. It should them read the text from the input file, reformat the text, and then print it to the output file. The reformatting should be as follows:

All lines should be exactly n characters long

Text in all but the last line should be both left and right justified. The last line should just be left justified.

Spaces used to create the right justification should be as uniformily spaced as possible

You must include in your comments in the program the method you used to uniformly distribute the spaces in the output. You should handle any FileNotFoundException without exiting the program.

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!