20 Points Triangle Problem
20 Points Triangle Problem
1. Triangle Problem
if(a < b+c && b < a+c && c < a+b) { // if triangle
if(a == b && b == c)
return "Equilateral";
else if(a != b && a != c && b != c)
return "Scalene";
else
return "Isosceles";
} else
return "Not a triangle";
a) Label the above code with node numbers for the CFG
b) Draw the CFG
c) Identify and list independent paths
d) Develop test cases based on (c) above
e) Finally, develop Junit test cases
Submission: For parts (A) – (D) develop a PDF document that contain answers. For
part (E) submit your Junit test cases and the corrected Java program. Finally make a zip
file containing your answers and submit online.
2. Is Mod 10 Program
(A) Develop the control flow graph for the above function
(B) Identify independent paths and list them
(C) Develop test cases based on your independent paths
(D) Develop Junit test cases to test your application based
on control flow graph
(E) This code has main bugs, identify the bug in this code
using your test cases and correct it.