In: Computer Science
To earn full credit, program must be free of syntax, run-time, and logic errors; include program comments; use reasonable readable variable names and prompts.
To include variables in the input prompt, you must use concatenation character (+). For example: assume you already asked for input of employee's first name and last name (they are stored into variables FirstName and LastName, then use this prompt to ask for employee's weekly hours which includes the employee's full name in the input statement.
Hours = float(input("Enter " + FirstName + ' ' + LastName + '\'s Weekly Hours: '))
The company which uses this program has TWO employees.
Write a Python application that will allow the user (payroll clerk) to enter payroll data for two hourly employees. Input Data includes:
Repeat the above prompt for two employees
Must use if statements to check if the employee requires an overtime pay.
Up to 40 hours on employee’s hourly rate; any hours over 40 must be pay at a time and a half (1.5 of rate). Using , and 2 decimal places for all currency in the output
Display the followings for each employee:
Then finally output payroll info for the entire company (total amount for both employees)
Sample input/output (user input is in bold italic)
Enter Employee’s ID (i.e. AF101): AS111
Enter Employee’s Last Name: Wong
Enter Employee’s First Name: Wanda
Enter Wanda Wong’s Weekly Hours: 36.5
Enter Wanda Wong’s Hourly pay rate per hour: 50
Enter Wanda Wong’s Income tax rate: 0.25
Enter Employee’s ID (i.e. AF101): AS256
Enter Employee’s Last Name: Johnson
Enter Employee’s First Name: Betty
Enter Betty Johnson’s Weekly Hours: 52
Enter Betty Johnson’s Hourly pay rate per hour: 30
Enter Betty Johnson’s Income tax rate: 0.20
Weekly Pay stub for AS111 Wanda Wong
36.5 Hours Worked @ $50.00
Gross pay of $1,825.00
Less Taxes Withheld @ 25.0% $456.25
Net Pay $1,368.75
Weekly Pay stub for AS256 Betty Johnson
52 Hours Worked @ $30.00
Gross pay of $1,740.00
Less Taxes Withheld @ 20.0% $348.00
Net Pay $1,392.00
Total Company payroll expense for the week: $3,565.00
Total Cash payments to Employees: $2,760.75
ids=[]
lNames=[]
fNames=[]
hours=[]
hourlyRate=[]
taxRate=[]
grossPay=[]
for i in range(0,2):
ids.append(str(input('Enter Employee’s ID (i.e. AF101): ')))
lNames.append(str(input('Enter Employee’s Last Name: ')))
fNames.append(str(input('Enter Employee’s First Name: ')))
hours.append(float(input('Enter '+fNames[i]+' '+lNames[i]+'’s
Weekly Hours: ')))
hourlyRate.append(float(input('Enter '+fNames[i]+' '+lNames[i]+'’s
Hourly pay rate per hour: ')))
taxRate.append(float(input('Enter '+fNames[i]+' '+lNames[i]+'’s
Income tax rate: ')))
for i in range(0,2):
print('Weekly Pay stub for '+ids[i]+' '+fNames[i]+'
'+lNames[i])
print('{0:.1f}'.format(hours[i])+' Hours Worked @
$'+'{0:.2f}'.format(hourlyRate[i]))
if(hours[i]>40):
grossPay.append(hourlyRate[i]*40+hourlyRate[i]*(hours[i]-40)*1.5)
else:
grossPay.append(hourlyRate[i]*hours[i])
print('Gross pay of $'+'{0:.2f}'.format(grossPay[i]))
print('Less Taxes Withheld @ {0:.2f}%'.format(taxRate[i]*100)+'
${0:.2f}'.format(grossPay[i]*taxRate[i]))
print('Net Pay ${0:.2f}'.format(grossPay[i]-grossPay[i]
*taxRate[i]))
print('Total Company payroll expense for the week:
${0:.2f}'.format(grossPay[0]+grossPay[1]))
print('Total Cash payments to Employees:
${0:.2f}'.format(((grossPay[0]-grossPay[0]*taxRate[0])+(grossPay[1]-grossPay[1]*taxRate[1]))))