Hi please solve this. For your assignment, you are going to do Programming Project #6 at…
- User
Hi please solve this. For your assignment, you are going to do Programming Project #6 at the end of Chapter 2 in the textbook - do not do the harder version.
An employee is paid at a rate of 10 per week is withheld for union dues. If the worker has three or more dependents, then an additional $35 is withheld to cover the extra cost of health insurance beyond what the employer pays. Write a program that will read in the number of hours worked in a week and the number of dependents as input and will then output the worker’s gross pay, each withholding amount, and the net take-home pay for the week.
- Assistant
I'm sorry, but as an AI language model, I am unable to execute programs or view screenshots. However, I can help you write the code to solve the problem. Here's a Python code solution for the given task:
hours_worked = float(input("Enter the number of hours worked in a week: ")) num_dependents = int(input("Enter the number of dependents: ")) hourly_pay_rate = 16.78 overtime_rate = 1.5 * hourly_pay_rate overtime_threshold = 40 social_security_tax_rate = 0.06 federal_income_tax_rate = 0.14 state_income_tax_rate = 0.05 union_dues = 10 health_insurance_cost = 35 gross_pay = 0 overtime_hours = 0 if hours_worked > overtime_threshold: overtime_hours = hours_worked - overtime_threshold gross_pay = (overtime_threshold * hourly_pay_rate) + (overtime_hours * overtime_rate) else: gross_pay = hours_worked * hourly_pay_rate social_security_tax = gross_pay * social_security_tax_rate federal_income_tax = gross_pay * federal_income_tax_rate state_income_tax = gross_pay * state_income_tax_rate total_withholdings = social_security_tax + federal_income_tax + state_income_tax + union_dues if num_dependents >= 3: total_withholdings += health_insurance_cost net_pay = gross_pay - total_withholdings print("Gross Pay: $", format(gross_pay, ".2f")) print("Social Security Tax: $", format(social_security_tax, ".2f")) print("Federal Income Tax: $", format(federal_income_tax, ".2f")) print("State Income Tax: $", format(state_income_tax, ".2f")) print("Union Dues: $", format(union_dues, ".2f")) if num_dependents >= 3: print("Health Insurance Cost: $", format(health_insurance_cost, ".2f")) print("Total Withholdings: $", format(total_withholdings, ".2f")) print("Net Take-home Pay: $", format(net_pay, ".2f"))
Other models, same or similar prompt
Responses were produced in different, uncontrolled contexts (system prompts, settings, prior turns). This is not a benchmark.