You are on page 1of 35

CHAPTER 2:

PROBLEM ANALYSIS
& DESIGN
DEC2012

LOGO
CHAP 2 : Problem Analysis & Design
2.1 Know the algorithm, flowchart and pseudocode.
2.1.1 Define the algoritm in programming.
2.1.2 Identify the pseudocode in programming.
2.1.3 Identify the flowchart in programming.

2.2 Understand the algorithm, flowchart and


pseudocode.
2.2.1 Explain the flowchart symbols.
2.2.2 Compare the advantages and disadvantages of flowchart.

2.3 Apply the algorithm, flowchart and pseudocode


analyze problem.
2.3.1 Construct flowchart for the given problem.
2.3.2 Apply flowchart for the following.
a. Sequence structure.
b. Selection Structure.
c. Looping Structure.
2.1 Know the algorithm, flowchart and
pseudocode.
2.1.1 Define the algoritm in programming.

i.Definition: An algorithm is procedure consisting of a


finite set of instructions which specify a finite
sequence of operations that provides the solution to a
problem, or to a specific class of problems for any
allowable set of input quantities (if there are inputs).
In other word, an algorithm is a step-by-step
procedure to solve a given problem.
2.1 Know the algorithm, flowchart and
pseudocode.
2.1.1 Define the algoritm in programming.

i.An algorithm gives a solution to a particular problem


as a well defined set of steps.
ii.A recipe in a cookbook is a good example of an
algorithm. When a computer is used for solving a
particular problem, the steps to the solution should
be communicated to the computer.
iii.An algorithm is executed in a computer by
combining lot of elementary operations such as
additions and subtractions to perform more complex
mathematical operations.
2.1 Know the algorithm, flowchart and
pseudocode.
2.1.1 Define the algoritm in programming.

Let's say that you have a friend arriving at the airport


, and your friend needs to get from the airport to your
house. Here are four different algorithms that you
might give your friend for getting to your home:
2.1 Know the algorithm, flowchart and
pseudocode.
2.1.1 Define the algoritm in programming.

The taxi algorithm:


Go to the taxi stand.
Get in a taxi.
Give the driver my address.

The call-me algorithm:


When your plane arrives, call my cell phone.
Meet me outside.
I’ll take u to my home!!
2.1 Know the algorithm, flowchart and
pseudocode.
2.1.1 Define the algoritm in programming.

The rent-a-car algorithm:


Take the shuttle to the rental car place.
Rent a car.
Follow the directions to get to my house.

The bus algorithm:


Outside baggage claim, catch bus number 70.
Transfer to bus 14 on Main Street.
Get off on Elm street.
Walk two blocks north to my house.
2.1 Know the algorithm, flowchart and
pseudocode.
2.1.1 Define the algoritm in programming.

•All four of these algorithms accomplish exactly the


same goal,

•BUT each algorithm does it in completely different


way.

•In computer programming, there are often many


different ways -- algorithms -- to accomplish any
given task.

•Each algorithm has advantages and disadvantages in


different situations.
2.1 Know the algorithm, flowchart and
pseudocode.
2.1.1 Define the algoritm in programming.
2.1 Know the algorithm, flowchart and
pseudocode.
2.1.1 Define the algoritm in programming.
2.1 Know the algorithm, flowchart and
pseudocode.
2.1.1 Define the algoritm in programming.
2.1 Know the algorithm, flowchart and
pseudocode.
2.1.2 Identify the pseudocode in programming.

●Pseudocode is one of the methods that could be


used to represent an algorithm. It is not written in a
specific syntax that is used by a programming
language and therefore cannot be executed in a
computer.
●There are lots of formats used for writing
pseudocode and most of them borrow some of the
structures from popular programming languages such
as C, Lisp, FORTRAN, etc.
2.1 Know the algorithm, flowchart and
pseudocode.
2.1.2 Identify the pseudocode in programming.

●Most of the algorithms are presented using


pseudocode since they can be read and understood
using programmers who are familiar with different
programming languages.
●Pseudocode allows to include control structures
such as WHILE, IF-THEN-ELSE, REPEAT-UNTIL, FOR,
and CASE, which are present in many high level
languages.
2.1 Know the algorithm, flowchart and
pseudocode.
2.1.2 Identify the pseudocode in programming.

Pseudocode in C programming Adding 2 numbers

