Question
Marilyn works for Integrated Systems, Inc., a software company that has a reputation for providing excellent fringe benefits. One of their benefits is a quarterly
Marilyn works for Integrated Systems, Inc., a software company that has a reputation for providing excellent fringe benefits. One of their benefits is a quarterly bonus that is paid to all employees. Another benefit is a retirement plan for each employee.
The company contributes 5 percent of each employees gross pay and bonuses to their retirement plans. Marilyn wants to write a program that will calculate the companys contribution to an employees retirement account for a year.
Write a program for Marilyn to show the amount of contribution for the employees gross pay and for the bonuses separately.
The systems analyst has suggested to have separate functions for each contribution calculation. However, her suggestion is to get employees information in the main function.
What is the hierarchical chart?
The algorithm is given to you in the next slide.
The algorithm is:
Define main, show_bonus, and show_pay functions,
Call main
Call show_bonus and show_pay inside main
Algorithm for main:
Get the employee's annual gross pay.
Get the amount of bonuses paid to the employee.
Pass gross pay to show_pay and call it
Pass bonuses to show_bonus and call it
Algorithm for show_bonus(bonuses)
Calculate and display the contribution for the bonuses.
Algorithm for show_pay(gross pay)
Calculate and display the contribution for the gross pay.
Now lets improve the program we coded for practice 5.
Add another function (in addition to the previous three functions) to calculate the companys total contribution for each employee.
This function should be named total_contribution. And, it should display the total contribution amount after calculating it.
IDLE Shell 3.9.1 X CP 5-5 Global Constant.py - C:\Users\zobia\Desktop\MIS 3301\CP 5-5 Global Constant.py (3.9.1) File Edit Format Run Options Window Help CR = 0.05 #global constant def main(): gross = float (input ("What is your annual gross pay? ")) bonus = float (input ("What is your bonus amount? ")) con_pay = show_gross (gross) con_bon = show_bonus (bonus) total_contribution (gross, bonus) 9 def show_gross (gross): 10 con_pay = gross * CR print ("Contribution from pay is", con_pay) return con_pay - 14 def show_bonus (bonus): 15 con bon = bonus * print ("Contribution from bonus is", con_bon) 17 return con_bon File Edit Shell Debug Options Window Help Python 3.9.1 (tags/v3.9.1:le5d33e, Dec 7 2020, 17:08:21) [MSC v.1927 64 bit (AM D64)] on win32 Type "help", "copyright", "credits" or "license ()" for more information. >>> ===== RESTART: C:\Users\zobia\Desktop\MIS 3301\CP 5-5 Global Constant.py ====== What is your annual gross pay? 50000 What is your bonus amount? 20 Contribution from pay is 2500.0 Contribution from bonus is 1.0 Traceback (most recent call last): File "C:\Users\zobia\Desktop\MIS 3301\CP 5-5 Global Constant.py", line 23, inStep 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