0% found this document useful (0 votes)
6 views41 pages

Program Development Life Cycle Overview

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

Program Development Life Cycle Overview

C-Programming
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd

Program Development Life Cycle

Stages in Program development cycle


• Problem recognition
• Problem definition.
• Program design.
• Program coding.
• Program testing.
• Program Implementation and maintenance.
• Program documentation
1. Problem recognition
• Problem recognition refers to the understanding and
interpretation of a particular problem.
• The programmer must know what problem he/she is trying to
solve.
• He/she must also understand clearly the nature of the problem
& the function of the program.
Situations that cause problem
identification
• Problems or undesirable situations that prevent an individual
or organizations from achieving their purpose.
• Opportunity to improve the current program.
• A new directive given by the management requiring a change
in the current sys
Example of problems
• Program to calculate area of a triangle.
• Program to enter student name, maths, english and kiswahili
then calculate total marks and average marks.
2. Problem definition
• Also known as problem analysis.
• In defining a problem the programmer tries to identify:
- Input(s)
- Process(s)
- File(s) (Storage)
- Output(s)
3. Program design
• Program design enables the programmer to come up with a
model of the program in sequence of simple steps also known
as algorithm.
• The algorithm show the systematic flow of events throughout
the entire program from input to output.
Algorithm
• An Algorithm is a limited number of logical steps that a program follows
in order to solve a problem
• Algorithms take little or no account of the programming language.
• They must be precise/ accurate, unambiguous/clear and should
guarantee a solution
• Algorithm is illustrated using:
- Pseudocode
- Flowchart
Pseudocode
• A pseudocode is a method of documenting a program logic in
English-like statements to describe the processing steps.

Guidelines for designing a good pseudocode.


• A pseudocode must have a Begin and end.
• The input, output and processing statements should be clearly
stated using keywords such as Output: PRINT, OUTPUT, DISPLAY
and Input: READ, INPUT, SCAN etc.
Pseudocode of a program to calculate area of a triangle

Begin
INPUT base
INPUT height
Area= 0.5 * base * height
OUTPUT area
End.
Pseudocode of a program to calculate area of a rectangle

