Question: Based on this Code create a Control Flow graph for each with corresponding test cases. A minimal set of test cases to ensure statement coverage.
Based on this Code create a Control Flow graph for each with corresponding test cases.
A minimal set of test cases to ensure statement coverage.
A minimal set of test cases to ensure branch coverage.
A minimal set of test cases to ensure condition coverage.
A minimal set of test cases to ensure Def-use coverage.
A minimal set of test cases to ensure Path coverage.
import java.util.Scanner; public class Triangles { public static void main(String[] args) { System.out.println("Enter 3 numbers"); Scanner input = new Scanner(System.in); int a=input.nextInt(); int b=input.nextInt(); int c=input.nextInt(); boolean c1 = 1 <= a & a <= 200; boolean c2 = 1 <= b & b <= 200; boolean c3 = 1 <= c & c <= 200; if (!c1) { System.out.println("Value of a is not in the range of permitted values."); } if (!c2) { System.out.println("Value of b is not in the range of permitted values."); } if (!c3) { System.out.println("Value of c is not in the range of permitted values."); } if (c1 && c2 && c3) { boolean isATriangle; isATriangle = a < b + c & b < a + c & c < a + b; if (isATriangle) { if (a == b & b == c) { System.out.println("Equilateral"); } else if (a != b & a != c & b != c) { System.out.println("Scalene"); } else { System.out.println("Isosceles"); } } else { System.out.println("NotATriangle"); } } } }
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
