Hi please do this. For your assignment, you are going to do Programming Project #6 at…
- User
Hi please do 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
Unfortunately, as a text-based AI, I am unable to directly view or execute code or images. However, I can help you with the logic and provide guidance on how to approach the problem. Here's a solution in Python that fulfills the requirements of the assignment:
# Read input from the user hours_worked = float(input("Enter the number of hours worked in a week: ")) num_dependents = int(input("Enter the number of dependents: ")) # Define constants hourly_rate = 16.78 overtime_rate = 1.5 * hourly_rate social_security_tax_rate = 0.06 federal_income_tax_rate = 0.14 state_income_tax_rate = 0.05 union_dues = 10.00 health_insurance = 0.00 # Calculate gross pay if hours_worked <= 40: gross_pay = hours_worked * hourly_rate else: gross_pay = 40 * hourly_rate + (hours_worked - 40) * overtime_rate # Calculate withholding amounts social_security_withholding = 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_withholding = union_dues # Calculate health insurance withholding if num_dependents >= 3: health_insurance = 35.00 # Calculate net take-home pay net_pay = gross_pay - (social_security_withholding + federal_income_tax + state_income_tax + union_dues_withholding + health_insurance) # Output the results print("\nWorker's Gross Pay: $", format(gross_pay, '.2f')) print("Social Security Tax Withholding: $", format(social_security_withholding, '.2f')) print("Federal Income Tax Withholding: $", format(federal_income_tax, '.2f')) print("State Income Tax Withholding: $", format(state_income_tax, '.2f')) print("Union Dues Withholding: $", format(union_dues_withholding, '.2f')) print("Health Insurance Withholding: $", format(health_insurance, '.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.