Question: Below is the program listing for which I would like to answer the questions from 1 to 4. It is not a working program. It
Below is the program listing for which I would like to answer the questions from 1 to 4. It is not a working program. It is related to structural testing.
(a).Use structured programming constructs to draw the program graph
(b) Compute the cyclomatic complexity
(c) Determine a set of basis paths through the graph
(d) The test cases that will exercise the basis paths by determining the outcomes of the conditions at each of the predicate nodes in the program graph. Present the test cases in a table for easy understanding.
1. public static void main(String[] args) {
2. double a1 = 1.0;
3. double a2 = 2.0;
4. double a3 = 3.0;
5. if (c1) {
6. r1 = rate * 1.1;
7. r2 = rate * 2.1;
8. } else {
9. r3 = rate * 3.1;
10. r4 = rate * 4.1; }
11. while (c2) {
12. a5 = r1 * r3;
13. a6 = r2 * r4;
14. switch (c3) {
15. case 'A1':
16. a7 = a1 + a5;
17. a8 = a3 * a2;
18. break; // End Case A1
19. case 'A2':
20. s1 = a5 + a6 ;
21. s2 = s1 * a3;
22. if (c4) {
23. s3 = s2 * 1.5;
24. s4 = s2 * 2.0;
25. } else {
26. s3 = s2 * s1;
27. s4 = s2 * s2;}
28. break; // End Case A2
29. case 'A3':
30. s5 = a6 + a5 * a1;
31. s6 = a6 + * (a1 / a2);
32. break; // End Case A3
33. default:
34. System.out.println("Invalid");
35. } // End Switch
36. t1 = s3 * s4;
37. t2 = s3 * s5;
38. t3 = s4 * s6;
39. if (c5) {
40. t4 = t3 * 9.99;}
41. t5 = t1 + t2 ;
42. } // End While
43. System.out.println("Computation complete!");
44. }
I tried a little and got it something like attached. I am not sure if it is correct. Have a look and please correct it and also help me in answering the other questions above.
There are few answers already posted on this, I did not find them right. So please do on your own and give me a solution please.

--" 10 14 34 31 35 24 --" 10 14 34 31 35 24
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
