Write a class that accepts a user's hourly rate of pay and number of hours worked. Display the user's gross pay, the withholding tax (15% of gross pay) and the net pay, (gross pay - withholding)
I have my code below, but I'm lost. I dont know what I'm doing wrong, if anyone could help me out. I would be ever so greatful :)
import java.util.Scanner;
public class Payroll
{
public static void main(String[] args)
{
int hours;
int rate;
int tax;
int grosspay;
int netpay;
int fedtax;
Scanner keyBoard = new Scanner(System.in);
System.out.print("Enter hourly pay rate: ");
rate = keyBoard.nextInt();
System.out.print("Enter hours worked: ");
hours = keyBoard.nextInt();
System.out.println("You worked " + hours + "at $ + rate");
System.out.println("Gross pay: + grosspay");
grosspay = (hours * rate);
System.out.println("Withholding tax: $ + withholdingtax");
tax = .15;
withholdingtax = (grosspay * tax);
System.out.println("Net pay: + netpay");
netpay = (grosspay - withholdingtax);
}
}