|
-
March 31st, 2011, 11:58 PM
#7
Re: Help needed! Calculating weekly pay with if else
To print out the double value to two decimal places:
First:
import java.util.DecimalFormat;
Then create a new format object:
DecimalFormat frmt = new DecimalFormat("0.00");
Then to print out:
//doubleValue is the double you wanted to be formatted
System.out.println("Salary: " + frmt.format(doubleValue));
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
|