# Step 1: Read input
hours_worked = int(input("Enter the number of hours worked in a week: "))
dependents = int(input("Enter the number of dependents: "))
# Constants for calculation
hourly_rate = 16.78
overtime_rate = 1.5 * hourly_rate
social_security_tax_rate = 6 / 100
federal_income_tax_rate = 14 / 100
state_income_tax_rate = 5 / 100
union_dues = 10
additional_health_insurance = 35
# Step 2: Calculate gross pay
if hours_worked <= 40:
gross_pay = hours_worked * hourly_rate
else:
overtime_hours = hours_worked - 40
gross_pay = (40 * hourly_rate) + (overtime_hours * overtime_rate)
# Step 3: Calculate withholding amounts
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
union_dues = 10
if dependents >= 3:
additional_health_insurance = 35
else:
additional_health_insurance = 0
# Step 4: Calculate net take-home pay
net_pay = gross_pay - social_security_tax - federal_income_tax - state_income_tax - union_dues - additional_health_insurance
# Step 5: Output results
print("Worker's Gross Pay: $", round(gross_pay, 2))
print("Social Security Tax: $", round(social_security_tax, 2))
print("Federal Income Tax: $", round(federal_income_tax, 2))
print("State Income Tax: $", round(state_income_tax, 2))
print("Union Dues: $", round(union_dues, 2))
print("Additional Health Insurance: $", round(additional_health_insurance, 2))
print("Net Take-Home Pay: $", round(net_pay, 2))
You can run this program and enter the desired values for hours worked and number of dependents to get the output with the worker's gross pay, each withholding amount, and the net take-home pay for the week.