filmov
tv
Java Practice It || 6.11 wordWrap3 || file processing, nested while loop, .subString(), .charAt()

Показать описание
Problem:
How to use .substring() video:
How to use .lastIndexOf():
Question:
Modify the preceding wordWrap method into a new wordWrap3 method that wraps only whole words, never chopping a word in half. Assume that a word is any whitespace-separated token and that all words are under 60 characters in length. Make sure that each time you wrap a line, the subsequent wrapped line(s) each begin with a word and not with any leading whitespace. Accept only a single parameter for the input Scanner, and send your method's output to the console, as in the original wordWrap problem; do not use an output file as was done in wordWrap2.
How to use .substring() video:
How to use .lastIndexOf():
Question:
Modify the preceding wordWrap method into a new wordWrap3 method that wraps only whole words, never chopping a word in half. Assume that a word is any whitespace-separated token and that all words are under 60 characters in length. Make sure that each time you wrap a line, the subsequent wrapped line(s) each begin with a word and not with any leading whitespace. Accept only a single parameter for the input Scanner, and send your method's output to the console, as in the original wordWrap problem; do not use an output file as was done in wordWrap2.