Python Programming:Write a payroll program that:Prompts for the number of employeesInputs the names, wage rates and hours for each employeeCalculates the wageDisplays the name, hours, rate and wageUse...




Python Programming:Write a payroll program that:Prompts for the number of employeesInputs the names, wage rates and hours for each employeeCalculates the wageDisplays the name, hours, rate and wageUse lists for employee names, rates, hours and wagesThe payroll program should also catch the following errors in the employee data that is entered:User enters the wrong type of data (i.e. enters a string when and integer is expected)User enters a zero-length name (i.e. simply presses the enter key when prompted for a name)User enters a wage rate less than 0 or greater than 20User enters weekly hours less than 0 or greater than 60You do not need to do any input validation on the number of employees (i.e. the very first input)When an error is caught, the user should be repeatedly prompted until they enter the correct value.Use the incomplete Python file:Assn 05 Prb 01 Start.py as the start of your program. Add to this file to complete the problem requirements. Do not move or delete any parts of the program. Be sure to use the exception and function names as shown.The program should display output as shown as below.>>>**************** Payroll Program ****************


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



Please enter the number of employees: 3Data entry for employee 0Enter the employee name:'Name cannot be zero length'Please start overData entry for employee 0



Enter the employee name: aaaEnter the employee wage rate (0..20): I am a string!



Data entered in incorrect formatPlease start overData entry for employee 0Enter the employee name: aaaEnter the employee wage rate (0..20): -33'Hourly rate must between 0 and 20'Please start overData entry for employee 0Enter the employee name: aaaEnter the employee wage rate (0..20): 20Enter the employee hours (0..60): 1000'Hours must between 0 and 60'Please start overData entry for employee 0Enter the employee name: aaaEnter the employee wage rate (0..20): 20Enter the employee hours (0..60): 20



Data entry for employee 1Enter the employee name: bbbEnter the employee wage rate (0..20): 18Enter the employee hours (0..60): 30Data entry for employee 2Enter the employee name: cccEnter the employee wage rate (0..20): 16Enter the employee hours (0..60): 40**************** Payroll Data ****************Employee: aaa   Hours: 20.0   Rate: $20.0/hr   Wage: $400.0Employee: bbb   Hours: 30.0   Rat$18.0/hr   Wage: $540.0Employee: ccc   Hours: 40.0   Rate: $16.0/hr   Wage: $640.0



>>>
Assn 05 Prb 01 Start.py :def main():print("**************** Payroll Program ****************")print()print("**************** Data Input ****************")

numEmployees = int(input("Please enter the number of employees: "))print()

employeeNames = []employeeRates = []employeeHours = []

employeeWages = []for employeeNumber in range(numEmployees):

while True:try:name = readName()rate = readRate()hours = readHours()


else:employeeNames.append(name)employeeRates.append(rate)

employeeHours.append(hours)employeeWages.append(employeeHours[employeeNumber] * employeeRates[employeeNumber])print()breakprint()print()print()print("**************** Payroll Data ****************")for employeeNumber in range(numEmployees):print("Employee: {}".format(employeeNames[employeeNumber]))print(" Hours: {}".format(employeeHours[employeeNumber]))print(" Rate: ${}/hr".format(employeeRates[employeeNumber]))print(" Wage: ${}".format(employeeWages[employeeNumber]))print()# Thrown if employee name is zero lengthclass EmpNameError(Exception):def __init__(self, value):self.value = valuedef __str__(self):return repr(self.value)# Thrown if hourly rate 20class RateError(Exception):# Thrown if weekly hours 60class HoursError(Exception):# function readNa# function readRate# function readHoursif __name__ == "__main__": main()


May 19, 2022
SOLUTION.PDF

Get Answer To This Question

Submit New Assignment

Copy and Paste Your Assignment Here