eng
competition

Text Practice Mode

Java code type fast

created Feb 12th 2016, 19:05 by ghostTerminal


3


Rating

61 words
7 completed
00:00
public class yearlyPay_Java {
    public static void main(String[] args) {
         
        NumberFormat currencyUSD = NumberFormat.getCurrencyInstance(Locale.US); //Using Number Format setting USA
        currencyUSD.setMaximumFractionDigits(2); //Format setting max fractionDigits 2
        BigDecimal bd_weeksWorked = new BigDecimal("50"); //Create BigDecimals for anything money related
        BigDecimal bd_HoursInWeek = new BigDecimal("40");
        BigDecimal bd_payRate = new BigDecimal("10");
         
        BigDecimal bd_totalHours = bd_weeksWorked.multiply(bd_HoursInWeek); //Calculate hours in week
        BigDecimal bd_yearlyPay = bd_totalHours.multiply(bd_payRate); //Calculate yearly pay
         
        System.out.println("Yearly Base Pay: " + currencyUSD.format(bd_yearlyPay));  //Output yearly base: currency USD
    }
}

saving score / loading statistics ...