![]() |
| ||
| How do you output in two columns? Annual Interest Rate Monthly Payment 11.00 952.32 11.25 971.26 11.50 990.29 11.75 1009.41 12.00 1028.61 I've done the hard part and completed the project, but I can't figure out how to get my program to output in two columns like above. Since this site doesn't take spacing, black column is one column and the red is the other column. Do you just wing it and add a bunch of spaces in or is there a proper way to do it? |
| ||
| Re: How do you output in two columns? The Java Tutorials - String Quote:
|
| ||
| Re: How do you output in two columns? That method is pretty similar to the printf() method of String. What you could also do is, if you only have a couple of things, you could tab them, ie: System.out.println( "Blah\tBlah" ); would give you an output like: Blah Blah |
| ||
| Re: How do you output in two columns? As long as the first String is always of the same length and does not vary over the "tabStop index" length. printf (if you're using a late enough version of it) is, of course, the proper way to do this. |
| ||
| Re: How do you output in two columns? This is a lot easier than when I first looked at it. I made the first column stuff string and took there length, then from that added the necessary spaces. Kind of easy. Thanks for the help. |
| All times are GMT -4. The time now is 7:08 am. |
Forum system based on vBulletin Copyright ©2000 - 2009, Jelsoft Enterprises Ltd.
©2003 - 2009 DaniWeb® LLC