Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

The following program has been implemented for a newly proposed tax calculation formula for residents of a fictitious country. /i income List[]; the array reconding

image text in transcribed
The following program has been implemented for a newly proposed tax calculation formula for residents of a fictitious country. /i income List[]; the array reconding the individual income items // childLis[]: the array recording the ages of children supported by this person // parentList[]: the array recording the ages of parents supported by this person 1 public double computeTax(double[] incomeList, int[] parentList, int[] childList) f 2 double tax Amount =0.0; 3 double incomeAmount =0.0; // calculate the income amount 4 for (int i=0;i40000&&2 incomeAmount 80000.8& incomeAmount c= 120000) if 12 taxAmount =800+2800+ incomeAmount 0.12; 13 ) else if (incomeAmount >120000 ) f 14 tax Amount =800+2800+4800+ incomeAmoeint 0.17 15) /I calculate the tax exemption from having children 16 int taxExemption =0; 17 int numOfChild = childl ist.length; 18 while (numOfChild >0 ) ? 19 if (childL ist[numOfChild - I] 60 ) \& 27 tax.Amount = taxAmount - 2000; 28 taxExemption = tax Exemption +2000;29 30 I /l the maximum tax exemption is 8000 each person 31 if (taxExemption c=8000) if 32 if (tax.Amount >=0 ) \& 33 retum taxAmoant; 34 \} else i // i.e., taxAmount 8000 38 taxAmount =tax Amount +( taxExemption 8000)F 39 retum taxAmount; 401 Your Tasks Design test cases to achieve loop coverage on the function "compute Tax" (list the loops covered by each test case). If it is not feasible, explain the reason. Try your best to use the minimum number of test cases to achieve the loop coverage. Consider a loop covered if at least in one test the loop body was executed 0 times, in a second test the body was executed exactly once, and in another test the body was executed more than once

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Securing SQL Server Protecting Your Database From Attackers

Authors: Denny Cherry

1st Edition

1597496251, 978-1597496254

More Books

Students also viewed these Databases questions

Question

What is the meaning and definition of E-Business?

Answered: 1 week ago

Question

Distinguish between formal and informal reports.

Answered: 1 week ago