Results 1 to 1 of 1
Thread: Formatting a number to currency
-
Formatting a number to currency
Java Code: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)); } }"The sole cause of man’s unhappiness is that he does not know how to stay quietly in his room." - Blaise Pascal
Similar Threads
-
formatting..
By sireesha in forum New To JavaReplies: 16Last Post: 06-26-2009, 07:11 PM -
formatting String
By bugger in forum New To JavaReplies: 1Last Post: 11-16-2007, 07:27 PM -
Setting currency
By Java Tip in forum Java TipReplies: 0Last Post: 11-16-2007, 02:08 PM -
Correct Number formatting
By paul in forum New To JavaReplies: 1Last Post: 08-07-2007, 04:59 AM -
Formatting the date
By yuchuang in forum New To JavaReplies: 5Last Post: 05-07-2007, 06:08 PM


LinkBack URL
About LinkBacks
Reply With Quote
Bookmarks