This week's book giveaway is in the Agile and other Processes forum.
We're giving away four copies of The Mikado Method and have Ola Ellnestam and Daniel Brolund on-line!
See this thread for details.
The moose likes Beginning Java and the fly likes Formatted output - any ideas? Big Moose Saloon
  Search | Java FAQ | Recent Topics
Register / Login


Win a copy of The Mikado Method this week in the Agile and other Processes forum!
JavaRanch » Java Forums » Java » Beginning Java
Reply Bookmark "Formatted output - any ideas?" Watch "Formatted output - any ideas?" New topic
Author

Formatted output - any ideas?

Richard Chambers
Ranch Hand

Joined: Apr 03, 2008
Posts: 40
I'm not getting my expected output here.

I'm reading a CSV file for values

it's returning dollar amounts

I sum all the amounts after all the records are read

I've got all the programming down OK for the whole program

but the column is not getting my desired output

I'm wanting to output this format:

$999,999.99

I'm using this:



the problem is that my output staggers by one space

$999,999.99
$999,999.99
$999,999.99
$999,999.99


Thanks
Richard Chambers
Ranch Hand

Joined: Apr 03, 2008
Posts: 40
OK, I answered my own question

never fails, I struggle for hours, and
minutes after posting the solution hits me

it's only 8 digits, the comma and . don't count

8.2 instead of 10.2 makes it come out right

Thanks everyone
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Formatted output - any ideas?
 
Similar Threads
Happy Groundhog day........
DecimalFormat drops trailing zero
Validation error / unknown cause
problem in output format
line return in drawString()