Question: 1 / / Compute Net Pay 2 totalWithholdings = 0 ; 3 4 for ( id = 0 ; id < numEmployees; id + +

1// Compute Net Pay
2 totalWithholdings =0;
3
4 for ( id =0; id < numEmployees; id++){
5
6// compute social security withholding, if below the maximum
7 if ( m_employee[ id ].governmentRetirementWithheld < MAX_GOVT_RETIREMENT ){
8 governmentRetirement 310= ComputeGovernmentRetirement( m_employee[ id ]);
9}
10
11// set default to no retirement contribution
12 companyRetirement =0;
13
14// determine discretionary employee retirement contribution
15 if ( m_employee[ id ].WantsRetirement &&
16 EligibleForRetirement( m_employee[ id ])){
17 companyRetirement = GetRetirement( m_employee[ id ]);
18}
19
20 grossPay = ComputeGrossPay ( m_employee[ id ]);
21
22// determine IRA contribution
23 personalRetirement =0;
24 if ( EligibleForPersonalRetirement( m_employee[ id ])){
25 personalRetirement = PersonalRetirementContribution( m_employee[ id ],
26 companyRetirement, grossPay );
27}
28
29// make weekly paycheck
30 withholding = ComputeWithholding( m_employee[ id ]);
31 netPay = grossPay - withholding - companyRetirement - governmentRetirement
32 personalRetirement;
33 PayEmployee( m_employee[ id ], netPay );
34
35// add this employee's paycheck to total for accounting
36 totalWithholdings = totalWithholdings + withholding;
37 totalGovernmentRetirement = totalGovernmentRetirement + governmentRetirement;
38 totalRetirement = totalRetirement + companyRetirement;
39}
40
41 SavePayRecords( totalWithholdings, totalGovernmentRetirement, totalRetirement );
Come up with flow graph, and compute cyclomatic complexity. Then come up with minimum number of test cases.

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Programming Questions!