Question: 1. Create a new function that will input and return the from date and to date for the hours worked and is called inside the

1. Create a new function that will input and return the from date and to date for the hours worked and is called inside the loop. This should be the first function called. Dates must be in the format mm/dd/yyyy. (Note: no validation of correct date format is required) 2. Store the from date, to date, employee name, total hours, hourly rate and income tax rate in a list object. Note: multiple list objects may be needed to complete this functionality 3. After the user terminates the loop, call a function that will: a. Read through the list(s) and for each employee calculate the income tax and net pay. b. Display the from date, to date, employee name, hours worked, hourly rate, gross pay, income tax rate, income taxes and net pay for the employee c. Increment the total number of employees, total hours, total tax, total net pay and store the values in a dictionary object. 4. Modify the function that displays totals to read the data from the dictionary object and then display the totals. 5. Submit the lab report or a Word document that contains a screen shot of input and display for one employee and a screen shot of the display of totals. A minimum of two employees must be entered to receive full credit. Include a 1-2 sentence reflection on the successes and/or challenges you had with this assignment. Ensure all functionality is working correctly and code is written efficiently. For purposes of this assignment, writing code efficiently is defined as: 1. Using correct naming conventions for all variables and objects. 2. Using correct naming conventions for functions and methods. 3. Using built-in functions whenever possible. 4. Using the fewest lines of code needed to return multiple values from functions. 5. Using the fewest lines of code needed to complete the functionality defined

def calculate_tax_and_netpay(total_hours, hourly_rate, tax_rate): tax = float(total_hours) * float(hourly_rate) * (float(tax_rate) / 100) net_pay = float(total_hours) * float(hourly_rate) - tax return tax, net_pay def get_name(): name = input("Enter employees name here: ") return name def get_total_hours(): total_hours = float(input("Enter total hours here: ")) return total_hours def get_hourly_rate(): hourly_rate = float(input("Enter employees hourly rate here: ")) return hourly_rate def get_tax_rate(): tax_rate = float(input("Enter the tax rate here in percentage: ")) return tax_rate def get_gross_pay(total_hours, hourly_rate): gross_pay = float(total_hours) * float(hourly_rate) return gross_pay def display_employee_info(name, total_hours, hourly_rate, tax_rate, tax, gross_pay, net_pay): print("Employees name:", name) print("Total hours worked:", total_hours) print("Employees hourly rate:", hourly_rate) print("Employees tax rate:", tax_rate) print("Tax rate:", tax) print("Employees gross pay:", gross_pay) print("Employees net pay:", net_pay) print(" ****************************") def display_total_info(total_employees, total_hours, total_tax, total_gross_pay, total_net_pay): print("Total number of employees is:", total_employees) print("total hours worked is:", total_hours) print("Total tax is:", total_tax) print("Total gross pay is:", total_gross_pay) print("Total net pay is:", total_net_pay) def main(): total_employees = 0 total_hours = 0 total_tax = 0 total_gross_pay = 0 total_net_pay = 0 while True: name = get_name() if name == "end": break hours = get_total_hours() hourly_rate = get_hourly_rate() tax_rate = get_tax_rate() gross_pay = get_gross_pay(hours, hourly_rate) tax, net_pay = calculate_tax_and_netpay(hours, hourly_rate, tax_rate) display_employee_info(name, hours, hourly_rate, tax_rate, tax, gross_pay, net_pay) total_employees += 1 total_hours += hours total_tax += tax total_gross_pay += gross_pay total_net_pay += net_pay display_total_info(total_employees, total_hours, total_tax, total_gross_pay, total_net_pay) if __name__ == "__main__": main()

is the code i have

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!