Anyone knows how to create a java program?
-
Many word processing applications require text to be left justified and formatted in such a way that no line has length exceeding the width of the text area. Words, that is, sequences of characters containing no white space, cannot be split across lines. To simplify this problem, we can assume that all characters have equal width and that a line has a fixed number of columns. If the number of columns in a line is 10, for example, then the text: Now is the time for all good people to come to the aid of their country. No one should be exempted, I say. would be reformatted as: Now is the time for all good people to come to the aid of their country. No one should be exempted, I say. If the number of columns is 20, the output is: Now is the time for all good people to come to the aid of their country. No one should be exempted, I say. Any word that is too long to fit on a line will be on a line by itself. Write a program whose input is a sequence of words read from a source file called “unjustified.txt” and whose output is that same sequence, justified to fit lines that have 20 columns. Keep in mind that the input sequence of words may span multiple lines in the source file with each line being composed of any number of words per line. Your program should be submitted as Justify.java. Magic number alert!!! The number 20 should not appear anywhere in your program, except as the value of a constant declared at the beginning; in other words, write your program so that changing the number of columns will be easy to do. You may want to keep several test input files as you refine your program.
-
Answer:
This will be helpful http://www.koders.com/java/fidC7AACD4F15C5DB29CCE416CC0DE48316AFA2A36B.aspx?s=string#L152 Hope this helps Cheers:)
Moe K at Yahoo! Answers Visit the source
Related Q & A:
- Does anyone knows how TeamViewer gets screen capturing?Best solution by Super User
- how to Create a Java Package from MATLAB Code?Best solution by Stack Overflow
- how to create a new syntax in java?Best solution by Stack Overflow
- How to create a java applet?Best solution by Stack Overflow
- How to create a simple counter program?Best solution by Stack Overflow
Just Added Q & A:
- How many active mobile subscribers are there in China?Best solution by Quora
- How to find the right vacation?Best solution by bookit.com
- How To Make Your Own Primer?Best solution by thekrazycouponlady.com
- How do you get the domain & range?Best solution by ChaCha
- How do you open pop up blockers?Best solution by Yahoo! Answers
For every problem there is a solution! Proved by Solucija.
-
Got an issue and looking for advice?
-
Ask Solucija to search every corner of the Web for help.
-
Get workable solutions and helpful tips in a moment.
Just ask Solucija about an issue you face and immediately get a list of ready solutions, answers and tips from other Internet users. We always provide the most suitable and complete answer to your question at the top, along with a few good alternatives below.