1.Initialize total to zero


2.Initialize number1
3.Initialize number2
4.Input number1
5.Input number2
6.Add number1 and number2 = total
7.Display the result.
2.1 Know the algorithm, flowchart and
pseudocode.
2.1.2 Identify the pseudocode in programming.
2.2 Understand the algorithm, flowchart and
pseudocode.
2.1.2 Compare the advantages and disadvantages of
Pseudocode.

Advantages Disadvantages

Cannot be executed in the


Easily understood
computer

Easily maintained

The codes are changeable


2.1 Know the algorithm, flowchart and
pseudocode.
2.1.3 Identify the flowchart in programming.

●Graphic representation of algorithm which is consist


of geometric symbols.
●Symbols are connected by line of arrows called flow
lines which indicate the direction of flow of processes
or activities.
●The shape of the symbol indicates the type of
operation that is to occur.
●Flowchart should flow from the top of the page to
the bottom. The symbols used in flowchart are
standardized.
2.2 Understand the algorithm, flowchart and
pseudocode.
2.2.1 Explain the flowchart symbols.
2.2 Understand the algorithm, flowchart and
pseudocode.
2.2.1 Explain the flowchart symbols.
2.2 Understand the algorithm, flowchart and
pseudocode.
2.2.1 Explain the flowchart symbols.
2.2 Understand the algorithm, flowchart and
pseudocode.
2.2.1 Explain the flowchart symbols.
2.2 Understand the algorithm, flowchart and
pseudocode.
2.2.1 Explain the flowchart symbols. (Examples)
2.2 Understand the algorithm, flowchart and
pseudocode.
2.2.2 Compare the advantages and disadvantages of
flowchart.

Advantages Disadvantages

Easy to draw Time consuming

Easy technique to understand


Difficult for modification
logic

Easy to identify the mistake by Difficult task to draw flow charts


non computer person for big programs

There are no standards of


Easy for branching and looping pertaining the details that should
be included in a flow chart.
2.3 Apply the algorithm, flowchart and
pseudocode analyze problem.
2.3.1 Construct flowchart for the given problem.

Algorithm and flow chart to read the name and print the name.
2.3 Apply the algorithm, flowchart and
pseudocode analyze problem.
2.3.1 Construct flowchart for the given problem.

Algorithm and flow chart to add two numbers.


2.3 Apply the algorithm, flowchart and
pseudocode analyze problem.
2.3.1 Construct flowchart for the given problem.

Algorithm and flow chart to find the average of three numbers.


2.3 Apply the algorithm, flowchart and
pseudocode analyze problem.
2.3.1 Construct flowchart for the given problem.

Algorithm and a flow chart to calculate area of square.


2.3 Apply the algorithm, flowchart and
pseudocode analyze problem.
2.3.2 Apply flowchart for the following.
a. Sequence structure.

In a computer program or an algorithm,


sequence involves simple steps which are
to be executed one after the other. The
steps are executed in the same order in
which they are written.
2.3 Apply the algorithm, flowchart and
pseudocode analyze problem.
2.3.2 Apply flowchart for the following.
a. Sequence structure.
2.3 Apply the algorithm, flowchart and
pseudocode analyze problem.
2.3.2 Apply flowchart for the
following.
b. Selection Structure.

Selection is used in a computer


program or algorithm to
determine which particular
step or set of steps is to be
executed.
2.3 Apply the algorithm, flowchart and
pseudocode analyze problem.
2.3.2 Apply flowchart for the following.
b. Selection Structure.
2.3 Apply the algorithm, flowchart and
pseudocode analyze problem.
2.3.2 Apply flowchart for the following.
c. Looping Structure.
2.3 Apply the algorithm, flowchart and
pseudocode analyze problem.
2.3.2 Apply flowchart for the following.
c. Looping Structure.

Repetition allows for a portion of an algorithm or


computer program to be done any number of times
dependent on some condition being met.

An occurrence of repetition is usually known as a


loop.

An essential feature of repetition is that each loop


has a termination condition to stop the repetition, or
the obvious outcome is that the loop never completes
execution (an infinite loop).
2.3 Apply the algorithm, flowchart and
pseudocode analyze problem.
2.3.2 Apply flowchart for the following.
c. Looping Structure.
Thank You

published by: hafriz.fikrie

35

You might also like