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

Python Programming: Write a payroll program that: Prompts for the number of empl

ID: 669610 • Letter: P

Question

Python Programming:

Write a payroll program that:

Prompts for the number of employees

Inputs the names, wage rates and hours for each employee

Calculates the wage

Displays the name, hours, rate and wage

Please use test data as shown to the right

Use lists for employee names, rates, hours and wages

>>>

**************** Payroll Program ****************

****************   Data Input    ****************

Please enter the number of employees: 3

Enter the employee name: Ann Annson

Enter the employee wage rate: 8.50

Enter the employee hours: 35

Enter the employee name: Bill Billson

Enter the employee wage rate: 12.50

Enter the employee hours: 42

Enter the employee name: Carol Carolson

Enter the employee wage rate: 22.50

Enter the employee hours: 39

**************** Payroll Data ****************

Employee: Ann Annson

   Hours: 35.0

   Rate: $8.5/hr

   Wage: $297.5

Employee: Bill Billson

   Hours: 42.0

   Rate: $12.5/hr

   Wage: $525.0

Employee: Carol Carolson

   Hours: 39.0

   Rate: $22.5/hr

   Wage: $877.5

Explanation / Answer


n=int(raw_input ("Please enter the number of employees: "))
print" "
name=[None]*n
wage=[None]*n
hour=[None]*n
rates=[None]*n
for i in range(0,n):
name[i]=raw_input ("Enter the employee name: ")
rates[i]=float(raw_input ("Enter the employee wage rate:"))
hour[i]=int(raw_input ("Enter the employee hours:"))
wage[i]=rates[i]*hour[i]
print" "
print " **************** Payroll Data **************** "
for i in range(0,n):
print"Employee:%s "%str(name[i])
print"Hours:%s "%str(hour[i])
print"Rate:%s "%str(rates[i])
print"wage:%s"%str(wage[i])
print " "