Академический Документы
Профессиональный Документы
Культура Документы
(10B1WCI575)
Submitted By:
Aishwarya Saxena
Roll No: 121218
Batch: B1
Index
S. No.
Name
Date
Remarks
Aim:
To learn about equivalence class partitioning and boundary value analysis and make test
cases of certain programs.
Question 1:
Consider the program done in lab1 for comparing of two numbers and design the various test
cases using Equivalent classes (Strong & Week) and BVA techniques.
Output
2147483647
a>b
2147483646
a>b
a=b
-2147483647
a<b
-2147483648
a<b
2147483647
a<b
2147483646
a<b
-2147483647
a<b
-2147483648
a<b
Output
1.
2500
5560
Valid
2.
-2147483790
-2147499748
Invalid
3.
2147483999
2147483999
Invalid
a
0
0
0
-2147483790
-2147483790
-2147483790
2147483999
2147483999
2147483999
b
-2147483790
0
2147483999
-2147483790
0
2147483999
-2147483790
0
2147483999
Output
Invalid
Valid
Invalid
Invalid
Invalid
Invalid
Invalid
Invalid
Invalid
Question 2:
Consider the program done in lab1 in assignment section for problem 1 & 2 and design the
various test cases using Equivalent classes (Strong & Week) and BVA techniques.
a
2147483647
2147483646
0
-2147483647
-2147483648
0
0
b
0
0
0
0
0
2147483647
2147483646
Output
Print Even number
Print Even number
0
Print Even number
Print Even number
Print Even number
Print Even number
a
2500
-2147483790
2147483999
b
5560
-2147499748
2147483999
Output
Print Even number
Invalid
Invalid
a
0
20
0
-2147483790
-2147483790
-2147483790
2147483999
2147483999
2147483999
b
-2147483790
30
2147483999
-2147483790
0
2147483999
-2147483790
0
2147483999
Output
Invalid
Valid
Invalid
Invalid
Invalid
Invalid
Invalid
Invalid
Invalid
Question 4:
Consider a class that represents a ticket purchased for an event at a theatre.
a) Program:
import java.io.*;
class IllegalValueException extends Throwable{
/**
*
*/
private static final long serialVersionUID = 1L;
private double a;
IllegalValueException(double e){
a=e;
}
}
public class TheatreTicket{
private double price;
private int row;
private int seat;
public double getPrice(){
return price;
}
public void setPrice(double amount)throws IllegalValueException{
if(amount<=0)
throw new IllegalValueException(amount);
else{
price=amount;
System.out.println("Price of the ticket is: "+this.getPrice());
}
}
public void setLocation(int r, int s){
if(r>0 && r<=50 && s>0 && s<=100){
row=r;
seat=s;
}
else
System.out.println("Invalid Location");
}
public static void main(String[] args) throws IOException {
double amt;
int r,c;
TheatreTicket t=new TheatreTicket();
BufferedReader br=new BufferedReader(new InputStreamReader(System.in));
System.out.println("Enter the amount of ticket");
try{
amt=Double.parseDouble(br.readLine());
t.setPrice(amt);
}
catch(IllegalValueException e){
System.out.println("Illegal Value");
}
catch(IOException ie){
System.out.println("Illegal Value");
}
}
}
Row
25
25
0
49
Output
valid
valid
valid
valid
Seat<0
0<=seat<=100
Seat>100
Row<0
0<=row<=50
Row>50
Test Case ID
1
2
3
4
Seat
-20
45
110
50
Row
-3
25
50
67
Output
invalid
valid
invalid
invalid