Question
A. Need to provide the control flow graph, test requirements (TR) and the test paths for: 1. Node Coverage 2. Edge Coverage 3. Edge pair
A. Need to provide the control flow graph, test requirements (TR) and the test paths for:
1. Node Coverage
2. Edge Coverage
3. Edge pair coverage
Java Code:
package isu.edu;
import java.lang.Math;
import java.util.Scanner;
public class Quadratic
{
private static double Root1, Root2;
public static void main (String[] argv)
{
int X, Y, Z;
Scanner scan = new Scanner(System.in); System.out.print("Enter 3 integers sperated by
spaces: ");
String line=scan.nextLine(); String []arr=line.split(" "); boolean ok;
if (arr.length == 3)
{
try
{
X = Integer.parseInt (arr[0]); Y = Integer.parseInt (arr[1]); Z = Integer.parseInt (arr[2]);
}
catch (NumberFormatException e)
{
System.out.println ("Inputs not three integers, using 8, 10, -33.");
X = 8;
Y = 10;
Z = -33;
}
}
else
{
System.out.println ("Inputs not three integers, using 8, 10, -33.");
X = 8;
Y = 10;
Z = -33;
}
ok = Root (X, Y, Z);
if (ok) System.out.println
("Quadratic: Root 1 = " + Root1 + ", Root 2 = "
+ Root2);
else
System.out.println ("No solution.");
}
private static boolean Root (int A, int B, int C)
{
double D;
boolean Result;
D = (double)(B*B) - (double)(4.0*A*C);
if (D < 0.0)
{
Result = false;
return (Result);
}
Root1 = (double) ((-B + Math.sqrt(D)) / (2.0*A)); Root2 = (double) ((-B - Math.sqrt(D)) / (2.0*A)); Result = true;
return (Result);
} }
Step by Step Solution
3.49 Rating (156 Votes )
There are 3 Steps involved in it
Step: 1
To analyze the provided Java code lets start by creating the control flow graph CFG identifying test ...Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started