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

1 Expert Approved Answer
Step: 1 Unlock

To analyze the provided Java code lets s... View full answer

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 Programming Questions!