Lec02-Problem SolvingWithAlgorithm
Lec02-Problem SolvingWithAlgorithm
5 Documentation
What is PDLC ?
All about the What.
1 Analysis
• What the user wants from
the program?
2 Design
• What is the input and
output of the program?
3 Development
Tasks Involved
4 Testing • Gather user requirements
5 Documentation
What is PDLC ?
All about the How.
1 Analysis
• How to fulfill what the user
wants?
2 Design
• How the program is going
to achieve it?
3 Development
Tasks Involved
4 Testing • Algorithm Design (using
flowchart, pseudocode, or
5 Documentation other design tools.)
What is PDLC ?
All about Code.
1 Analysis
• Implement the algorithm
using programming
2 Design language(s)
Algorithm
Representation
Definition adopted from https://blog.usejournal.com/how-to-write-pseudocode-a-beginners-guide-29956242698 and C++ How to Program (8th Ed.) by Deitel and Deitel
Pseudocode: Examples
Example 1: Write a program that accepts an integer and outputs the
integer
Version 1:
INPUT an integer
OUTPUT the integer
Version 2:
INPUT X
OUTPUT X
Pseudocode: Examples
Example 2: Write a program calculating the sum of two integers
Version 1:
INPUT the first integer
INPUT the second integer
ADD the first integer and second integer, store result.
OUTPUT result
Version 2:
INPUT First
INPUT Second
Sum = First + Second
OUTPUT Sum
Flowchart
Flowchart
What do you understand
from the flowchart on
the right?
Get N
NOTE: “Get” or “Show” may be replaced with any word as long as it is unambiguous.
Flowchart: The Process Symbol
Indicates a particular operation.
In computing, this represents a CPU operation. The common ones
include:
Variable
Example 4:
Draw a flowchart that
calculates the sum of two
To be demonstrated
integers live
Flowchart: Examples Start
Example 4:
Draw a flowchart that
calculates the sum of two
integers.
Flowchart: Common Symbols (Part 2)
Diagram Name Description
Output Output
“One” “Not One”
Start
Flowchart: Examples
Example 5:
Draw a flowchart that
accepts two integers and
To be demonstrated live
outputs the smallest.
Start
Flowchart: Examples
Example 5:
Draw a flowchart that
accepts two integers and
outputs the smallest.
Flowchart: Examples
Example 6:
Draw a flowchart that
accepts an integer.
Show “Zero” if the To be demonstrated live
integer is 0. Otherwise,
show “Positive” or
“Negative”, depending
on the sign of the
integer.
Flowchart: Examples
Example 6:
Draw a flowchart that
accepts an integer.
Show “Zero” if the
integer is 0. Otherwise,
show “Positive” or
“Negative”, depending
on the sign of the
integer.
Flowchart: Examples
Example 7:
Draw a flowchart that
shows “Hello”
infinitely. To be demonstrated live
Flowchart: Examples
Example 7:
Draw a flowchart that
shows “Hello”
infinitely.
Flowchart: Examples
Example 8:
Draw a flowchart that
shows “Hello” 100
times. To be demonstrated live
Flowchart: Examples
Example 8:
Draw a flowchart that
shows “Hello” 100
times.
Q&A
Acknowledgement
• This presentation has been designed using resources from
PoweredTemplate.com