Question

Use the program listing below to answer the questions that follow. Note that this is not...

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

0 0
Add a comment Improve this question Transcribed image text
Answer #1

rogram aph 3 Fase True prt sc sysrq False 12. 13 shift Case A1 14 defaul Case A2 29 2022 34 23 2 6 24 27 3536 33833 brea fals2) elom ai Com plexity E no. of Edge NうnD.0/ nodes P5+1 6 )There are 16 bauis pat mough a ph No of different pehs followed Ca

Add a comment
Know the answer?
Add Answer to:
Use the program listing below to answer the questions that follow. Note that this is not...
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for? Ask your own homework help question. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
  • Assignment 4 File “quad_sol.s” contains a quadratic polynomial solver, which calculates the integer solution of a quadratic polynomial equation. 1. Rewrite the program using instructions reordering to...

    Assignment 4 File “quad_sol.s” contains a quadratic polynomial solver, which calculates the integer solution of a quadratic polynomial equation. 1. Rewrite the program using instructions reordering to reduce the number of cycles needed to execute the program. Indicate the number of cycle reduction. 2. Describe how forwarding would affect the execution of the program. CODE # quad_sol.s # This assembly program calculates the integer solutions of a quadratic polynomial. # Inputs : The coefficients a,b,c of the equation a*x^2 +...

  • The following space-time diagram depicts an asynchronous message-passing execution. (a) Determine the integer timestamp of each...

    The following space-time diagram depicts an asynchronous message-passing execution. (a) Determine the integer timestamp of each event in the above execution. (b) Determine the vector timestamp of each event in the above execution. (c) Identify all of the events that are concurrent with s5. (d) Identify all of the events that happen before r3. T1 T2 T3 T4 s1 r1 s4 s2 r4 r2 $3 35 r3 r5

  • im trying to complete mips program code about a calculator program that can calculate integer addition...

    im trying to complete mips program code about a calculator program that can calculate integer addition / subtraction written using the MIPS assembler. im having hard times to debug this. The input is given to the array of Formula char (base address $ s0) in the form of a formula. The null character (\ 0, ASCII code 0) is placed at the end. The calculation result is given to the register $ s1 and the overflow is ignored. For example,...

  • 1. Use the following table to answer a-d. The payoffs are in BENEFITS. a.   In a...

    1. Use the following table to answer a-d. The payoffs are in BENEFITS. a.   In a situation of uncertainty, what is the best alternative? [Use the expected value criteria to find the associated payoffs for each alternative and choose the best one.]             S1 (p=.25) S2 (p=   ) S3 (p=.25) S4 (p=.2) A1 30 10 30 30 A2 0 65 35 15 A3 15 45 10 10 A4 35 25 15 10 b. Construct a regret table using the table...

  • 2.  Use the following table to answer a-d. The payoffs are in COSTS. S1 (p=.3) S2 (p=.2)...

    2.  Use the following table to answer a-d. The payoffs are in COSTS. S1 (p=.3) S2 (p=.2) S3 (p=.2) S4 (p=.3) A1 5 0 10 25 A2 35 65 0 0 A3 20 50 5 35 A4 0 10 15 20 a.   In a situation of uncertainty, what is the best alternative? [Use the expected value criteria to find the associated payoffs for each alternative and choose the best one.]             b. Construct a regret table using the table above. S1...

  • Construct the example of the temporary end (TND) program shown. Demonstrate how this instruction can be...

    Construct the example of the temporary end (TND) program shown. Demonstrate how this instruction can be used to progressively debug the program. Use the I/O Simulator screen and the following addresses to simulate the program: S1 _ I:1/0 S2 _ I:1/1 S3 _ I:1/2 S4 _ I:1/3 S5 _ I:1/4 S6 _ I:1/5 S7 _ I:1/6 PL1 _ O:2/0 PL2 _ O:2/1

  • 2. Use the following table to answer a-d. The payoffs are in COSTS. Decision\ State of...

    2. Use the following table to answer a-d. The payoffs are in COSTS. Decision\ State of Nature S1 S2 S3 S4 A1 10 35 25 15 A2 10 15 45 10 A3 15 0 65 35 A4 30 30 10 30 Using different criteria identify, what is the best alternative and associated payoff? a. Optimistic criterion:   Decision:________ b. Pessimistic criterion ______________________________ Decision:________

  • I. [15%) Which one causes compilation is deleted, what is the output when the program is...

    I. [15%) Which one causes compilation is deleted, what is the output when the program is executed? statement from sl to s6 (see below) cause compilation error? Assume the statement that class X void 120 f System.out.println("XXX");3 Answeri The statement causes compilation errors: class Y extends X void £20 1 System.out.printin("YYY"); void f30 &System.out.printin"AAA"): class Z extends Y void 120 ( System.out.printin"zzz; void 130 System.out.println("BBB"); The output of the program (after the statement that causes compilation is deleteod) class Testf...

  • Please comment the MIPS code to help me understand. Here is what the code accomplishes. Here...

    Please comment the MIPS code to help me understand. Here is what the code accomplishes. Here is the code, partially commented. .data Matrix: .word 41,45,5, 34,8, 15,16,23,44,48,12,32,18,47,22,8,22 .word 46,40,42,33,13,38,27,6, 29,25,18,40,47,22,26,14,3 .word 7, 48,35,9, 43,38,9, 49,28,25,42,5, 44,10,5, 38,14 .word 46,33,16,6, 13,20,31,1, 8, 17,1, 47,28,46,14,28,7 .word 32,2, 48,25,41,29,14,39,43,46,3, 39,32,49,41,28,46 .word 5, 43,2, 48,13,4, 33,41,32,19,9, 25,30,22,2, 9, 40 .word 14,47,22,18,47,3, 35,44,18,6, 33,22,11,6, 47,50,4 .word 28,34,20,30,18,27,38,5, 26,40,37,23,16,13,37,8,7 .word 48,38,39,12,10,39,23,20,21,20,33,16,24,21,25,3,46 .word 49,38,40,38,13,47,5, 13,4, 13,23,26,12,30,29,29, 3 .word 8, 20,10,13,31,7, 12,41,12,21,28,26,43,14,35,10,19 .word 49,33,25,26,24,29,46,22,7, 5, 15,41,10,31,19,41,27 .word 48,9,...

  • SQL- REM, or short for REMARK, is used in SQL to indicate the beginning of a...

    SQL- REM, or short for REMARK, is used in SQL to indicate the beginning of a comment in SQL script. drop table Jobskills; drop table Appskills; drop table Applies; drop table Applicant; drop table Skills; drop table Job; drop table Company; create table Company(compid char(5) primary key, compname varchar(20), comptype varchar(15)); create table Job(jobid char(5) primary key, jobtitle varchar(20), salarylow int, salaryhigh int, location char(10), compid references Company(compid) on delete cascade); create table Skills(skillid char(5) primary key, skillname varchar(15)); create...

ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT