Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

round up a double to two decimal places

Posted on 2007-04-09
4
Medium Priority
?
3,070 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

Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

Question has a verified solution.

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

For beginner Java programmers or at least those new to the Eclipse IDE, the following tutorial will show some (four) ways in which you can import your Java projects to your Eclipse workbench. Introduction While learning Java can be done with…
In this post we will learn different types of Android Layout and some basics of an Android App.
Viewers learn about the “for” loop and how it works in Java. By comparing it to the while loop learned before, viewers can make the transition easily. You will learn about the formatting of the for loop as we write a program that prints even numbers…
The viewer will learn how to implement Singleton Design Pattern in Java.
Suggested Courses

636 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