In: Computer Science
Phyton Question:
You have been hired to create a program that computes that Monthly Net Pay for a worker after acquiring from the user their Annual Gross Salary. The deductions that are to be considered are an Income Tax of 22.5%, a Social Security Tax of 6.2%, and a Medicare Tax of 1.45%. The program should end by displaying the Monthly Net Pay to the user.
Design the algorithm for this program using your preferred method of representation (Pseudocode OR Flowchart).
An algorithm is a step-by-step procedure that gives a solution to the problem.
The required algorithm is given below:
Step 1: Start
Step 2: Declare variables annualGrossSalary, sst, medTax, netPay, and monthlyNetPay
Step 3: Read values annualGrossSalary
Step 4: incomeTax = annualGrossSalary * 22.5 / 100
Step 5: sst = annualGrossSalary * 6.2 / 100
Step 6: medTax = annualGrossSalary * 1.45 / 100
Step 7: netPay = annualGrossSalary - incomeTax - sst - medTax
Step 8: monthlyNetPay = netPay / 12
Step 9: Display "monthlyNetPay" on the computer screen
Step 10: Stop
The python source code is given below:
#get user input
annualGrossSalary = int(input("Enter the annual gross salary:
"))
#calculate the deduction
incomeTax = annualGrossSalary * 22.5 / 100
sst = annualGrossSalary * 6.2 / 100
medTax = annualGrossSalary * 1.45 / 100
netPay = annualGrossSalary - incomeTax - sst - medTax
monthlyNetPay = netPay / 12
#display the montlhy salary
print("The montlhy net payment is:",monthlyNetPay)
The screenshot of the above source code is given below:
OUTPUT:
Enter the annual gross salary: 150000
The montlhy net payment is: 8731.25