aspose file tools*
The moose likes Java in General and the fly likes Data type for currency computations Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Java in General
Bookmark "Data type for currency computations" Watch "Data type for currency computations" New topic
Author

Data type for currency computations

DANIELA PINES
Greenhorn

Joined: Jun 25, 2003
Posts: 8
What would be the best programming practice with regards to data type used for currency calculations in Java?
Michael Morris
Ranch Hand

Joined: Jan 30, 2002
Posts: 3451
Hi Mr/Ms FRUIT,
Welcome to JavaRanch, the absolute best site on the www for Java information. We don't have many rules around here, but we do have one. Please change your display name to a first and last name to comply with the JavaRanch Naming Policy. You can change it here. Thank you for your cooperation.


Any intelligent fool can make things bigger, more complex, and more violent. It takes a touch of genius - and a lot of courage - to move in the opposite direction. - Ernst F. Schumacher
Stan James
(instanceof Sidekick)
Ranch Hand

Joined: Jan 29, 2003
Posts: 8791
Here's the classic Test Infected paper that uses multiple currencies as an example to demonstrate JUnit and test-first practices. It might help you think about currency issues, and certainly has some good ideas about testing and coding.
There is a Currency class in Java, but I'm not really sure what it's good for yet.


A good question is never answered. It is not a bolt to be tightened into place but a seed to be planted and to bear more seed toward the hope of greening the landscape of the idea. John Ciardi
Trond Hundstuen
Greenhorn

Joined: Jul 10, 2003
Posts: 3
java.math.BigDecimal is the best suited for monetary calculations.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Data type for currency computations