?
Solved

round up a double to two decimal places

Posted on 2007-04-09
4
Medium Priority
?
3,065 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
  • 2
4 Comments
 
LVL 92

Accepted Solution

by:
objects earned 2000 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

Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

After being asked a question last year, I went into one of my moods where I did some research and code just for the fun and learning of it all.  Subsequently, from this journey, I put together this article on "Range Searching Using Visual Basic.NET …
Introduction Java can be integrated with native programs using an interface called JNI(Java Native Interface). Native programs are programs which can directly run on the processor. JNI is simply a naming and calling convention so that the JVM (Java…
This tutorial covers a step-by-step guide to install VisualVM launcher in eclipse.
Viewers will learn how to properly install Eclipse with the necessary JDK, and will take a look at an introductory Java program. Download Eclipse installation zip file: Extract files from zip file: Download and install JDK 8: Open Eclipse and …
Suggested Courses
Course of the Month7 days, 20 hours left to enroll

765 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