1. Write the Python code needed to perform the following:2. Calculate state withholding tax (stateTax) at 6.5 percent3. Calculate federal withholding tax (federalTax) at 28.0 percent.4. Calculate dependent deductions (dependentDeduction) at 2.5 percent of the employee’s salary for each dependent.5. Calculate total withholding (totalWithholding) as stateTax + federalTax+ dependentDeduction.6. Calculate take-home pay (takeHomePay) as salary- totalWithholding7. Execute the program by clicking the "Run Code" button at the bottom. You should get the following output:State Tax: $81.25Federal Tax: $350.00000000000006Dependents: $62.5Salary: $1250.0Take-Home Pay: $756.25In this program, the variables named salary and numDependents are initialized with the values 1250.0 and 2. To make this program more flexible, modify it to accept interactive input for salaryand numDependents.

Respuesta :

Answer:

salary=float(input("Enter salary : "))

numDependents=int(input("Enter number of dependents : "))

stateTax=salary*0.065

federalTax=salary*0.28

dependentDeduction=salary*0.025*numDependents

totalWithholding=stateTax + federalTax+ dependentDeduction

takeHomePay=salary- totalWithholding

print("State Tax :$",str(stateTax))

print("Federal Tax :$",str(federalTax))

print("Dependents:$",str(dependentDeduction))

print("Salary :$",str(salary))

print("Take-Home Pay:$",str(takeHomePay))

Explanation:

  • Take the salary as input from user.
  • Take number of dependents as an input from user.
  • Calculate the state tax and Federal Tax. Then calculate the independent detection tax by multiplying salary with 0.025 as well as number of dependents.
  • After that calculate total withholding and then calculate home pay by subtracting total withholding from salary.
  • Finally print all the details.

The program is a sequential program, and does not require loops and conditional statements

The program in Python, where comments are used to explain each line is as follows:

#This gets input for the salary

salary=float(input("Salary :$"))

#This gets input for the number of dependents

numDependents=int(input("Dependents : "))

#This calculates the state tax

stateTax=salary*0.065

#This calculates the federal tax

federalTax=salary*0.28

#This calculates the dependent deduction

dependentDeduction=salary*0.025*numDependents

#This calculates the total withholding tax

totalWithholding=stateTax + federalTax+ dependentDeduction

#This calculates the net pay

takeHomePay=salary- totalWithholding

#The next 5 lines print the required outputs

print("State Tax: $"+str(stateTax))

print("Federal Tax: $"+str(federalTax))

print("Dependents: $"+str(dependentDeduction))

print("Salary: $"+str(salary))

print("Take-HomePay :$"+str(takeHomePay))

Read more about sequential programs at:

https://brainly.com/question/17970226

ACCESS MORE
EDU ACCESS
Universidad de Mexico