Advertise Here
Home
About Us
Advertise
Contact Us
Email
Search:    
Hot Articles
 
Get the Latest Posts Delivered to You
Through E-mail
 
 
 
Download Consolidated Study Material for Certification Exams Like
 
 
Tutorial -9: To Find out the Roots of a Quadratic Equation & Generate its Boundary Value Test Cases

Inputs for the Tutorial: A quadratic equation a(x2)+bx+c=0 with input as three positive integers a, b, c having values ranging from an interval [0,100].

Objective of this Tutorial: There are two objectives of the tutorial like:

Objective –1:
To write a Program in C++ for the determining the nature of roots of the above quadratic equation. The program output may have one of the following words:

"Not a Quadratic Equation", "Real Roots", "Imaginary Roots" or "Roots are Equal"

Objective –2: Boundary Value Testing by designing Test Cases which would use input variables at their Minimum Values, Just above Minimum Values, at Nominal Value, Just below Maximum and Minimum Values.

Solution Part – 1: Program in C++

#include
#include
void main( )
{
clrscr( );
int a,b,c,d;
cout<<"The quadratic equation is of the type a(x2)+bx+c=0"<cout<<"Enter the value of a:"<cin>>a;
cout<<"Enter the value of b:"<cin>>b;
cout<<"Enter the value of c: "<cin>>c;
d = (b*b)-4*a*c;
if((a<0)||(b<0)||(c<0)||(a>100)||(b>100)||(c>100))
cout«"Invalid input"«end1;
elseif(a==0)
cout<<"Not a quadratic equation"<elseif(d==0)
cout<<"Roots are equal"<else if(d<0)
cout<<"Imaginary roots"<else
cout<<"Real roots"<getch();
}

Solution Part – 2: Design Boundary Value Test Cases

In the above program, we consider the values as 0 (Minimum), 1 (Just above Minimum), 50 (Nominal), 99 (Just below Maximum) and 100 (Maximum)

Test Case ID

a

b

c

Expected Output

1

50

50

0

Real Roots

2

50

50

1

Real Roots

3

50

50

50

Imaginary Roots

4

50

50

99

Imaginary Roots

5

50

50

100

Imaginary Roots

6

50

0

50

Imaginary Roots

7

50

1

50

Imaginary Roots

8

50

99

50

Imaginary Roots

9

50

100

50

Equal Roots

10

0

50

50

Not a Quadratic Equation

11

1

50

50

Real Roots

12

99

50

50

Imaginary Roots

13

100

50

50

Imaginary Roots

Some of the screenshots with different outputs are as under:

1) Screenshot with Output as " Imaginary Roots" is as under



2) Screenshot with Output as "Real Roots" is as under



3) Screenshot with Output as "Roots are Equal" is as under



4) Screenshot with Output as "Not a Quadratic Equation" is as under





More Articles & Tutorials on Black Box Testing 


General HR Interview Questions Common For All 

Tricky HR Interview Questions Common For All 

If you want to keep track of further articles on Software Testing, I suggest you to subscribe my RSS feed.

You can also Subscribe by E-mail
and get All New articles delivered directly to your Inbox.

Full Study Material for Popular Certification Exams:

Study Material - HP QTP & QC Certification Exam

Study Material - ISTQB Certification Exam

Study Material - HP LoadRunner Certification Exam

Study Material - IBM RFT Certification Exam

Consolidated Study Material - Testing & QA


Most Popular Topics in Demand:

Practical Roadmap to QTP Certification

Practical Roadmap to ISTQB Certification

Practical Roadmap to CSTE Certification


Rehearsal of QTP in 1 Hr. -  Interview Questions
 

 

Comments :

1 comments ↓

# 1 Garrett on 2012-10-10 06:21:55
Good way of describing, and pleasant post to get facts about my presentation subject matter,
which i am going to convey in school.



Leave Your Comments: (*) Marked Fields are Mandatory

You can apply basic formatting to the text

Name *
 
Email Address *
 
Website
 
Speak your mind
characters
 
  Subscribe
 
Sign up to receive daily updates
either via email or RSS!
   
Please use Vertical Scroll Bar
to View More Categories
 
 
     
 
 
advertise | privacy policy | copyright policy | online conduct home | about us | glossary | contact us | blog | email
Copyright © 2012. softwaretestinggenius.com. All Rights Reserved.
Powered By: Cyberframe