Hi,
I want my output to show to two decimals.If the output is $6.075,instead of bring it to $6.08,i prefer it showed $6.07.How am i able to do this?
I used the below System.Out but kept getting $6.08. System.out.printf("%s%.2f\n","State Withholding(9.0%):$",stateWithholding);
Thank You :)
Valiantangel
0
Newbie Poster
Recommended Answers
Jump to PostDo you just want to display the result rounded down to 2 dec places, or do you need to perform the calculation and round down that result to2 dec places before doing anything else (eg storing or printing it)
All 4 Replies
JamesCherrill
4,733
Most Valuable Poster
Team Colleague
Featured Poster
Valiantangel
0
Newbie Poster
JamesCherrill
4,733
Most Valuable Poster
Team Colleague
Featured Poster
hfx642
Be a part of the DaniWeb community
We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.