3-18 CurrencyFormat

posted Feb 1, 2014, 6:45 AM by Dlovan ismail   [ updated Feb 1, 2014, 6:48 AM by Karwan Jacksi ]
/*
This program demonstrates how to use the System.out.printf
method to format a number as currency.
*/

package currencyformat;

public class CurrencyFormat
{
    public static void main(String[] args) 
    {
            double monthlyPay = 5000.0;
            double annualPay = monthlyPay * 12;
            System.out.printf("Your annual pay is $%,.2f\n", annualPay);
    }  
}

ċ
CurrencyFormat.java
(0k)
Karwan Jacksi,
Feb 1, 2014, 6:45 AM
Comments