I have been working with an online class and have this project to complete. I have everything working, Except the deicmals.. (ie. if I have $478.00 I only get $478.0 printed). What do I do to get the other zero?.. Below I have attached my code incase I've over looked something..
class payRoll
{
public static void main (
String [] args)
{
double perHour = 12.00,overTimeHour = 5.5, worked = 45.5, withHolding;
int hoursNormal = 40;
double overTimePay = 18.00,regularPay, grossPay, netPay, taxRate = .285 , ot;
String employeeName;
employeeName = "John Smith"; //declares String "employeeName" the value of "John Smith"
grossPay = perHour * hoursNormal; //takes 40 hours and multiplies $12.00/hr
ot = overTimeHour * overTimePay; //takes 5.5 hours and multiplies $18.00/hr
regularPay = grossPay + ot; //takes both equasions and adds them up for the gross pay
withHolding = taxRate * regularPay; //takes the gross pay and multiplies by .285 or 28.5% for the withholding
netPay = regularPay - withHolding; //takes gross pay and subtracts the withholding total to get net pay
System.out.print("Employee name: ");
System.out.println(employeeName);
System.out.print("Hours Worked: ");
System.out.println(worked);
System.out.print("Hours Regular: ");
System.out.println("40 x $12.00 = $" + grossPay);
System.out.print("Hours Overtime: ");
System.out.println("5.5 x $18.00 = $" + ot);
System.out.print("Gross Pay:\t\t\t\b\b$");
System.out.println(regularPay);
System.out.println();
System.out.print("Withholdings:\t\t\t\b\b\b($");
System.out.println(withHolding + ")");
System.out.println();
System.out.print("Net Pay:\t\t\t\b\b\b$");
System.out.println(netPay);
}
}
any help will be greatly appreciated..