Solved

round up a double to two decimal places

Posted on 2007-04-09
4
3,051 Views
Last Modified: 2008-01-09
Is there a way to round to the hundreds spot in a double?  I am adding nickels dimes and quarters and sometimes I get some screwy number, I need to display this in a total window (text field) as money is deposited/deducted but I don't see an easy way to do this, I was just hopnig I missed it.

Thanks
0
Comment
Question by:urobins
  • 2
  • 2
4 Comments
 
LVL 92

Accepted Solution

by:
objects earned 500 total points
ID: 18879732
Use a DecimalFormat when displaying it:

http://www.objects.com.au/java/qa/1647357140.html
0
 

Author Comment

by:urobins
ID: 18879756
What library do I need to use to do this?
0
 
LVL 92

Expert Comment

by:objects
ID: 18879782
java.text
0
 

Author Comment

by:urobins
ID: 18879789
Thanks I just found it :)

once again you have answered my question with ease... I really appreciate it!
0

Featured Post

MS Dynamics Made Instantly Simpler

Make Your Microsoft Dynamics Investment Count  & Drastically Decrease Training Time by Providing Intuitive Step-By-Step WalkThru Tutorials.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
Maven Project: Hibernate Dependencies Conflict 10 53
how to debug htl and js pages 8 58
import as existing maven project 3 41
American Express @Work site and Java 4 68
By the end of 1980s, object oriented programming using languages like C++, Simula69 and ObjectPascal gained momentum. It looked like programmers finally found the perfect language. C++ successfully combined the object oriented principles of Simula w…
In this post we will learn how to make Android Gesture Tutorial and give different functionality whenever a user Touch or Scroll android screen.
Viewers will learn about if statements in Java and their use The if statement: The condition required to create an if statement: Variations of if statements: An example using if statements:
This tutorial covers a practical example of lazy loading technique and early loading technique in a Singleton Design Pattern.

726 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question