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
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