Question: please write this program in java language! thank you :) The goal of this two-week lab is to write a program, NiftyPrint, for printing a
please write this program in java language! thank you :)





The goal of this two-week lab is to write a program, NiftyPrint, for printing a multiple-line text in such a way that each line of the generated output does not exceed a user-specified width. The text to print will be given as String data. We view the text to print as a sequence "words" separated by a nonempty character sequence consisting of ' ', '\t', and ' '. In generating the output lines, we want to place as many words as possible in any line. For this reason, each separator character sequence not containing the n' should be treated as a single ''. As for ' ', each occurrence of the character should be treated as the end of line. If there is a "word" that is longer than the width, that "word" should be printed in one single line. Three different formatting options should be considered: left-flush, right-flush, or center. We assign numbers 1, 2, and 3 to the three formatting options. The program must receive the desired formatting option from the user Here are a couple of examples. Suppose the input is: "All our love we pledge to you.In " + "Alma Mater, Stand forever, on Biscayne's wondrous shore." With the width set to 10 and with the center formatting, the text should be print as: All our love we pledge to you Alma Stand forever, on Biscayne's wondrous shore To show how many characters are inserted for indentation, let us change the leading whitespace characters with the equals signs having the same length. All our -love we The goal of this two-week lab is to write a program, NiftyPrint, for printing a multiple-line text in such a way that each line of the generated output does not exceed a user-specified width. The text to print will be given as String data. We view the text to print as a sequence "words" separated by a nonempty character sequence consisting of ' ', '\t', and ' '. In generating the output lines, we want to place as many words as possible in any line. For this reason, each separator character sequence not containing the n' should be treated as a single ''. As for ' ', each occurrence of the character should be treated as the end of line. If there is a "word" that is longer than the width, that "word" should be printed in one single line. Three different formatting options should be considered: left-flush, right-flush, or center. We assign numbers 1, 2, and 3 to the three formatting options. The program must receive the desired formatting option from the user Here are a couple of examples. Suppose the input is: "All our love we pledge to you.In " + "Alma Mater, Stand forever, on Biscayne's wondrous shore." With the width set to 10 and with the center formatting, the text should be print as: All our love we pledge to you Alma Stand forever, on Biscayne's wondrous shore To show how many characters are inserted for indentation, let us change the leading whitespace characters with the equals signs having the same length. All our -love we
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
