Question
Create the following program: Calculate the net pay of an employee by deducting federal, state, and social security taxes. Create a file named paydeductions.py which
Create the following program: Calculate the net pay of an employee by deducting federal, state, and social security taxes.
Create a file named paydeductions.py which will store the following functions and its parameters:
o Global Constants: FED_TAX = 0.1725, STATE_TAX = 0.0585, OASDI_TAX = 0.062, MEDICARE_TAX = 0.0145
o fFedTax, parameter gross pay, return federal tax (product of gross pay and appropriate constant)
o fStateTax, parameter gross pay, return state tax (product of gross pay and appropriate constant)
o fSSTax, parameter gross pay, return social security tax (product of gross pay and sum of OASDI_TAX and MEDICARE_TAX) Create the main program file (icp7-3.py), import the paydeductions file and create the following functions:
o Function main with no parameters: Display a message Welcome to the net paycheck calculator Get user input of gross pay and store it into a variable named meaningfully Call the function fDeductNetpay (see below) and store the return result into variables deductions and netPay
Display the gross pay, deductions and net pay (see output below)
o Function fDeductNetpay with parameter gross pay: Calculate the total deductions by calling the 3 functions in paydeductions and adding them up, storing it in variable deductions Calculate the net pay by subtracting the deductions from gross pay, storing it in variable netPay Return both variables
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started