So with the help of you guys earlier in the week a program was written to "line justify" an input text. Now I have to use an input file and justify that by making every line exactly 75 characters long (keep this value in a named constant). To get to this line length, extra space is first added after punctuation marks. You need to consider only these marks: .,!?; That is, every punctuation mark may be followed by two spaces. If the spaces after punctuation marks are added and the line is still less than 75 characters, additional spaces are added after random words in the line.
The output file should be named "Justified.txt"
1 2 3 4 5 6 7 8 9 10
//input file
Is Lorem Ipsum just dummy text of the printing and typesetting
industry? Lorem Ipsum has been the industry's standard dummy text
ever since the 1500s, when an unknown printer took a galley of type
and scrambled it to make a type specimen book. It has survived not
only five centuries, but also the leap into electronic typesetting,
remaining essentially unchanged. It was popularised in the 1960s
with the release of Letraset sheets containing Lorem Ipsum passages,
and more recently with desktop publishing software like Aldus
PageMaker using Lorem Ipsum.
Have a closer look at line 20.
Do you really want to replace your input with an empty string?
On line 25 the condition will always be false since you never put anything into the s.
Also lines 16 and 46 are redundant, the constructor will open the file automatically.