8.0 Algorithms and Flow Charts
8.0 Algorithms and Flow Charts
Introduction
A typical programming task can be divided into two phases:
Implementation phase
Walk-through
Manual simulation of the design by team members, taking sample
data values and simulating the design using the sample data
Inspection
One person (not the designer) reads the design (handed out in
Devise a plan
Look back
Analyze
Specify
Develop algorithm
Test algorithm
Implementation Phase
Code algorithm
Test algorithm
Maintenance Phase
Use
Maintain
6 Algorithms and Flowcharts 12/15/2023
Problem Solving…
the solution?
the solution?
8 Algorithms and Flowcharts 12/15/2023
Problem Solving…
Ask questions! Never reinvent the wheel!
Similar problems come up again and again in different guises
Break up a large problem into smaller units and solve each smaller
problem
Algorithm:
Input a set of 4 marks
Calculate their average by summing and dividing by 4
if average is below 50
Print “FAIL”
else
Print “PASS”
Print “FAIL”
else
Print “PASS”
endif
13 Algorithms and Flowcharts 12/15/2023
Flowchart
(Dictionary) A schematic representation of a sequence of
feet to centimeter.
Algorithm:
Input the length in feet (Lft)
Algorithm
Input the width (W) and Length (L) of a rectangle
Print A
Calculate d
Calculate x1
Calculate x2
Print x1 and x2
MAX VALUE1
else
MAX VALUE2
endif
If the total tax is less than Kshs. 1,162 then the tax relief