Software Testing
Arithmetic Operation
a = create_input_dialog(“Enter the first number:”);
b = create_input_dialog(“Enter the second number:”);
pause(“1.add 2.sub 3.mul 4.div”);
ch = create_input_dialog(“Enter the choice:”);
switch(ch)
{
case 1:
c = a+b;
pause(c);
break;
case 2:
c = a-b;
pause(c);
break;
case 3:
c = a*b;
pause(c);
break;
case 4:
c = a/b;
pause(c);
break;
}
Factorial
n = create_input_dialog(“Enter the No:”);
f = 1;
for(i=1;i<=n;i++)
{
f = f*i;
}
pause(f);
Fibonacci Series
n = create_input_dialog(“Enter any number:”);
f1 = -1;
f2 = 1;
for ( i =1; i<=n; i++)
{
f3 = f1+f2;
f1 = f2;
f2 = f3;
pause(f3);
}
Student Marklist
a = create_input_dialog(“Enter the no. Of student:”);
for ( i = 0; i <= a; i++)
{
name = create_input_dialog(“Enter Name:”);
reg = create_input_dialog(“Enter reg:”);
course = create_input_dialog(“Enter Course:”);
m1 = create_input_dialog(“Enter m1:”);
m2 = create_input_dialog(“Enter m2:”);
m3 = create_input_dialog(“Enter m3:”);
m4 = create_input_dialog(“Enter m4:”);
m5 = create_input_dialog(“Enter m5:”);
tot = m1+m2+m3+m4+m5;
pause(tot);
avg = tot/5;
pause(avg);
if ((m1>=40) && (m2>=40) && (m3>=40) && (m4>=40) && (m5>=40)) then
result = “pass”;
else
result = “fail”;
if((result==”pass”) && (avg>=90)) then
grade = “distinction”;
else if ((avg >= 70) && (avg <90)) then
grade = “I class”;
else if ((avg >= 60) && (avg <70)) then
grade = “II class”;
else
grade = “III class”;
pause(grade);
}
Employee Payroll
a = create_input_dialog(“Enter no. of emp:”);
for ( i = 0; i <=a; i++)
{
name = create_input_dialog(“Name of emp:”);
age = create_input_dialog(“Age of emp:”);
bp = create_input_dialog(“basic pay:”);
da = bp * 0.50;
pause(da);
hra = bp * 0.10;
pause(hra);
pf = bp * 0.20;
pause(pf);
loan = bp * 0.20;
pause(loan);
gp = bp + da + hra;
pause(gp);
ded = loan + pf;
pause(ded);
net = gp - ded;
pause(net);
}
Telephone Bill
a = create_input_dialog(“Enter no. of customer:”);
for ( i = 0; i <= a; i++)
{
billno = create_input_dialog(“Bill no:”);
calls = create_input_dialog(“calls:”);
if( calls > 200) then
amt = calls * 0.5;
else if ( calls <= 200) then
amt = (100*0.5) + (calls – 100) * 1;
else
amt = (100*0.5+100) + (calls – 200) * 2;
pause(amt);
}
Electricity Bill
a = create_input_dialog(“Enter no. of customer:”);
for ( i = 0; i <= a; i++)
{
name = create_input_dialog(“Name of Emp:”);
bill = create_input_dialog(“Bill No:”);
date = create_input_dialog(“Date:”);
unit = create_input_dialog(“Unit:”);
if ( unit <= 200) then
amt = (100*0.80) + (unit – 100) * 1;
else
amt = (100*0.80) + 100*1+ (unit – 200) * 1.50;
pause(amt);
}
Batch Mode Testing
for ( i = 1; i <=2; i++)
{
call “D:\\New Folder\\test1”();
call “D:\\New Folder\\test2”();
}
Comments
Post a Comment