Question: A) [4pt/ Draw the control flow graph (CFG) for the following code segment NMNMM 18 19 1 public double calculateTotalcost int amount, boolean nextday) 2

 A) [4pt/ Draw the control flow graph (CFG) for the following

A) [4pt/ Draw the control flow graph (CFG) for the following code segment NMNMM 18 19 1 public double calculateTotalcost int amount, boolean nextday) 2 3. double fee = 0; 4 $ 11 (next day) 6 fee = 18; 8 1 9 10 double tax amount. 0.15; 11 12 if (amount >= 1000) 13 14 charge amount = 0.09 - fee; 15 1 15 else if (amount >- 500) 17 charge - amount. 0.07 + fee; 1 20 else if (amount > 200) 21 22 charge - 15 + fee; 23 24 else if (amount >- 100) 25 26 charge - 12 + fee: 27 1 28 else if (amount > 50) 29 1 30 charge - 10 fee: 31 1 32. else 33 34 charge - 6 fee: 35 1 35 37 total - amount + tax + charge: 39 return total; 40 41 Wend N NNNNNNNNN DOWNHOOL B) [1pt] Calculate the cyclomatic complexity of the CFG C) 13pt/ Based on the path testing technique; find the generated independent paths from this CFG

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!