Download as ppt, pdf, or txt
Download as ppt, pdf, or txt
You are on page 1of 19

Creating Flowcharts

Principles of Engineering © 2012 Project Lead The Way, Inc.


Algorithms
• How many tasks do you complete daily?
– Brush your teeth, feed a pet, and get dressed
• Each task is made up of steps in a
sequence also called an algorithm
• An algorithm can take several forms
– Humans may prefer common language
– More complex problems may be better
visualized using a flowchart
– A device like a computer uses a computer
program written by a skilled programmer
Algorithm Comparison
• Common language
– Easy to algorithm objective statement
• Flowchart
– Effective visual tool especially for complex
process with decisions
• Pseudocode
– Hybrid of common language that aligns with
computer program instructions
• Computer program
– Ready to be executed on a processor
Algorithm Examples
Common Language: Count from 1 to 9 by odd numbers.
Flowchart Programming Language (Python)
START # Print odd numbers from 1 – 9
INPUT 1
start, end = 1, 9

SAY NUMBER # iterating each number in list


for num in range(start, end + 1):
ADD 2

# checking condition
Is number >9?
NO
if num % 2 != 0:
YES
print(num, end = " ")
END
Create a Flowchart
• Definition: a flowchart is a schematic
representation of an algorithm or a
process.
• A flowchart abstracts the flow of steps to
complete a task using specialized symbols
as shown in the example.

N
Parts of a Flowchart

Start/end
Input/output
Process

Arrows

Display
Decision
Start/End
• Shape is a rounded rectangle
• Start is required of all flow charts
• Some flow charts may not have an END
Process
• Shape is rectangular
• Process involves the action or the verb
part of the flowchart
• Examples include
– Add 1
– Turn the motor on
– Turn the light off
– Rotate the part
Input/Output
• Shape is a parallelogram
• Indicates that manual operation is needed
• Examples include
– Type in the weight
– Check the balance
– Time the operation
Decision

• Shape is a rhombus
• Outcome is either yes or no
• Examples include
– Is this number larger than
10?
– Does the weight meet
specifications?
– Has the count been
reached?
Arrows
• Arrows indicate the flow of the chart.
• Arrows are drawn from the output of one
block to the input of another.
• Only one arrow can represent outputs.
• Multiple arrows may represent inputs.
Example Flowchart
• Count from 1 to 9 by odd numbers.
• Before attempting to draw the flowchart,
determine what you want the output to be.
• What is the first block (always)?
Step 1
• The output will be 1, 3, 5, 7, 9.
• The Start block is always first.

START
Step 2
The program begins with the number 1.

START

INPUT 1
Step 3

Now that there is a number, the program


will state the number.
START

INPUT 1

SAY NUMBER
Step 4
The number 2 will be added to 1 so that
the program will continue to count by odd
numbers.
START

INPUT 1

SAY NUMBER

ADD 2
Step 5 START

INPUT 1

SAY NUMBER
Add a decision block so
that the program will
continue counting until ADD 2
the value is greater than
9. NO
Is number >9?
Step 6 START

INPUT 1

SAY NUMBER
Once the number is
greater than 9, the
ADD 2
program ends.
NO
Is number >9?

YES

END
Your Turn
Create a flow chart that shows how to pour
a glass of milk.

You might also like