• Begin
• Input length
• Input width
• Area = length * width
• Print area
• End
• Pseudocode of a program to input 3 subject
marks then calculates and displays total and
average marks
Pseudocode of a program to input subject marks then
calculates and displays total and average marks
Begin
INPUT maths
INPUT english
INPUT kiswahili
Total = maths+english+kiswahili
Average=total/3
OUTPUT total
OUTPUT average
End.
• F = + 32 Begin
Input C
F = ( + 32
Output F
stop
Area of a circle
• Begin
Begin
• Read radius Read radius
• Set pi=3.14 Area= 3.14* radius * radius
• Area=pi * radius * radius Circumference = 2 * 3.14 * radius
• Circumference = 2 * pi * radius Print area
• Print area Print circumference
• Print circumference End
• End
Example
• Write a pseudocode of a program to solve the equation of
a straight line given by the expression: Y = mx + c.

BEGIN
INPUT m
INPUT x
INPUT c
y=(m*x) + c
OUTPUT y
END.
Write a pseudocode for a program that prompts
the user to enter their age. If the age entered is
below 18, it should display “you’re a young
person”, otherwise it should display “you’re an
adult”
• Begin
Read age
If age < 18
Output “you are a young person”
Else
Output “you are an adult”
• Stop
Flowchart
• A Flowchart is a diagrammatic or pictorial representation of a
program’s algorithm.
• It is a chart that demonstrates the logical sequence of events
that must be performed to solve a problem.
Flowchart symbols
• A Flowchart is constructed using a set of special shapes (or
symbols) that have specific meaning.
• Each symbol contains information (short text) that describes
what must be done at that point.
• The symbols are joined by arrows to obtain a complete
Flowchart. The arrows show the order in which the instruction
must be executed.
Symbol Meaning
Start/End - Indicate the start
and end of a flowchart

Input / Output symbol

Process symbol

Decision symbol

Flow
Connector
• Flowchart of a program to solve the equation
of a straight line given by the expression: Y =
mx + c. START

Input m, x and c

Y=(m*x) + c

Output Y

STOP
Start
Start Circumference
and area of a Set pi = 3.14

Input radius circle Input radius

Area = 3.14 * radius * radius Area = pi* radius * radius


Circumference = 3.14 * 2* Circumference =pi* 2*
radius radius

Output area, Output area,


circumference circumference

Stop Stop
Start
F = + 32
Input C

F = (9/5)*C+ 32

Output F

Stop
START

Input age
• Begin
• Input age
No
• If age<18 then If age <
18
Output “You are a
an adult”
• Output “you are a young person”
• Else Yes

Output “You are a young


• Output “You are an adult” person”
• End

STOP
Hint BMI= weight/Height 2

BMI Remarks

Below 18 You are underweight

Between 18 and 25 Your weight is normal

Between 25 and 30 You are overweight

Above 30 You are obese


Pseudocode

• Begin • Else if BMI > 25 and BMI <=30

• Input weight – Output “you are overweight”

• Input height • Else


– Output “you are obese
• BMI = weight/(height*height)
• End
• If BMI <18
– Output “You are underweight”

• Else if BMI >=18 and BMI <= 25


– Output “you are normal”
Begin

BMI
No BMI < 25 No
>=18
Input weight, height and
and
BMI<=30
BMI<=25

Yes Yes
BMI = weight/(height*height) Output Output Output
“normalt” “overweight” “obese”

No
BMI < 18
End

Yes
Output
“underweight”
Program coding
• Program coding is the actual process of converting a design
model into its equivalent program.
• Coding requires the programmer to convert the design
specification (algorithm) into actual computer instructions
using a particular programming language.
Example
• Develop a program code that will be used to
solve the equation of a straight line given by
the expression: Y = mx + c.
Example (PASCAL)
Program StraighLine (input, output);
VAR y, m, x, c: INTEGER;
BEGIN
Writeln (‘Input the value of M’);
Readln (m);
Writeln (‘Input the value of X’);
Readln (x);
Writeln (‘Input the value of C’);
Readln (c);
Y: = (m * x) +c;
Writeln (‘The value of y is:’, Y);
END.
Program trianglearea (input, output);
VAR b,h: INTEGER;
area:REAL;
BEGIN
Writeln (‘Input the value of Base’);
Readln (b);
Writeln (‘Input the value of Height’);
Readln (h);
area: = 0.5 * b * h;
Writeln (‘The value of area is:’, area);
END.
Program Testing and Debugging
• After designing & coding, the program has to be tested to verify that it is
correct, and any errors detected removed (debugged).
• Testing is the process of running computer software to detect/find any
errors (or bugs).
• Most programming errors often remain undetected until an attempt is
made to translate a program.
• The term Bug is used to refer to an error in a computer program
• Debugging is therefore, the process of detecting, locating & correcting
(removing, eliminating)
all errors (mistakes or bugs) that may exist in a computer program
Types of program errors
• Syntax errors.
• Run-time (Execution) errors.
• Logical errors.
• Semantic errors
• Lexicon errors
Syntax errors

• Every programming language has a well-


defined set of rules concerning formal
spellings, punctuations, naming of variables,
etc.
• Syntax errors are therefore, programming
errors/mistakes that occur if the grammatical
rules of a particular language are not used
correctly.
Run-time (Execution) errors
• These errors occur during program execution.
• Run-time (execution) errors occur when the
programmer introduces new features in the
program, which are not part of the translator’s
standards.
• For example if the computer is asked to divide
a number by zero.
Logical error
• Logical errors relate to the logic of processing followed in the
program to get the desired results.
• E.g. they may occur as a result of misuse of logical operators.
• Logical errors cannot be detected by the translator.
• The program will run, but give the wrong output
Semantic errors
• They occur when the programmer develops statements, which
are not projecting towards the desired goal.
• Such statements will create deviations from the desired
objectives.
• Semantic errors are not detected by the computer.
Lexicon errors

• These are the errors, which occur as a result of misusing


Reserved words (words reserved for a particular language).
Program implementation
• Implementation refers to the actual delivery, installation and
putting of the new program into use.
• The program is put into use after it is fully tested, well
documented, and after training the staff who will be involved
in the running of the new program.
Program documentation
• After writing, testing, and debugging a program, it must be
documented. In other words, the programmer should describe
all what he was doing during the program development stages.
• Program documentation is the writing of supportive materials
explaining how the program can be used by users (user
manual), installed by operators, or modified by other
programmers (Technical manual).

You might also like