Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

You are required to complete the tasks described below. Test program The following program has been implemented for a newly proposed tax calculation formula

   

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 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 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

Step by Step Solution

There are 3 Steps involved in it

Step: 1

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 ... 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

Income Tax Fundamentals 2013

Authors: Gerald E. Whittenburg, Martha Altus Buller, Steven L Gill

31st Edition

1111972516, 978-1285586618, 1285586611, 978-1285613109, 978-1111972516

More Books

Students also viewed these Programming questions

Question

Write a Python program to check an input number is prime or not.

Answered: 1 week ago