Paragraph Justification

Supporting files:

FileManager.java

Objectives:

In most professionally designed books and newspapers, English text is printed "justified" - that is, the words are spaced out so that they line up on both the left and the right. Your job in this assignment is to write a program that accepts regular ASCII text and produces a justified version of the same.

For example, your program might be given the following file.

Four score and seven years ago our fathers brought forth, on this continent,
a new nation, conceived in Liberty, and dedicated to the proposition
that all men are created equal.

Now we are engaged in a great civil war, testing whether that nation,
or any nation so conceived, and so dedicated, can long endure.
We are met on a great battle-field of that war. We have come to dedicate
a portion of that field, as a final resting-place for those who here gave their
lives, that that nation might live. It is altogether fitting and proper
that we should do this.
The program would create a justified version of the file, such as the following.
Four score and seven years ago our fathers  brought  forth,  on  this continent,
a  new  nation,  conceived  in  Liberty,  and   dedicated   to   the proposition
that all men are created equal.

Now  we  are  engaged  in  a  great  civil  war,  testing  whether  that nation,
or   any   nation   so   conceived,   and   so   dedicated,   can   long endure.
We are met on a great  battle-field  of  that  war.  We  have  come  to dedicate
a portion of that field, as a final resting-place for those who here  gave their
lives, that  that  nation  might  live.  It  is  altogether  fitting  and proper
that we should do this.
Notice that the final sentence in a paragraph is not justified; paragraph breaks are signified by blank lines.

The "standard length" of a line will either be 80 characters or the length of the longest line in the input file, whichever is larger. For a line shorter than the standard length, your program will have to insert extra spaces in the output version of that line (unless it is just before a paragraph break or is a paragraph break itself). These extra spaces should be inserted adjacent to existing spaces in the line. Try to distribute the extra spaces as evenly as possible in the line. It will not be possible for the distribution to be perfectly even, but get as close as you can.

Access the files using the FileManager class distributed with the assignment; you can prompt the user for the files using its promptUser class method. You will also need to use the String class, and you may find the ArrayList class convenient for storing the lines of your document in memory.