Problem Statement:
Implement the function justify in the file [login to view URL] to perform left and right justification on a text input of type string. The justified text is a vector of strings (see new type PARA in justify.h). Text justification is a part of typesetting, where a ragged text is transformed into a text that neatly fits into a column of given width.
The assumptions for the input text are as follows:
1. The input text is a single unjustified string terminated by a null (‘\0’) character.
2. The input text consists only of alphabets (lower and upper case), blank spaces (‘ ‘), and two punctuation
marks (periods (‘.’), and commas (‘,’)).
3. Every word in a sentence in the input text is separated by a single blank space.
4. The punctuation marks immediately follow the last character of the preceding word, and a single space
is present between a punctuation mark and the following word.
5. There are no new line characters in the input string.
We will perform a very primitive form of justification in this assignment using the following rules:
1. Every line in the justified text must have at least width – 2 characters, with the exception of the last line, which may have fewer characters.
2. Every line in the justified text must have at most width characters, with the exception of lines that terminate with a punctuation mark (period or comma). In such cases, the line may have width+1 characters to accommodate the trailing punctuation mark.
3. Every line in the justified text must start with an alphabet (word). The first character in a line cannot be a punctuation mark or space.
4. If a word needs to be split across lines in order to follow the above rules, a hyphen (‘-‘) character must be inserted after the first part of the word. The hyphen character counts toward the total number of characters in a line.
Development Methodology
You are given four C++ source files in an archive. Extract the archive on your PC (or Linux server) and change into the directory. Inside you will find the following files:
1. studentID.h: This file should contain your student ID. For now, it has a placeholder value “123456”. Please put your student ID here. It is very important that you change the value to your correct student ID, otherwise we will deduct 1 point from your score, because a missing ID causes significant burden for testing your program and evaluating your grade.
2. justify.h: This is a header file that defines error codes, PARA type and useful macros. Do not edit or submit this file.
3. [login to view URL]: This is the file where the justify function must be implemented. You must edit and submit this file.
4. [login to view URL]: This is the file where the main function, used for testing the program, resides. You should NOT submit this file, although you may choose to modify it for testing.
Hello 20+ years of C++ experience, 10 years as freelancer 300+ projects completed.
> I´ll send you a full tested and documented program (in code). No external documentation.
> Unlimited cycles of revision in the agreed time period.
> Full advice about the best way to do the implementation.
Please contact me to discuss the details.
Thanks.