public class NumFormat {
public static void main (String [] args ){
int quarter = 2;
int dollars = 3;
double total = dollars + quarter * 0.25;
final double TAX_RATE = 8.5;
double tax = total * TAX_RATE ;
NumberFormat formatter = NumberFormat.getNumberInstance ();
formatter.setMaximumFractionDigits (2);
System.out.println ("Totali:$" + total);
System.out.println ("Taksa: $" + formatter.format (tax));
}
}
andi-dev
0
Light Poster
Recommended Answers
Jump to Postand what is the 'LITTLE PROBLEM' you are referring to?
a suggestion: let your title describe the type of issue. don't make us guess as to what the problem is, make it clear in your post.
provide all information: does it produce unexpected output? what do you expect? what do …
All 4 Replies
stultuske
1,116
Posting Maven
Featured Poster
ishaan3731
-3
Newbie Poster
jwenting
1,889
duckman
Team Colleague
Doogledude123
45
Posting Whiz
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.