Answered step by step
Verified Expert Solution
Question
1 Approved Answer
The following program has been implemented for a newly proposed tax calculation formula for residents of a fictitious country. / / incomeList [ ] :
The following program has been implemented for a newly proposed tax calculation formula for residents of a fictitious country.
incomeList: the array recording the individual income items
childList: the array recording the ages of children supported by this person
parentList: the array recording the ages of parents supported by this person
public double computeTaxdouble incomeList, int parentList, int childList
double taxAmount ;
double incomeAmount ;
calculate the income amount
for int i ; i incomeList.length; i
incomeAmount incomeAmount incomeListi;
calculate the basic tax
if incomeAmount
taxAmount incomeAmount ;
else if incomeAmount && incomeAmount
taxAmount incomeAmount ;
else if incomeAmount && incomeAmount
taxAmount incomeAmount ;
else if incomeAmount
taxAmount incomeAmount ;
calculate the tax exemption from having children
int taxExemption ;
int numOfChild childList.length;
while numOfChild
if childListnumOfChild
taxAmount taxAmount ;
taxExemption taxExemption ;
numOfChild;
calculate the tax exemption from having parents
for int j ; j parentList.length; j
if parentListj
taxAmount taxAmount ;
taxExemption taxExemption ;
the maximum tax exemption is each person
if taxExemption
if taxAmount
return taxAmount;
else ie taxAmount
return ;
else ie taxExemption
taxAmount taxAmount taxExemption ;
return taxAmount;
Design test cases to achieve the statement coverage on the function computeTaxlist the statements covered by each test case using the line number of each statement If it is not feasible, explain the reason. Use the minimum number of test cases to achieve the statement coverage. For each level of coverage, provide a brief explanation of your work. This should include any assumptions you have made.
Test cases should be presented in a table with each row showing the following:
Test ID # input data, statementspathsloops covered by the test case, expected output, actual output, passfail and coverage. You may add additional columns to display key variables such as tax exemption.
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