Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Gaddis dEd (1)-pdf 137 659 Ref grossPay) Ref bonuses) Real grossPay) (Real bonuses) Program 3-12 1 Global constant for the rate of contribution 2 Constant
Gaddis dEd (1)-pdf 137 659 Ref grossPay) Ref bonuses) Real grossPay) (Real bonuses) Program 3-12 1 Global constant for the rate of contribution 2 Constant Real CoNTRIBUTION RATE0.05 4 I main module 5 Module main Local variables 7 Declare Real annualGrossPay 8 Declare Real totalBonuses 10 11 Call getGrossPay (annualGrossPay) 12 13 14 Call getBonuses (totalBonuses) 15 16 17 1 the gross pay 18 Call showGrossPaycContrib(annualGrossPay) 19 20 / Display the contribution for 21 / the bonuses 22 Call showBonusContrib(totalBonuses) 23 End Module 24 25 I The getGrossPay module gets the 26 I 27 I grossPay reference variable 28 Nodule getGrossPay (Real Ref grossPay) 29 Display "Enter the total gross pay." // Get the annual gross pay Get the total of the bonuses / Display the contribution for gross pay and stores it in the 3.5 Global Variables and Global Constants111 30 Input grossPay 31 End Module 32 33// The getBonuses module gets the 34 // amount of bonuse and stores it 35 in the bonuses reference variable 36 Module getBonuses (Real Ref bonuses 37 Display "Enter the anount of bonuses. 38 Input bonuses 39 End Module 40 41 / The showGrossPaycontrib module 42 // accepts the gross pay as an argument 43 and displays the retirement contribution 44 Eor gross pay 45 Module showGrossPayContrib(Real grossPay) 46 47 48 Display "The contribution for the gross pay 49Display "is " contrib 50 End Module 51 52 The showBonusContrib module accepts 53 / the bonus amount as an argument and 54 // displays the retirement contribution 55 for bonuses 56 Module 57 58 9 Display "The contribution for the bonuses 60 Display is $", contrib 61 End Module Declare Real contrib Set contrib-grossPay CONTRIBUTION RATE rib(Real bonuses) Declare Real contrib Set contribbonuses CONTRIBUTION RATE Program Output (with Input Shown in Bold) 55 for bonuses 56 Module 57 58 59 60 Displayis contrib 61 End Module rib(Real bonuses) Declare Real contrib Set contribbonuses CONTRIBUTION RATE Display The contribution for the bonuses" Program Output (with Input Shown in Bold) Enter the total gross pay 80000.00 [Enter] Enter the amount of bonuses 20000.00 [Enter] The contribution for the gross pay i8 $4000 The contribution for the bonuses is $1000 A global constant named CONTRIBUTION-RATE is declared in line 2, and initialized with the value 0.05. The constant is used in the calculation in line 47 (in the showGrossPaycontrib module) and again in line 58 (in the showBonuscontrib module). Marilyn decided to use this global constant to represent the 5 percent con- tribution rate for two reasons: It makes the e program easier to read. When you look at the calculations in lines easiert 47 and 58, it is apparent what is happening. . Occasionally the contribution rate changes. When this happens, it will be easy to update the program by changing the declaration statement in line 2 Gaddis dEd (1)-pdf 137 659 Ref grossPay) Ref bonuses) Real grossPay) (Real bonuses) Program 3-12 1 Global constant for the rate of contribution 2 Constant Real CoNTRIBUTION RATE0.05 4 I main module 5 Module main Local variables 7 Declare Real annualGrossPay 8 Declare Real totalBonuses 10 11 Call getGrossPay (annualGrossPay) 12 13 14 Call getBonuses (totalBonuses) 15 16 17 1 the gross pay 18 Call showGrossPaycContrib(annualGrossPay) 19 20 / Display the contribution for 21 / the bonuses 22 Call showBonusContrib(totalBonuses) 23 End Module 24 25 I The getGrossPay module gets the 26 I 27 I grossPay reference variable 28 Nodule getGrossPay (Real Ref grossPay) 29 Display "Enter the total gross pay." // Get the annual gross pay Get the total of the bonuses / Display the contribution for gross pay and stores it in the 3.5 Global Variables and Global Constants111 30 Input grossPay 31 End Module 32 33// The getBonuses module gets the 34 // amount of bonuse and stores it 35 in the bonuses reference variable 36 Module getBonuses (Real Ref bonuses 37 Display "Enter the anount of bonuses. 38 Input bonuses 39 End Module 40 41 / The showGrossPaycontrib module 42 // accepts the gross pay as an argument 43 and displays the retirement contribution 44 Eor gross pay 45 Module showGrossPayContrib(Real grossPay) 46 47 48 Display "The contribution for the gross pay 49Display "is " contrib 50 End Module 51 52 The showBonusContrib module accepts 53 / the bonus amount as an argument and 54 // displays the retirement contribution 55 for bonuses 56 Module 57 58 9 Display "The contribution for the bonuses 60 Display is $", contrib 61 End Module Declare Real contrib Set contrib-grossPay CONTRIBUTION RATE rib(Real bonuses) Declare Real contrib Set contribbonuses CONTRIBUTION RATE Program Output (with Input Shown in Bold) 55 for bonuses 56 Module 57 58 59 60 Displayis contrib 61 End Module rib(Real bonuses) Declare Real contrib Set contribbonuses CONTRIBUTION RATE Display The contribution for the bonuses" Program Output (with Input Shown in Bold) Enter the total gross pay 80000.00 [Enter] Enter the amount of bonuses 20000.00 [Enter] The contribution for the gross pay i8 $4000 The contribution for the bonuses is $1000 A global constant named CONTRIBUTION-RATE is declared in line 2, and initialized with the value 0.05. The constant is used in the calculation in line 47 (in the showGrossPaycontrib module) and again in line 58 (in the showBonuscontrib module). Marilyn decided to use this global constant to represent the 5 percent con- tribution rate for two reasons: It makes the e program easier to read. When you look at the calculations in lines easiert 47 and 58, it is apparent what is happening. . Occasionally the contribution rate changes. When this happens, it will be easy to update the program by changing the declaration statement in line 2
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