Payroll Application
962826Sep 18 2012 — edited Sep 19 2012Hi - new developer here - this is for a class homework assignment. Not sure what I am doing worng here but I am getting a lot of errors. I am very much so a novice, any feedback would be appreciated. Thanks!
import java.util.Scanner;
public class Payroll {
public static void main (String[] args) {
//Create a scanner
Scanner input = new Scanner(System.in);
//Enter a name
System.out.print("Enter employee's name, e.g. Smith: ");
double name = input.nextDouble();
//Enter number of hours worked
System.out.print("Enter number of hours worked in a week, e.g. 10: ");
double hours = input.nextDouble();
//Enter hourly rate
System.out.print("Enter hourly pay rate, e.g. $6.75: ");
double payRate = input.nextDouble();
//Obtain gross pay
double grossPay = hours * payRate;
//Enter Federal tax withholding rate
System.out.print("Enter federal tax withholding rate in percentage, e.g. 20%: ");
double federal = input.nextDouble();
//Obtain Federal tax withholding rate:
double federalFormula = (federal / 100) * grossPay;
//Enter State tax withholding rate
System.out.print("Enter state tax withholding rate: ");
double state = input.nextDouble();
//Obtain State tax withholding rate:
double stateFormula = (state / 100) * grossPay;
//Display the results
System.out.println("Employee Name: " + name + "\n"
+ "Hours Worked: " + hours + "\n"
+ "Pay Rate: " + payRate + "\n"
+ "Federal Tax Withholding: (" + federal + ")" + federalFormula + "\n"
+ "State Tax Withholding: (" + state + ")" + stateFormula + "\n");
}
}