Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

Write a Python program that will take 3 lists: and use this logic: An employee g

ID: 3807480 • Letter: W

Question

Write a Python program that will take 3 lists:

and use this logic:

An employee gets overtime when they have worked more than 40 hours

Overtime pay is calculated using this formula:

Gross Pay = (35*Wage) + ((Hours-35)*Wage*1.5)

Regular pay is calculated using this formula:

Gross Pay = (Hours*Wage)

Use a while loop and a for loop to process these lists.

Print each employee, their wages, Hours and gross pay.

It can be either a while or a for loop or both one after the other giving the same output.

I need help with this program. Thanks in advance.

Name Wage Hours Juan 7.50 35 Rae 11.00 41 Ivanna 18.25 26 Lilly 9.25 35 Robert 11.10 45

Explanation / Answer

python 2.7 code:

Name = ["Juan","Rae","Ivanna", "Lilly", "Robert"]
Hours = [35,41,26,35,45]
Wage = [7.5,11,18.25,9.25,11.1]
print "Name Wage Hours GP"
for i in range(0,len(Name)):
   GP = 0
   if(Hours[i] > 40):
       GP = (35*Wage[i]) + ((Hours[i]-35)*Wage[i]*1.5);
   else:
       GP = Hours[i] * Wage[i]
   print Name[i]," ", Wage[i]," ", Hours[i]," ",GP

Sample Output:

Name Wage Hours GP
Juan 7.5 35 262.5
Rae 11 41 484.0
Ivanna 18.25 26 474.5
Lilly 9.25 35 323.75
Robert 11.1 45 555.0