-
Notifications
You must be signed in to change notification settings - Fork 1
/
SW_BoundaryValueAnalysis.java
48 lines (45 loc) · 1.49 KB
/
SW_BoundaryValueAnalysis.java
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
/*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
package software_testing_meaures;
import java.util.Scanner;
/**
*
* @author Suraj Singh
*/
class SW_BoundaryValueAnalysis {
public static void main(String args[])
{
Scanner s = new Scanner(System.in);
int a,b,c,D,low,high;
char choice;
do
{
System.out.print("Enter the range for [a,b,c]=> ");
low = s.nextInt();
high = s.nextInt();
System.out.println(low+"<= a,b,c <="+high);
System.out.println("\nEnter the values of a, b and c ");
a = s.nextInt();
b = s.nextInt();
c = s.nextInt();
D = b*b - 4*a*c;
System.out.print("\n"+a+"x\u00b2+"+b+"x+"+c+" => ");
if(a>high || a<low|| b < low || b > high || c < low || c > high)
System.out.println("Invalid Input... Values Out of Range !!!");
else if(a==0)
System.out.println("Not a Quadratic Equation");
else if(D>0)
System.out.println("Real Roots");
else if(D==0)
System.out.println("Equal Roots");
else if(D<0)
System.out.println("Imaginary Roots");
System.out.println("\nDo you want to continue ? \nY/y to continue. Other key to stop.");
choice = s.next().charAt(0);
System.out.println();
}while(choice=='Y'||choice=='y');
}
}