MCSL 034 Lab Manual Session - 1: Scope of The Railway Reservation System
MCSL 034 Lab Manual Session - 1: Scope of The Railway Reservation System
MCSL 034 Lab Manual Session - 1: Scope of The Railway Reservation System
Session – 1
Scope of the Railway Reservation System
Creating reservation
Cancel reservation
View reservation status
View train schedule
Generating reports
Update train schedule
Update reservation details
The Seats of Reservation cannot be more than the seats of Train at that date.
This is a constraint that has to be followed by the Clerk when he creates the
Reservation. For that purpose he wants to check the seats remaining present in the
Train.
The scope of this system in creating Reservation is that, from any Railway
Station we can Create Reservation, which is updated automatically in all the
stations. Hence, there is no confusion to the Reservation Clerk in all the stations to
create the Reservation. This can be possible by maintaining Global Database.
Clerks present at different stations can access the global database and the clerks
can easily understand the remaining reservation seats. It provides the ability to
create reservation from different places for a train.
The system is so secured and clerk and manager utilize it. Nobody can able
to access the system without his or her permission because of providing login
facility to the system. The password is in the form of cipher text by using
cryptography technology, so it cannot be hacked by any person. The global
database can passes through network in order to utilized by managers or clerks at
different places. So, we want to provide network security because of the data not
hacked by the other persons when it is going through network cables. This network
security is provided by the cryptography technology.
Session – 2
This session is to estimate the size, effort, schedule, and cost of the railway
reservation project.
The railway reservation project requires 75KBLOC. On the basis of this size of
the project we have to estimate the remaining estimations. We have the formula to
estimate the schedule of the project.
Opinions vary as to whether 2.0 or 2.5 or even 4.0 should be used in place of
the 3.0 value - only by trying it out will you see what works for you.
Of course, you must also keep in mind other important factors that affect the
accuracy of your estimates, such as:
• The accuracy of all the estimate's input data (the old adage, "Garbage in,
Garbage out", holds true)
• The accuracy of any estimate calculations (e.g., converting between
Function Points and LOC has a certain margin of error)
• How closely the historical data or industry data used to calibrate the model
matches the project you are estimating
• The predictability of your organization's software development process, and
whether or not the actual project was carefully planned; monitored and
controlled, and no major surprises occurred that caused unexpected delays.
2
Software
Nominal schedule
Shortest Possible Schedule
Cost
Time
When they analyze the results, most people are startled by the consequences
of different tradeoffs. For example, the following tables provide 3 different
estimate options for a 75 KLOC project:
The difference between the nominal schedule and the shortest schedule for
the project is only a little over two months, but to achieve the shortest schedule the
peak staff has to increase by almost 10 people and the cost increases by over
$870,000! These results should cause someone to ask if a 2-month decrease in the
schedule is worth the cost, and if 10 additional people can be found in time to help
achieve it. For some projects, a schedule decrease may be required at any cost; for
others, it won't be.
3
Software
Nominal Plan
4
Software
Session – 3
Software Requirement Specification for Railway Reservation System
Introduction
Purpose
Scope
Definition
Product and its function
Benefits and Goals
Overall Description
Product Description
Product Functioning
Functions of Project
Users of Project
Specific Requirements
Interface Requirements
User Requirements
Hardware Requirements
Software Requirements
Logical Database Requirements
Input/Output Formats
Instruction for Security
Data Model
Functional Model
5
Software
Introduction
Purpose:
Scope:
Creating reservation
Cancel reservation
View reservation status
View train schedule
Generating reports
Update train schedule
Update reservation details
The Seats of Reservation cannot be more than the seats of Train at that date.
This is a constraint that has to be followed by the Clerk when he creates the
Reservation. For that purpose he wants to check the seats remaining present in the
Train.
The scope of this system in creating Reservation is that, from any Railway
Station we can Create Reservation, which is updated automatically in all the
stations. Hence, there is no confusion to the Reservation Clerk in all the stations to
create the Reservation. This can be possible by maintaining Global Database.
Clerks present at different stations can access the global database and the clerks
can easily understand the remaining reservation seats. It provides the ability to
create reservation from different places for a train.
The system is so secured and clerk and manager utilize it. Nobody can able
to access the system without his or her permission because of providing login
facility to the system. The password is in the form of cipher text by using
cryptography technology, so it cannot be hacked by any person. The global
database can passes through network in order$to utilized!by managers!or clerks at
different places. So, we want to provide network security because of the data not
hacked by the other persons when it is going through network cables. This network
security is pzovided by the cryptograrhy technology.
6
Software
Definition:
The Benefit of this project is to reduce the work of Reservation Clerk and it
is easy to check the remaining seats present in the Train and easily view the
Reservation Status of the Train and tells to the passenger.
The Goals of this project is that, from any Railway Station we can Create
Reservation, which is updated automatically in all the stations. Hence, there is no
confusion to the Reservation Clerk in all the stations to create the Reservation.
Overall Description
Product Description:
The Reservation Clerk gets the details from the passenger and he checks
whether the weats are remaining in order vo grecte`the Reservation. If the seats are
available, then he allocate the seat to the passenger by giving the`Reservation Slip
to the passenger and he Update the Reservation details. If weats`are not`availqble,
hg places the Rewervation in ‘Waiting List’.
The Resmrvation Clerk gets the details from the passenger in order to cancel
the Reservation and Canwels Reserva~ion. He also$Update the!Reserva|ion details
after canceling the Reserva|ion and he creates the Reservction gor the Passenger
who are placed in the Waiting List.
The reservation clerk tell the reservation status to passengers who are in
waiting list.
The manager updates the train information and he generates the report of the
train, reservation details.
7
Software
Product Functioning:
Functions of Project:
3. Update Train Info: Only the administrator or manager enters any changes
related to the train information like change in the train name, train number, train
route etc. in the system.
6. View Reservation Status: All the users should be able to see the
reservation status of the train online. The users needs to enter the train number and
the pin number printed on his ticket so that the system can display his current
reservation status like confirmed, RAC or Wait – Listed.
8
Software
7. View Train Schedule: Provision should be given to see information related to
the train schedules for the entire train network. The user should be able to see the
train name, train number, boarding and destination stations, duration of journey etc.
Users of Project:
Manger: This person uses this system to update train information and to
genercte reports.
Specific Requirements
Interface Requirements:
User Requirements:
Login information
Reservation details
Train details
Hardware Requirements:
128 MB of RAM
40 GB of HDD
Printer
LAN Cable
9
Software
Software Requirements:
Windows 2000 OS
SQL
Passenger details
Reservation details
Train details
Login details
Verification of user
Maintain Reservation details
Maintain Train details
Appendices
Input/Output formats:
Login Screen
Login id Password
Close Login
1
Software
Create Reservation
From To
Sl. No Name of the Persons Age M/F Requirement
1
Software
This is the form that is to modified the train details. This form consists of no of
seats textbox, which shows the remaining seats present in the train. The no of seats
value is automatically changed when we create or cancel reservation. This is the
form which consist of two buttons for the purpose of create reservation and to
cancel reservation. When the seats text box has value zero than its, says no seats
are remaining in the train to create reservation.
1
Software
Reports for Railway Reservation System
1
Software
This is report generated by the clerk in order to give the reservation details to the
manager.
This is report generated by the clerk about the passenger details who take
the reservation.
1
Software
Instructions for Security:
Data Model:
Passenger
Manager
Clerk
Login
Reservation
Train
Reports
1
Software
Attributes of the Entities are:
1
Software
Object Diagrams for the System
updat
Clerk
Reservation has Passenger
1
Software Engineering
E-R Diagrams
T_Number R_Number
T_Boardsta R_Boardsta
T_Seatinf o R_Class
R_Cost
T_Dest R_Date
T_Time R_Seatno
T_Nam e R_Trainn o
C_Username R_Number
R_Boardsta
C_Password R_Class
R_Cost
R_Date
R_Trainno
R_Seatno
1
Software
T_Number M_Username
T_Boardsta
M_Password
T_Seatinfo
Train Manager
updates
T_Dest
T_Time
T_Name
Re_Number
M_Username
M_Password
Re_Name
Report Manager
updates
1
Software
P_Age
R_Number
P_Name R_Boardsta
P_Address
R_Class
R_Cost
P_Phon eno R_Date
P_Sex
R_Seatno
R_Trainno
P_Age
P_Name C_Username
P_Address
C_Password
P_Sex
P_Phoneno
2
Software
M_password
L_password
M_Username
L_Username
Manager updates
Log
Clerk
C_Username C_password
2
Software
Functional Model
Train Details
Reservation Slip
User Name & Railway View Train Status
Password Reservation
System View Reservation Status
Login
Encoded
Password
Reservation
Log In Get
Reservation
Enter Password Info
Upda
Ok
Clerk
Check Seats
Reservation Remaining
Give Details
N
Ok
Passenger
Allocate
Reservation seat
2
Software
Generating Report Login Reservation
Encoded Password Reservation Details
Printer
Generate Report
Cancel Reservation
Give Details
Passenger Dispense Money Clerk
Reservation
Enter Password
Login
Reservati
Reservati
on
on
Encoded
Password
Log In
Ok
Update
2
Software
View Reservation Status Login
Encoded Reservation
Password
Log In
Reservati
Enter Password
on
Cler Ok
Give
Tell
View Reservation
Info
Passenger
Encoded Train
Password
Log In
Enter Password
n
Trai
Cler Ok
Give
Tell
Passenger
2
Software
Update Train Info
Train Details
Verify login
Login
Encoded Password
Display Message
2
Software
Session – 4
a) DFD’s upto appropriate levels for Railway Reservation System
Train Details
Reservation Slip
Railway View Train Status
User Name &
Password
Reservation
System View Reservation Status
Create Reservation
Login
Encoded
Password
Reservation
Log In Get
Reservation
Enter Password Info
Upda
Ok
Clerk
Check Seats
Reservation Remaining
Give Details
N
Ok
Passenger
Allocate
Reservation seat
2
Software
Generating Report Login Reservation Reservation
Encoded Password Details
Printer
Generate Report
Cancel Reservation
Give Details
Passenger Dispense Money Clerk
Reservation
Enter Password
Login
Reservati
Reservati
on
on
Encoded
Password
Log In
Ok
Update
2
Software
View Reservation Status Login
Encoded Reservation
Password
Log In
Reservati
Enter Password
on
Cler Ok
Give
Tell
View Reservation
Info
Passenger
Log In
Enter Password
n
Trai
Clerk
Ok
Give
Tell
2
Software
Update Train Info
Train Details
Verify login
Display Message
2
Software
b) Draw ERD’s for RRS. Describe the relationship between different entities.
3
Software
Train has Reservation
updat
3
Software
T_Number R_Number
T_Boardsta R_Boardsta
T_Seatinf o R_Class
R_Cost
T_Dest R_Date
T_Time R_Seatno
T_Nam e R_Trainn o
C_Username R_Number
R_Boardsta
C_Password R_Class
R_Cost
R_Date
R_Trainno
R_Seatno
3
Software
T_Number M_Username
T_Boardsta
M_Password
T_Seatinfo
Train Manager
updates
T_Dest
T_Time
T_Name
Re_Number
M_Username
M_Password
Re_Name
Report Manager
updates
3
Software
P_Age
R_Number
P_Name R_Boardsta
P_Address
R_Class
R_Cost
P_Phon eno R_Date
P_Sex
R_Seatno
R_Trainno
P_Age
P_Name C_Username
P_Address
C_Password
P_Sex
P_Phoneno
3
Software
M_password
L_password
M_Username
L_Username
Manager updates
Log
Clerk
C_Username C_password
3
Software
c) Design Data Dictionary for RRS.
Data Dictionary
The Dictionary of the terms that are used in railway reservation system is given in
the below table:
Expansion of
Name Where Used Additional Description
Name
In Functional This is an object who wants to
Passenger Diagrams & Data create, cancel reservation and to
Diagrams check reservation, train status.
This is an object who creates,
In Functional
Reservation cancel, and checks reservation
Clerk Diagrams & Data
Clerk status and update reservation
Diagrams
info.
In Functional This is an object who maintains
Admin Manager Diagrams & Data reservation and train info and
Diagrams generate report.
In Functional
This is an object, which
Printer Diagrams & Data
Diagrams generate reports.
In Functional This is a data base object, which
Login
Login Diagrams & Data stores the login password and
information
Diagrams user name.
In Functional
Reservation This is a data base object, which
Reservation Diagrams & Data
Information stores the reservation details.
Diagrams
In Functional
Train This is a data base object, which
Train Diagrams & Data
Information stores the train details.
Diagrams
This is a process in order to
In Functional check the user name and
Verify login
Diagrams password given by the clerk and
manager.
Update Train In Functional This is a process in order to
Info Diagrams update the train information.
View Train In Functional This is a process in order to
Schedule Diagrams view the train information.
View
In Functional This is a process in order to
Reservation
Diagrams view the reservation details.
Status
Create In Functional This is a process in order to
Reservation Diagrams create reservation.
Cancel In Functional This is a process in order to
Reservation Diagrams cancel reservation.
Generate In Functional This is a process in order to
3
Software
Report Diagrams generate report.
This is an attribute of a
P _ Name Passenger Name In Data Diagrams
passenger.
This is an attribute of a
P _ Age Passenger Age In Data Diagrams
passenger.
Passenger This is an attribute of a
P _ Address In Data Diagrams
Address passenger.
Passenger Phone This is an attribute of a
P _ Phoneno In Data Diagrams
No passenger.
This is an attribute of a
P _ Sex Passenger Sex In Data Diagrams
passenger.
This is an attribute of a train. It
T _ Number Train Number In Data Diagrams
is an unique field.
T _ Name Train Name In Data Diagrams This is an attribute of a train.
T _ Time Train Time In Data Diagrams This is an attribute of a train.
Train Boarding
T _ Boardsta In Data Diagrams This is an attribute of a train.
Station
Train
T _ Dest In Data Diagrams This is an attribute of a train.
Destination
Train Seat
T _ Seatinfo In Data Diagrams This is an attribute of a train.
information
This is an attribute of a
Reservation
R _ Number In Data Diagrams reservation. It is a unique
Number
attribute.
Reservation Seat This is an attribute of a
R _ Seatno In Data Diagrams
Number reservation.
This is an attribute of a
Reservation reservation, which is a foreign
R _ Trainno In Data Diagrams
Train Number key for the
‘Train Info’ object.
Reservation This is an attribute of a
R _ Date In Data Diagrams
Date reservation.
Reservation
This is an attribute of a
R _ Boardsta Boarding In Data Diagrams
reservation.
Station
Reservation This is an attribute of a
R _ Dest In Data Diagrams
Destination reservation.
Reservation This is an attribute of a
R _ Class In Data Diagrams
Class reservation.
Reservation This is an attribute of a
R _ Cost In Data Diagrams
Cost reservation.
Clerk User
C _ Username In Data Diagrams This is an attribute of a clerk
Name
C _ Password Clerk Password In Data Diagrams This is an attribute of a clerk
M _ Username Manager User In Data Diagrams This is an attribute of a
3
Software
Name manager.
Manager This is an attribute of a
M _ Password In Data Diagrams
Password Manager
Re _ Number Report Number In Data Diagrams This is an attribute of a report.
Re _ Name Report Name In Data Diagrams This is an attribute of a report.
Login User
L _ Username In Data Diagrams This is an attribute of a login.
Name
L _ Password Login Password In Data Diagrams This is an attribute of a login.
3
Software
Session – 5
The Railway Reservation System consists of so many interfaces in order to
input and output the data. As this Railway Reservation System must involves the
transfer of data to the server. The Railway Reservation System must manage the
server in order to store the data of the reservation, train details. So, we must the
data of the reservation, train to the server. So, we choose the Java Programming for
the Railway Reservation System, because it is very suitable to the Client-Server
architecture. Java programming is very efficient in interface designing. The below
module is to create the interface to enter the train details and to create, cancel the
reservation. The data that is entered in the text boxes, is stored in the database.
When we click the “ Create Reservation” button, then we get another interface to
enter the reservation details.
When we click the “ Create Reservation” button, then we get another interface to
enter the reservation details for cancel .The data that is entered in the Create
Reservation form can automatically updates the train details. The data that is
entered in the Cancel Reservation form can also automatically updates the train
details. The data is automatically stored in the server. Remaining users who are
using that server can change this data.
3
Software
t1=new JTextField(30);
t2=new JTextField(30);
t3=new JTextField(30);
t4=new JTextField(30);
t5=new JTextField(30);
b1=new JButton(“Create Reservation”);
b2=new JButton(“Cancel Reservation”);
b3=new JButton(“Save”);
b4=new JButton(“Cancel”);
p1.add(l1);
p1.add(lt1);
p2.add(l2);
p2.add(t1);
p3.add(l3);
p3.add(t2);
p4.add(l4);
p4.add(t3);
p5.add(l5);
p5.add(t4);
p6.add(l6);
p6.add(t5);
p7.add(b1);
p7.add(b2);
c.add(p1);
c.add(p2);
c.add(p3);
c.add(p4);
c.add(p5);
c.add(p6);
c.add(p7);
b1.addActionListener(this);
b2.addActionListener(this);
b3.addActionListener(this);
b4.addActionListener(this);
}
public void actionPerformed(ActionEvent ae)
{
String msg=ae.getActionCommand();
if(msg.equals(“Save”))
{
Class.for(“c://mydocuments.”);
Connection conn=DriverManager.getConnection(“harish”,1234567);
conn.getAutoCommit();
PreparedStatement pstmt=conn.prepareStatement(“insert into train
values(&T_Number,’&T_Name’,&T_Time,&T_Boardsta,&T_Dest,&T_Seatinfo)”
);
4
Software
pstmt.setValue(1, lt1.getSelectedItem());
pstmt.setValue(2, t1.getText());
pstmt.setValue(3, t2.getText());
pstmt.setValue(4, t3.getText());
pstmt.setValue(5, t4.getText());
pstmt.setValue(6, t5.getText());
}
if(msg.equals(“Cancel”))
{
JoptionPane.showMessageDialog(null,”The values cannot be entered”);
f.setDefaultCloseOperation(Jframe.EXIT_ON_CLOSE);
}
if(msg.equals(“Create Reservation”))
{
myframe2.setVisible(true);
f.setDefaultCloseOperation(Jframe.EXIT_ON_CLOSE);
//_ _ _ _
}
if(msg.equals(“Create Reservation”))
{
if(Integer.parseInt(t5.getText())==0)
JOptionPane.showMessageDialog(null,”Cannot have seats”);
else
{
myframe3.setVisible(true);
f.setDefaultCloseOperation(Jframe.EXIT_ON_CLOSE);
//_ _ _ _
}
}
}
public static void main(String args[])
{
myframe f=new myframe(“Train Details”);
f.setVisible(true);
f.setDefaultCloseOperation(Jframe.EXIT_ON_CLOSE);
}
}
Statement stmt=conn.createStatement();
ResultSet rst=stmt.updateQuery(“select * from reservation”);
While(rst.next())
{
t1.setText(Integer.toString(rst.getText()));
//***************************
4
Software
}
In the above program we have to maintain constraints, when the TextBox t5 has
value 0 then we do not create reservation. If we create reservation at this situation,
then it automatically generates error message. The other peoples except manager
cannot update train details, the train details is highly secured.
So, we have to maintain login form to update train details.
For efficient design of interfaces, we use Swings in Java. In modular design we
have to concentrate on two concepts inorder to design efficient modules. The two
concepts are,
Coupling
Cohesion
We have to design modules with less coupling and with high cohesion. Coupling
specifies the relation between two modules. It specifies how the modules interact
with each other. There must be less relation between the modules. Because, when
we change one module, then we have to change another module when there is high
relation between them. If we have less coupling between the modules then it is
easy to modify the software product.
Cohesion represents the functionality of the function. It specifies how the
instructions in the module can perform the functionality of the function. We have
to maintain high cohesion between modules. Because, all instructions in the
module must perform single functionality. So, mainly we have to concentrate on
the Coupling and Cohesion.
4
Software
Session – 6
The below form is used to enter the user to logon to the system. In this GUI,
there are two text boxes in which we have to enter the login id and password. The
system checks the values that are entered in text boxes with the Login Id and
Password, which is stored in database. If the given values are correct then only the
user will enter into RRS system. Otherwise, a message will be appeared on the
screen.
4
Software
This is a form, which is to enter Reservation Details. This form consists of four text
boxes, which is to enter details from user in order to create reservation for the user.
The clerk cannot create reservation more than the seats present in the train. If he
wants to create reservation more than that then a message will be appeared on the
screen.
This is a message box that is generated when clerk creates the reservation more
than the seats in the train.
4
Software
This is the reservation slip that is given to the passenger after creating the
reservation. This consists of the details of passenger and their seat numbers in
which they are traveling. This is consists of train details, date of journey and
boarding station, destination.
4
Software
This is the form that is to modified the train details. This form consists of no of
seats textbox, which shows the remaining seats present in the train. The no of seats
value is automatically changed when we create or cancel reservation. This is the
form which consist of two buttons for the purpose of create reservation and to
cancel reservation. When the seats text box has value zero than its, says no seats
are remaining in the train to create reservation.
4
Software
Reports for Railway Reservation System
4
Software
This is report generated by the clerk in order to give the reservation details to the
manager.
This is report generated by the clerk about the passenger details who take
the reservation.
4
Software
Session – 7
This is the program, which takes two matrices as input and generates
multiplication of two matrices as output. In order to multiply the two matrices there
is a condition for the two matrices, is given below.
The no. of columns of the first matrix is equal to the no. of rows of the
second matrix, then only it is possible to multiply two matrices, otherwise it
is not possible to multiply two matrices.
Program
#include<stdio.h>
#include<conio.h>
void input(int **a,int r1, int c1)
{
int i,j;
printf("\n enter 1st matrix elements \n");
if (r1>=10||c1>=10)
{
printf(“\n Unable to enter matrix”);
return;
}
else
{
for(i=0;i<r1;i++)
for(j=0;j<c1;j++)
scanf("%d",&*(*(a+i)+j));
}
}
void output(int **a, int r2, int c2)
{
int i,j;
if (r1>=10||c1>=10)
{
printf(“\n Unable to enter matrix”);
return;
}
else
{
for(i=0;i<r2;i++)
{
for(j=0;j<c2;j++) printf("%d\
t",*(*(a+i)+j)); printf("\n");
}}
4
Software
}
void multiply(int **a, int **b, int r1, int c1, int r2, int c2)
{
int i,j,k,c[10][10];
for(i=0;i<r1;i++)
for(k=0;k<c2;k++)
{ c[i]
[k]=0;
for(j=0;j<c1;j++)
*(*(c+i)+k)= *(*(c+i)+k)+ *(*(a+i)+j)* *(*(b+j)+k);
}
printf("\n the multiplication of matrices is \n");
for(i=0;i<r1;i++)
{
for(j=0;j<c1;j++) printf("%d\
t",*(*(c+i)+j)); printf("\n");
}
}
main()
{
int r1,c1,r2,c2,**a, **b, **c;
clrscr();
printf("\n enter the number of rows,columns for matrix1\n"); scanf("%d
%d",&r1,&c1);
printf("\n enter the number of rows,columns for matrix2\n"); scanf("%d
%d",&r2,&c2);
if(c1!=r2)
{
printf("\n unable to multiply");
return;
}
else
{
input(a,r1,c1);
input(b,r2,c2);
multiply(a,b,r1,c1,r2,c2);
output(a,r1,c1);
output(b,r2,c2);
}
getch();
}
5
Software
Output:
enter the number of rows, columns for matrix1
3
3
5
Software
Session – 8
Here we want to generate test cases that will completely test the program
given above. This is the program, which takes two matrices as input and generates
multiplication of two matrices as output. In order to multiply the two matrices there
is a condition for the two matrices, is given below.
The no. of columns of the first matrix is equal to the no. of rows of the
second matrix, then only it is possible to multiply two matrices, otherwise it
is not possible to multiply two matrices.
Unit Testing
Unit testing is procedure used to verify particular segment of source code is
working properly. The main idea about this testing is to generate the test cases for
all function or methods. The main goal of unit testing is isolate each part of
program and show individual parts are correct. In above program, there are three
functions, which perform input, output, and multiplication of two matrices. Let us
consider the first function.
}
The above source code determines the no of columns of the first matrix
equal to the no. of rows of the second matrix then only the multiplication is
possible.
5
Software
This is a segment of input function.
if (r1>=10||c1>=10)
{
printf(“\n Unable to enter matrix”);
return;
}
else
{
for(i=0;i<r1;i++)
for(j=0;j<c1;j++)
scanf("%d",&a[i][j]);
}
The above code reprgents the no. of rows and no. of columns that are to be
given is less than the size of matrix. If the it is not possible to enter the value in the
matrix is not greater than its size.
if (r1>=10||c1>=10)
{
printf(“\n Unable to enter matrix”);
return;
}
else
{
for(i=0;i<r2;i++)
{
for(j=0;j<c2;j++) printf("%d\
t",a[i][j]); printf("\n");
}
}
The above code is a segment of output function. This code represent the no
.of rows and no. of columns of the matrix is less than the size of the matrix if we
gave the no. of rows and no. of columns greater than or equal to size of the array,
then we get unexpected values as output
5
Software
Module Testing
Input Function
In above function there are three inputs. The inputs are no. of rows and no. of
columns. The no. of rows and no. of columns can not be greater than the size of the
array declared. If the no. of rows and no. of columns is greater than are equal to
the size of the array, than it is not possible to enter the values into the array.
5
Software
The second function in the above program is given below
Output Function
In above function there are three inputs. In this function, the no. of rows and no. of
columns that are to be entered is not greater than size of the array.
If the no. of rows and no. of columns is less than the size of the array then it shows
that output of the values in the array. If the no. of rows and no. of columns is
greater than are equal to the size of the array then the function shows unexpected
values because of more than the size of array.
Multiplication Function
void multiply(int a[10][10], b[10][10], int r1, int c1, int r2, int c2)
{
int i,j,k,c[10][10];
for(i=0;i<r1;i++)
for(k=0;k<c2;k++)
{ c[i]
[k]=0;
5
Software
for(j=0;j<c1;j++) c[i][k]=c[i][k]
+a[i][j]*b[j][k];
}
printf("\n the multiplication of matrices is \n");
for(i=0;i<r1;i++)
{
for(j=0;j<c1;j++) printf("%d\
t",c[i][j]); printf("\n");
}
}
Integrated Testing
5
Software
multiplication of two matrices then only we get the multiplication of two matrices.
If we don’t determine any of two matrices then we get unexpected values as
multiplication of two matrices by taking the default values stored in matrix.
The main aim of the above program is not achieved if we undetermined any of the
two matrices which are taken as input for multiplication of two matrices.
5
Software
Session – 9
This is web page, which accepts Matrix as input and generates the transpose
of the given matrix. This web page consists of two text boxes and two buttons. In
two text boxes we must enter the no of rows and no of columns and the web page
generates the no of text boxes for entering the values of the matrix depends up on
the number of rows and columns given. In that textboxes we must enter values and
then the web page generates the transpose of the given matrix.
<html><head>
<title>Matrix</title>
<script language="javascript">
function enter()
{
var a=form1.text1.value;
var b=form1.text2.value;
if(a==0||b==0)
alert(" you must enter values in textbox");
else
{
document.writeln("<form name='form2'>");
for(i=0;i<a;i++)
for(j=0;j<b;j++)
document.writeln("<input type=text
name='text[i][j]'> ");
document.writeln("<br><center><input type=button value=' Enter '
onClick='transpose()'></center>");
document.writeln("</form>");
}
}
function transpose()
{
for(i=0;i<a;i++)
for(j=0;j<b;j++) a[i]
[j]=form2.text[i][j];
document.writeln("Entered matrix is :");
for(i=0;i<a;i++)
{
for(j=0;j<b;j++)
document.writeln(a[i][j]+"\t");
document.writeln("<br>");
}
document.writeln(<BR><BR><BR>");
document.writeln("Transpose of given matrix is :");
for(i=0;i<a;i++)
for(j=0;j<b;j++)
5
Software
b[i][j]=a[j][i];
for(i=0;i<a;i++)
{
for(j=0;j<b;j++)
document.writeln(b[i][j]+"\t");
document.writeln("<br>");
}
}
</script></head>
<body><center>
<form name="form1">
No. of rows : <input type=text
name="text1"><br><br>
No. of columns : <input type=text
name="text2"><br><br>
<input type=button value=" Enter "
onClick='enter()'> &nbs p;
<input type=button value=" Cancel ">
</form></center></body></html>
5
Software
6
Software
Session – 10
We have to generate the test cases for the above web page. Normally there are two
types of testing. They are
i) White Box Testing
ii) Black Box Testing
On successfully entering the no. of rows and no. of columns, when we click the
Enter button we get the web page having the text boxes to enter the value of the
matrix. When we click the Cancel button then we get a message.
If we enter both no. of rows and no. of columns then we get a web page of
have text boxes of number equal to the no . of rows * no. of columns. In order to
get the text boxes to enter values of the matrix we have to enter the both the no. of
rows and no. of columns.
6
Software
We have to enter the values in all the text boxes, then only the values are
entered into matrix. Suppose we gave 2 * 2 matrix then we get 4 text boxes.
When we don’t enter the value into any text box, then we get a error message. On
successfully entering into all text boxes we get the transpose of the give matrix, in
the next web page