Question: Use the program listing below to answer the questions that follow. Note that this is not a working program. The intent of the assignment is

Use the program listing below to answer the questions that follow. Note that this is not a working program. The intent of the assignment is for you to apply your knowledge of structural testing to answer the accompanying testing questions.

1. public static void main(String[] args) {

2. double a1 = 1.0;

3. double a2 = 2.0;

4. double a3 = 3.0;

5. if (cl) {

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

(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) Create the test cases that will exercise the basis paths by determining the values of the conditions at each of the predicate nodes in the program graph. Present the test cases in a table for easy understanding

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!