I am using this function,but I am getting the result as 1,200.00.Can someone
please tell me what changes I have to make to get the desired results.Thanking you in
Originally posted by Pete Tyo:
I want a class that I created to return a currency format i.e. (30.00 just two decimals at the end for cents) I have the print statement put the $ and dollars at the end.. The problem I am running into is using the below code suggested in this thread. My value is a double how to I convert it to a string? And is there anything in the main program I have to change since I will be passing back a string instead of a double?
Instead of using DecimalFormat(), you could use String.format(), something like this:
It's a bit of a shortcut, but it would leave myValue untouched for further use, and still produce the desired output format.