You are required to complete the tasks described below. Test program The following program has been...
Fantastic news! We've Found the answer you've been seeking!
Question:
Transcribed Image Text:
You are required to complete the tasks described below. Test program 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 // childhistl: 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) { 2 3 4 5 7 8 9 10 double taxAmount 0.0; double incomeAmount = 0.0: 20 21 // calculate the income amount for (int i = 0; i < incomeList.length; i++) { income Amount = income Amount + incomeList[i]; 6 } taxAmount incomeAmount * 0.02; } else if (incomeAmount. > 40000 && incomeAmount. 80000 && income Amount 120000) { 13} 14 taxAmount = 800 2800+ 4800 income Amount * 0.17; 15 } 23 // calculate the basic tax if income ount 0) { 19 if (childList[numOfChild 11 <18) { taxAmount = taxAmount - 4000; taxExemption = taxExemption + 4000; 22 } numOfChild--; www Screenshot // calculate the tax exemption from having parents. 25 for (int j = 0; j < parentlist.length; itt) ( if (parentlist[i]> 60) { 26 27 28 301 // the maximum tax exemption is 8000 each person 31 if (taxExemption = 0) { 33 34 35 37 38 39 2000; taxAmount = taxamount taxExemption taxExemption + 2000; 29 401 41) return taxAmounte } else i.e., taxAmount <0 return 0; 36 } else i.e., taxExemption > 8000 taxAmount = taxAmount + (taxExemption - 8000 return taxAmount: Your Tasks (1) Draw the control flow graph for this program. (2) Design test cases to achieve the 100% statement coverage on the function "computeTax" (list the statements covered by each test case using the line number of each statement). If 100% statement coverage is not feasible, explain the reason. Use the minimum number of test cases to achieve the 100% statement coverage. (3) Design test cases to achieve 100% branch coverage on the function "computeTax" (list the branches covered by each test case). If 100% branch coverage is not feasible, explain the reason. Use the minimum number of test cases to achieve 100% branch coverage. (4) Design test cases to achieve loop coverage on the function "computeTax" (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. Special Instructions Test cases should be presented in a table with each row showing the following: Test ID #, input data, statements/branches/loops covered by the test case, expected output and % coverage. You may add additional columns to display key variables such as tax exemption. Code coverage should be shown by listing the statements (using line numbers) for each test case. What to Submit Combine all of your graphs and tables into a SINGLE Word or PDF Document; You may also submit a single Excel file with a separate sheet for each problem. Clearly label each section of your submission Assessment Rubric Control flow graph - 10 points Statement coverage - 25 points Branch coverage - 30 points Loop coverage - 20 points Explanations and quality of presentation - 15 points Screenshot You are required to complete the tasks described below. Test program 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 // childhistl: 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) { 2 3 4 5 7 8 9 10 double taxAmount 0.0; double incomeAmount = 0.0: 20 21 // calculate the income amount for (int i = 0; i < incomeList.length; i++) { income Amount = income Amount + incomeList[i]; 6 } taxAmount incomeAmount * 0.02; } else if (incomeAmount. > 40000 && incomeAmount. 80000 && income Amount 120000) { 13} 14 taxAmount = 800 2800+ 4800 income Amount * 0.17; 15 } 23 // calculate the basic tax if income ount 0) { 19 if (childList[numOfChild 11 <18) { taxAmount = taxAmount - 4000; taxExemption = taxExemption + 4000; 22 } numOfChild--; www Screenshot // calculate the tax exemption from having parents. 25 for (int j = 0; j < parentlist.length; itt) ( if (parentlist[i]> 60) { 26 27 28 301 // the maximum tax exemption is 8000 each person 31 if (taxExemption = 0) { 33 34 35 37 38 39 2000; taxAmount = taxamount taxExemption taxExemption + 2000; 29 401 41) return taxAmounte } else i.e., taxAmount <0 return 0; 36 } else i.e., taxExemption > 8000 taxAmount = taxAmount + (taxExemption - 8000 return taxAmount: Your Tasks (1) Draw the control flow graph for this program. (2) Design test cases to achieve the 100% statement coverage on the function "computeTax" (list the statements covered by each test case using the line number of each statement). If 100% statement coverage is not feasible, explain the reason. Use the minimum number of test cases to achieve the 100% statement coverage. (3) Design test cases to achieve 100% branch coverage on the function "computeTax" (list the branches covered by each test case). If 100% branch coverage is not feasible, explain the reason. Use the minimum number of test cases to achieve 100% branch coverage. (4) Design test cases to achieve loop coverage on the function "computeTax" (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. Special Instructions Test cases should be presented in a table with each row showing the following: Test ID #, input data, statements/branches/loops covered by the test case, expected output and % coverage. You may add additional columns to display key variables such as tax exemption. Code coverage should be shown by listing the statements (using line numbers) for each test case. What to Submit Combine all of your graphs and tables into a SINGLE Word or PDF Document; You may also submit a single Excel file with a separate sheet for each problem. Clearly label each section of your submission Assessment Rubric Control flow graph - 10 points Statement coverage - 25 points Branch coverage - 30 points Loop coverage - 20 points Explanations and quality of presentation - 15 points Screenshot
Expert Answer:
Answer rating: 100% (QA)
Income Calculation Lines 5 and 6 calculate the total income by iterating through the incomeList array and adding each element to the incomeAmount variable Tax Calculation based on Income Slabs Lines 7 ... View the full answer
Related Book For
Income Tax Fundamentals 2013
ISBN: 9781285586618
31st Edition
Authors: Gerald E. Whittenburg, Martha Altus Buller, Steven L Gill
Posted Date:
Students also viewed these programming questions
-
CANMNMM January of this year. (a) Each item will be held in a record. Describe all the data structures that must refer to these records to implement the required functionality. Describe all the...
-
Broadmore Corporation acquired 75 percent of Stem Corporations common stock on January 1, 20X8, for $435,000. At that date, Stem reported common stock outstanding of $300,000 and retained earnings of...
-
What competitive thinking moved Volkswagen, one of the world's major automakers, to cheat on emission standards rather than comply with them? How could Volkswagen have prevented this scandal, and...
-
Suppose that, when setting up the experiment in Problem 11.54, the operations manager is able to study the effect of side-to-side aspect in addition to air-jet pressure. Thus, instead of the...
-
What are some of the most significant problems facing indigenous people in the current-day world?
-
Dean Brothers Corp. owns and operates a steel drum manufacturing plant. Lowell Wyden, the plant superintendent, hired Best Security Patrol, Inc. (BSP), a security company, to guard Dean Property and...
-
In the matrix of pressures for cost reduction vs pressures for local adaptation which is the best strategy that allows MNCs to learn from subsidiaries and transfer knowledge between these...
-
Jones Archaeology began 2018 with retained earnings of $180,000. During 2018, Jones made sales of $832,000 with 56% of sales allocated to cost of goods sold. Selling and administrative expense for...
-
A company is involved in a lawsuit where it is probable that it will have to pay a fine. The company does not dispute the facts, only the amount it should be required to pay. At year-end, the...
-
Give examples of two variables that you expect to be positively correlated. Explain why the variables are correlated and why the correlation is (or is not) important.
-
What would happen if you do not decide on the issue immediately?
-
Contact a local commercial realtor and obtain a copy of a valuation he or she has performed on an investment property in your general geographic area. a. Review the analysis and critically evaluate...
-
The gravitational force between two spherical celestial bodies, one of mass \(2 \times 10^{12} \mathrm{~kg}\) and the other of mass \(5 \times 10^{20} \mathrm{~kg}\), has a magnitude of \(3 \times...
-
Explain the economic impact of the US civil war in detail.
-
Study the pictures/images below. Obviously these was focus on LT sociology, anthropology and poltical science. Try to do some analysis by finding clues that are synonymous with the main concepts....
-
Leslie is a single taxpayer who is under age 65 and in good health. For 2012, she has a salary of $23,000 and itemized deductions of $1,000. Leslie is entitled to one exemption on her tax return. a....
-
Carol Harris, Ph.D, CPA, is a single taxpayer and she lives at 674 Yankee Street, Durham, NC 27409. Her Social Security number is 793-52-4335. Carol is an Associate Professor of Accounting at a local...
-
Kent Pham, CPA, is a 45-year-old single taxpayer living at 169 Trendie Street, La Jolla, CA 92037. His Social Security number is 865-68-9635. In 2012, Kent's W-2 as the controller of a local...
-
Solve Prob. 8-48 using Castigliano's theorem. Data From Problem 8.48 = ABC 6.5(103) mm IBC 100(10) mm+ AAB = 18(10) mm IAR 400(10) mm+ DA = 3 m B -50 kN 1 m
-
Solve Prob. \(8-48\), including the effect of shear and axial strain energy. Data From Problem 8.48 = ABC 6.5(103) mm = = IBC 100(106) mm* AAB - 18(103) mm = TAR 400(10) mm A 3 m B -50 kN 1 m
-
Solve Prob. 8-40 using Castigliano's theorem. Data From Problem 8.40 2 k/ft 8 ft 8 ft B
Study smarter with the SolutionInn App