rules: can't use arrays. must use String Class and associated methods.
assignment:
#
specified line WIDTH. There are three possible formatted output for an input line. These are the LEFT-JUSTIFIED, RIGHT-JUSTIFIED, and CENTERED versions. Your program must use Java methods.
#
You can assume that the line WIDTH will be at least as long as the longest word in the input line -- in other words, you do not have to worry about splitting a word and hyphenating it.
#
In situations where a word or a line cannot be centered exactly, have the word or line start out one letter to the left.
#
You can assume the maximum line WIDTH will not exceed 80.
#
Multiple white spaces such as tabs and blanks should be compressed. Tabs are denoted by \t, and should be converted to spaces first. You can assume that punctuation marks such as , ! ? . ; are always next to a word, and never surrounded by white spaces by themselves.
example:
Welcome to the simple text formatter. Enter the line width: 21 Enter the text to be formatted: Misquotations are the only quotations that are never misquoted. Select a format: (L)eft-justified, (R)ight-justified, (C)entered, or (Q)uit c Sorry, that's not an option. Select a format: (L)eft-justified, (R)ight-justified, (C)entered, or (Q)uit C 123456789+123456789+1 Misquotations are the only quotations that are never misquoted. Select a format: (L)eft-justified, (R)ight-justified, (C)entered, or (Q)uit Q Bye!
my last two programs have been really simple in comparison, only involving scanning input and printing out messages and last one required using the for loop to produce an ascii triangle. I really have no idea where to begin on this one... if someone could give me an idea of how to approach it or something more that would be great. thanks

New Topic/Question
Reply




MultiQuote







|