Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

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 ... blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Management and Cost Accounting

Authors: Colin Drury

8th edition

978-1408041802, 1408041804, 978-1408048566, 1408048566, 978-1408093887

More Books

Students also viewed these Programming questions

Question

18. What kind of cell releases cytokines?

Answered: 1 week ago

Question

3. How do epinephrine and cortisol enhance memory storage?

Answered: 1 week ago