Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

I need help filling out this template I have the stuff in the code in comments that needs done def GetEmpName(): empname = input(Enter employee

I need help filling out this template I have the stuff in the code in comments that needs done

def GetEmpName(): empname = input("Enter employee name (END to terminate): ") return empname def GetDatesWorked(): #write the code to input fromdate and todate and return the values from the function. #Prompt the user for the dates in the following format: mm/dd/yyyy #no validations are needed for this input, we will assume the dates are entered correctly def GetHoursWorked(): hours = float(input('Enter amount of hours worked: ')) return hours def GetHourlyRate(): hourlyrate = float(input ("Enter hourly rate: ")) return hourlyrate def GetTaxRate(): taxrate = float(input ("Enter tax rate: ")) return taxrate def CalcTaxAndNetPay(hours, hourlyrate, taxrate): grosspay = hours * hourlyrate incometax = grosspay * taxrate netpay = grosspay - incometax return grosspay, incometax, netpay # COMMENT OUT THE FOLLOWING CODE #def printinfo(empname, hours, hourlyrate,grosspay, taxrate, incometax, netpay): # print(empname, f"{hours:,.2f}", f"{hourlyrate:,.2f}", f"{grosspay:,.2f}", f"{taxrate:,.1%}", f"{incometax:,.2f}", f"{netpay:,.2f}") def printinfo(EmpDetailList): TotEmployees = 0 TotHours = 0.00 TotGrossPay = 0.00 TotTax = 0.00 TotNetPay = 0.00 # the following code creates a for loop to read through EmpDetailList and assign values in list to variables for EmpList in EmpDetailList: fromdate = EmpList[0] #write code to assign values to todate, empname, hours, hourlyrate, and taxrate from EmpLst grosspay, incometax, netpay = CalcTaxAndNetPay(hours, hourlyrate, taxrate) print(fromdate, todate, empname, f"{hours:,.2f}", f"{hourlyrate:,.2f}", f"{grosspay:,.2f}", f"{taxrate:,.1%}", f"{incometax:,.2f}", f"{netpay:,.2f}") TotEmployees += 1 TotHours += hours TotGrossPay += grosspay TotTax += incometax TotNetPay += netpay # the following line of code assigns TotEmployees totals to dictionary EmpTotals["TotEmp"] = TotEmployees # write code to assign TotHours, TotGrossPay, TotTax, and TotNetPay to corresponding dictionary item # COMMENT OUT THE FOLLOWING CODE #def PrintTotals(TotEmployees, TotHours, TotGrossPay, TotTax, TotNetPay): # print()n # print(f"Total Number Of Employees: {TotEmployees}") # print(f"Total Hours Worked: {TotHours:,.2f}") # print(f"Total Gross Pay: {TotGrossPay:,.2f}") # print(f"Total Income Tax: {TotTax:,.2f}") # print(f"Total Net Pay: {TotNetPay:,.2f}") def PrintTotals(EmpTotals): print() # use dictionary to print totals # the following line of code prints Total Employees from the dictionary print(f'Total Number Of Employees: {EmpTotals["TotEmp"]}') # write code to print TotalHrs, TotGrossPay, TotTax and TotNetPay from dictionary if __name__ == "__main__": # COMMENT OUT THE FOLLOWING CODE # #TotEmployees = 0 #TotHours = 0.00 #TotGrossPay = 0.00 #TotTax = 0.00 #TotNetPay = 0.00 #create empty list and dictionary EmpDetailList = [] EmpTotals = {} while True: empname = GetEmpName() if (empname.upper() == "END"): break fromdate, todate = GetDatesWorked() hours = GetHoursWorked() hourlyrate = GetHourlyRate() taxrate = GetTaxRate() # COMMENT OUT THE FOLLOWING CODE #grosspay, incometax, netpay = CalcTaxAndNetPay(hours, hourlyrate, taxrate) #printinfo(empname, hours, hourlyrate, grosspay, taxrate, incometax, netpay) #write code to insert fromdate, todate, empname, hours, hourlyrate, and taxrate into list EmpDetail #the following code appends the list EmpDetail to the list EmpDetailList EmpDetailList.append(EmpDetail) # COMMENT OUT THE FOLLOWING CODE #TotEmployees += 1 #TotHours += hours #TotGrossPay += grosspay #TotTax += incometax #TotNetPay += netpay printinfo(EmpDetailList) PrintTotals (EmpTotals)

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image_2

Step: 3

blur-text-image_3

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Introduction To Constraint Databases

Authors: Peter Revesz

1st Edition

1441931554, 978-1441931559

More Books

Students also viewed these Databases questions