|
Formatting a number to currency
import java.text.NumberFormat;
public class Mortgage {
public static void main(String[] args) {
double payment = Math.random() * 1000;
System.out.println("Your payment is ");
NumberFormat nf = NumberFormat.getCurrencyInstance();
System.out.println(nf.format(payment));
}
}
__________________
Want to make your IDE the best? To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts.
To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts. to our beloved Java Forums! (closes on July 27, 2008)
|