Win a copy of Programmer's Guide to Java SE 8 Oracle Certified Associate (OCA) this week in the OCAJP forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Formatted output - any ideas?

 
Richard Chambers
Ranch Hand
Posts: 40
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 40
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic