'''
Payroll

Summary
Calculate an employee payroll given certain input variables.
'''

employeeName = input(
"Enter employee's name: ")
hoursWorked = eval(input(
    "Enter number of hours worked in a week: ") )
payRate = eval(input(
    "Enter hourly pay rate: ") )
federalTax = eval(input(
    "Enter federal tax withholding rate: ") )
stateTax = eval(input(
    "Enter state tax withholding rate: ") )

print("\n")
print("Employee Name:", employeeName)
print("Hours Worked:",format(hoursWorked,"3.1f"))
print("Pay Rate: " + str("$") + str(payRate))
print("Gross Pay: " + str("$") + str(hoursWorked * payRate))
print("Deductions:")
print("  Federal Withholding " + str("(") + str(format(federalTax, '3.1%')) + str("): $") + str(round(federalTax * payRate * hoursWorked,2)))
print("  State Withholding " + str("(") + str(format(stateTax, '3.1%')) + str("): $") + str(round(stateTax * payRate * hoursWorked,2)))
print("  Total Deduction: $" + str(round(federalTax * payRate * hoursWorked + stateTax * payRate * hoursWorked,2)))
print("Net Pay: $" + str(round( (hoursWorked * payRate) - (federalTax * payRate * hoursWorked + stateTax * payRate * hoursWorked),2)))
Scroll to Top