In this lab, you complete the Python program that calculates the amount of tax withheld from an employee’s weekly salary, the tax deduction to which the employee is entitled for each dependent, and the employee’s take-home pay. The program output includes state tax withheld, federal tax withheld, dependent tax deductions, salary, and take-home pay.

C++ for Engineers and Scientists
4th Edition
ISBN:9781133187844
Author:Bronson, Gary J.
Publisher:Bronson, Gary J.
Chapter5: Repetition Statements
Section5.5: A Closer Look: Loop Programming Techniques
Problem 15E: (Program) Write a program to simulate the rolling of two dice. If the total of the two dice is 7 or...
icon
Related questions
Question

Summary

In this lab, you complete the Python program that calculates the amount of tax withheld from an employee’s weekly salary, the tax deduction to which the employee is entitled for each dependent, and the employee’s take-home pay. The program output includes state tax withheld, federal tax withheld, dependent tax deductions, salary, and take-home pay.

Instructions

  1. Some variables have been assigned for you and the output statements have been written. Read the starting code carefully before you proceed to the next step.
  2. Write the Python code needed to perform the following:
    • Calculate state withholding tax (stateTax) at 6.5 percent
    • Calculate federal withholding tax (federalTax) at 28.0 percent.
    • Calculate dependent deductions (dependentDeduction) at 2.5 percent of the employee’s salary for each dependent.
    • Calculate total withholding (totalWithholding) as stateTax + federalTax + dependentDeduction.
    • Calculate take-home pay (takeHomePay) as salary - totalWithholding
  3. Execute the program by clicking the Run button at the bottom. You should get the following output:State Tax: $81.25 Federal Tax: $350.00000000000006 Dependents: $62.5 Salary: $1250.0 Take-Home Pay: $756.25
  4. In 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 salary and numDependents.
Expert Solution
trending now

Trending now

This is a popular solution!

steps

Step by step

Solved in 3 steps with 1 images

Blurred answer
Knowledge Booster
Constants and Variables
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.
Similar questions
  • SEE MORE QUESTIONS
Recommended textbooks for you
C++ for Engineers and Scientists
C++ for Engineers and Scientists
Computer Science
ISBN:
9781133187844
Author:
Bronson, Gary J.
Publisher:
Course Technology Ptr