|
-
August 10th, 2010, 09:28 PM
#1
converting a double to currency value
All,
I have an issue which I need some help on. I have a web app which the user input an amount into a text field (in this format: 00.00) which is passed to the form as a string. I use double.parse double so I can assign it to a currency value. I have posted some code which doesn't give me any warning:
double partialAmount = Double.parseDouble(reversePartialPayment
.getPartialAmount().trim());
currency.aQuantity = partialAmount;
aQuantity is a double as well. Here is my issue currency.aQuantity is passed to another class which is looking for currency and not a double. Is there a way to convert/cast the double to currency or another way around the problem? Everything I have read said using doubles for currency is a bad idea. Since I have the number formatted the way I want it, my thinking was it shouldn't be a problem. If I'm heading the wrong direction with the double cast, please point me in the right direction. Thanks in advance.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|