0% found this document useful (0 votes)
13 views49 pages

Files 3 2021 December NotesHubDocument 1640176508

The document contains code for several C++ programs. The first program takes user input for coefficients a, b, and c of a quadratic equation and determines if the roots are real, imaginary, or equal. The second program takes side lengths as input and determines if a triangle is possible and if so, what type of triangle it is. The third program takes angle measurements as input to determine what type of triangle they form. The last program contains code for basic banking transactions like deposit, withdraw, and balance checks with input validation.

Uploaded by

Yuvraj
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
13 views49 pages

Files 3 2021 December NotesHubDocument 1640176508

The document contains code for several C++ programs. The first program takes user input for coefficients a, b, and c of a quadratic equation and determines if the roots are real, imaginary, or equal. The second program takes side lengths as input and determines if a triangle is possible and if so, what type of triangle it is. The third program takes angle measurements as input to determine what type of triangle they form. The last program contains code for basic banking transactions like deposit, withdraw, and balance checks with input validation.

Uploaded by

Yuvraj
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 49

SOURCE CODE:

#include<iostream>
using namespace std;

int main()
{

int a,b,c,d;

cout<<"The quadratic equation is of the type a(x^2) + bx + c = 0"<<endl;


cout<<"Enter a : "<<endl;
cin>>a;
cout<<"Enter b : "<<endl;
cin>>b;
cout<<"Enter c : "<<endl;
cin>>c;

d = (b*b)- (4*a*c);

if((a<1)|| (b<1)|| (c<1)|| (a>100)|| (b>100)|| (c>100)){


if(a==0)
cout<<"Not a Quadratic Equation"<<endl;
else
cout<<"Out of domain Input"<<endl;
}
else if(d==0)
cout<<"Equal Roots"<<endl;

else if(d>0)
cout<<"Real Roots"<<endl;

else //if d<0


cout<<"Imaginary Roots"<<endl;

return 0;
}

OUTPUTS:
SOURCE CODE:

#include<iostream>
using namespace std;

int main()
{

int side1, side2, side3;

cout<<"Determining the type of Triangle"<<endl;


cout<<"Enter side1 : "<<endl;
cin>>side1;
cout<<"Enter side2 : "<<endl;
cin>>side2;
cout<<"Enter side3 : "<<endl;
cin>>side3;

if((side1<1)||(side2<1)||( side3<1)||(side1>100)||(side2>100)||(side3>100))
cout<<"Out of domain Input"<<endl;

else if ((side1 + side2 > side3 && side1 + side3 > side2 && side2 + side3 > side1) && (side1 >
0 && side2 > 0 && side3 > 0))
{
if (side1 == side2 && side2 == side3)
cout<<"Equilateral Triangle"<<endl;
else if (side1 == side2 || side2 == side3 || side1 == side3)
cout<<"Isosceles Triangle"<<endl;
else
cout<<"Scalene Triangle"<<endl;
}
else {
cout<<"Triangle not possible"<<endl;
}
return 0;
}
OUTPUTS:
SOURCE CODE:

#include<iostream>
using namespace std;
int main()
{
double a,b,c,a1,a2,a3;
int valid = 0;
cout<<"Enter first angle of the triangle: ";
cin>>a;
cout<<"Enter second angle of the triangle: ";
cin>>b;
cout<<"Enter third angle of the triangle: ";
cin>>c;

if(a>0 && a<=100 && b>0 && b<=100 && c>0 && c<=100)
{
if((a+b) > c && (b+c) > a && (a+c) >b)
valid = 1;
else
valid = -1;
}

if(valid==1) {
a1 = (a*a + b*b)/(c*c);
a2 = (b*b + c*c)/(a*a);
a3 = (c*c + a*a)/(b*b);

if(a1<1 || a2<1 || a3<1)


cout<<"Obtuse-angled triangle";
else if(a1==1||a2==1||a3==1)
cout<<"Right-angled triangle";
else
cout<<"Acute-angled triangle";
}
else if(valid == 1)
cout<<"Invalid triangle";
else
cout<<"Out of range";
return 0;
}
OUTPUTS:
SOURCE CODE:

#include<bits/stdc++.h>
using namespace std;
static int balance=1000;

bool isAlphaNum(string s)
{
for(int i=0;i<s.size();i++)
{
if(!((s[i]>='A' && s[i]<='Z') || (s[i]>='a' && s[i]<='z') && (s[i]>='0' && s[i]<='9' )))
{
return false;
}
}
return true;
}

void withdraw()
{
int amnt;
cout<<"Enter amount to be withdrawn: "<<endl;
cin>>amnt;

if(balance<amnt)
{
cout<<"Not Enough balance!"<<endl;
}
else
{
balance -= amnt;
cout<<"Withdrawn Successfully"<<endl;
}
}

void check()
{
cout<<"Current Balance= "<<balance<<endl;
}

void deposit()
{
int dep;
cout<<"Enter amount to be deposited: "<<endl;
cin>>dep;
if(dep>=0)
{
balance += dep;
cout<<"Amount deposited Successfully"<<endl;
}
else
{
cout<<"Enter positive amount"<<endl;
}
}

int main()
{

string alphapass="";
string areacode;
cout<<"Enter Area Code: "<<endl;
getline(cin, areacode);

if(!(areacode.length()==0 || (areacode.length()==3)))
{
cout<<"Invalid Area Code"<<endl;
}

string pre;
cout<<"Enter 3 digit Prefix: "<<endl;
getline(cin,pre);

int prefix = stoi(pre);


if(!(prefix/100>1 && prefix/1000==0))
{
cout<<"Invalid Prefix"<<endl;
}

string suffix;
cout<<"Enter 4 digit Suffix: "<<endl;
getline(cin, suffix);

if(suffix.length()!=4)
{
cout<<"Invalid Suffix"<<endl;
}

cout<<"Enter 6 character alphanumeric Password: "<<endl;


getline(cin, alphapass);

if(alphapass.length()!=6)
{
cout<<"Invalid Password"<<endl;
}
else if(!(isAlphaNum(alphapass)))
{
cout<<"Password not alphanumeric"<<endl;
}

char ch='y';
while(ch=='y'||ch=='Y')
{
int command;
cout<<"Select Command : \n1.Check Status\n2.Deposit\n3.Withdraw"<<endl;
cin>>command;
switch(command)
{
case 1: check();
break;
case 2: deposit();
break;
case 3: withdraw();
break;
default: cout<<"Choice not Available"<<endl;
}
cout<<"Do you wish to continue? (y/n):";
cin>>ch;
}
}

OUTPUTS:
WINRUNNER:
SELENIUM:
QA COMPLETE:
SCREENSHOTS OF TEST SCENARIOS

Test Case ID: 1 Test Case ID: 2 Test Case ID: 3

Test Case ID: 4 Test Case ID: 5 Test Case ID: 8 & 11
Test Case ID: 12 & 13 Test Case ID: 14 Test Case ID: 14

Test Case ID: 17 Test Case ID: 18 Test Case ID: 24


Test Case ID: 25 Test Case ID: 26 Test Case ID: 27

Test Case ID: 28

You might also like