Chapter 2 SDLC
Chapter 2 SDLC
Kamal Gyawali
Software development life cycle contains following steps they are as follows:
1) Problem analysis
2) Algorithm development
3) Flowcharting
4) Coding
5) Compilation and execution
6) Debugging and testing
7) Program Documentation
Problem analysis
Algorithm Development
Flowcharting
Coding
Documentation
Prepared By: ER. Kamal Gyawali
1) Problem analysis:
Before solving a problem, it should be analyzed and understood well. It is impossible to solve a
problem by using computer without clear understanding and identification of the program.
The program’s inputs, outputs, different ways of solving problems, software requirement and
hardware requirements, time period of program should be known in advance well.
2) Algorithm development:
An algorithm is step by step procedure to solve a problem.
Some convention used in developing algorithms
Each algorithm will be enclosed by two statements START and STOP
To accept data from user, the INPUT or READ statement is used.
To display any user message, the PRINT or DISPLAY statement is used.
The arithmetic operators (+, -, * and /) are used in the expressions.
The relational operators (>, <, >=, <=, ==, != ) are used in conditions.
The logical operators (AND, OR, NOT) are used for logical expressions.
3) Flowcharting:
The pictorial/diagrammatic/graphical representation of an algorithm is known as
flowchart.
Flowchart symbols:
symbol Name
Flow line
Terminal(start/end)
processing
Input/output
Decision
Connector
Prepared By: ER. Kamal Gyawali
Advantages of flowchart:
Communication
Effective Analysis
Proper documentation
Efficient coding
Easy in debugging and program maintenance
Examples:
1) Write an algorithm and draw flowchart for finding sum of any two numbers.
Algorithm:
1. Start
2. Print “Enter two numbers”.
3. Read A and B
4. Calculate sum S=A+B
5. Print “Sum of two numbers is S”.
6. Stop.
Flowchart:
Start
Read A and B
Calculate sum
S=A+B
Stop
Algorithm:
1. Start
2. Print “Enter the value of principle, time and rate”
3. Read P, T and R
4. Calculate simple interest Si = (P*T*R)/100
5. Print “ Simple interest is Si”
6. Stop.
Flowchart:
Start
Print “Simple
interest is Si”
Stop
Prepared By: ER. Kamal Gyawali
3. Write an algorithm and draw flowchart to check a given number is negative or positive.
Algorithm:
1. Start
2. Print “Enter a number”
3. Read n
4. If(n>0) then
print “Number is positive”
Else
print “Number is negative”
5. Stop. Start
Print “Enter a
number”
Read n
Is
True False
n>0
Print "number
Print "number
is positive"
is negative"
Stop
Prepared By: ER. Kamal Gyawali
4. Write an algorithm and draw flowchart to check given number is even or odd.
Algorithm:
1. Start
2. Print “Enter a number”
3. Read n
4. If(n%2==0) then
Print “Number is even”
Else
Print “Number is odd”
5. Stop.
Start
Print “Enter a
number”
Read n
True Is False
N%2==0
End
Prepared By: ER. Kamal Gyawali
6. Write an algorithm and draw a flowchart to find the largest number among three numbers.
Algorithm:
1. Start
2. Print “Enter three numbers”
3. Read A, B, C
4. If(A>B)then
if(A>C) then
Print “A is largest number”
Else
Print “C is largest number”
Else
If (B>c) then
Print “B is largest number”
Else
Print “C is largest number”
5. Stop
Flowchart:
Prepared By: ER. KamalStart
Gyawali
Read A, B, C
False Is True
A>B ?
Print “B is Print “C is
Print “A is
largest” largest
number” largest”
End
Prepared By: ER. Kamal Gyawali
For further algorithm and flowchart we will discuss in chapter 4 control statements
4) Coding:
The process of transforming the program logic design into computer language format.
C, c++, java etc. are the example of programming language which is used for coding.
7) Program documentation:
Program documentation is description of the program and its logic written to support
understanding the program.
Documentation of program helps to those who use, maintain and extend the program in
future.
Properly documented program is necessary which will be useful and efficient in
debugging, testing, maintenance and redesign process.