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...
-
Describe the strategies market challengers can adopt and explain why challengers might have an advantage over market leaders?
-
A colored dye compound decomposes to give a colorless product. The original dye absorbs at 608 nm and has an extinction coefficient of 4.7 104 M-1 cm-1 at that wavelength. You perform the...
-
A project has been selected for implementation. The net cash flow (NCF) profile associated with the project is shown below. MARR is 10 percent/year. a. What is the internal rate of return of this...
-
Tsang, Inc., is considering the sale of two bond issues. Choice A is a $1,600,000 bond issue that pays semiannual interest of $128,000 and is due in 20 years. Choice B is a $1,600,000 bond issue that...
-
If then A-1: = A 0 ^= [1791] X.
-
Conversion cost is the sum of: a. direct materials cost and direct labor cost. b. indirect labor cost and overhead cost. c. product costs and period costs. d. direct labor cost and overhead cost.
-
A customer uses a store credit card to purchase a boat for $10,500. The store credit card offers an annual interest rate, compounded continuously, of 18.99% with no payments due for the first two...
-
Mulan Co. sells used cars. It currently has 120 cars in its inventory, costing a total of $750,000. Mulan was recently offered $1,250,000 to sell the business, cars included. It expects to receive a...
-
Sarah purchased a condominium at Tulip Meadows. She pays $3196, 80 in property taxes each year. These taxes are taken out of her monthly maintenance fee of $1480. What percentage of this monthly fee...
-
What is the ones digit in the number 22001 ? Hint: Start with smaller exponents to find a pattern.
-
What role does static visibility have towards leadership capabilities? What role does dynamic visibility have towards leadership capabilities? What role does SCEM have towards leadership...
-
Nowadays employees are expected to master various competencies in order to ensure their promotions. One of the highlighted competencies is an employee's ability to be emotionally intelligent. Explain...
-
What are the key dimensions of critical thinking 2. Watch the NBC Learn video on Diet Scams. What types of claims are made in this video Are they valid Elaborate on your responses. Discuss this video...
-
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...
-
Use five different websites to investigate three companies in your career field. Look at salary guides for your level of qualifications, product/service information, news articles about the...
-
Interview someone working in a field youre interested in. Use the following questions to get started: How did you get started in this field? What do you like about your job? What do you dislike...
-
Using a cover letter you have written, review your online presence. What key words do you see in your social networking profiles? What job experience, education, and skills are highlighted? How can...
Study smarter with the SolutionInn App