Professional Documents
Culture Documents
JERRY ESPERANZA
Objective
The module was designed to achieve the following; 1. Identify flowcharting
symbols. 2. Use flowchart symbols in identifying steps/pseudocode in logic
formulation. 3. Formulate flowchart solutions. The material used a problem-direct
solution approach. Instead of defining each flowchart symbol first, we applied it
on situation when we need it and define it on the sidelines. What covered on this
material are program flowcharts. System flowcharts are designed to show interface
between input/output devices, to other systems, and the program itself. It uses
other specialized symbols which are beyond the coverage of this courseware. Though
new tools are being introduced in software development, flowcharting is still one
of the effective tools in presenting the logic/idea of program execution. Students
of Computer Science or related IT courses will benefit on this courseware as one
prepares career as Scientist, Analyst, Programmer or Project Manager. We encourage
everyone to give us feedback on how you find this material so we may improve it.
You may reach us at thrivingJerry@yahoo.com. Visit also our blogsite:
http://ThrivingAndLiving.blogspot.com .
http://ThrivingAndLiving.blogspot.com
2
Flowcharting as Algorithm Tool
Algorithm is a step-by-step procedure in solving a problem. It may be expressed in
a human language, pseudocode (not a real code), and/or with flowcharts. Flowchart
is the graphical representation of the algorithm. Problem A gives emphasis on how
to convert step-by-step tasks into a flowchart. Terminal is mandatory symbol used
in all flowcharting activities. There is only one set of start and end terminal
symbols in flowcharting an algorithm. It is strictly enforced to use an arrow head
at the end of the flow lines. It helps to know which direction the flowchart is
heading. Process box denotes action. Problem A. Design a flowchart from the given
tasks: 1. Plug in computer power cords to the Uninterruptable Power Supply (UPS).
2. Switch on UPS. 3. Push the power-on button of the PC. 4. Enter username and
password in the Microsoft XP login dialog. Solution:
Start
Switch on UPS.
Process Box represents the process of executing a defined or group operations that
result in a change value, form or location of information.
End
http://ThrivingAndLiving.blogspot.com
3
Decide which path to take
Problem B gives us a dose on how to deal with decision. The diamond symbol
represents a condition normally answered by yes or no, true or false. A path is
taken and determine the next step to do depending on the answer set by the
condition. Problem B. Design a flowchart from the given traffic procedure: 1. Slow
down at intersection. 2. Check traffic light signal. 3. If signal = green 3.1
Continue driving. Solution 1
Start
4. If signal = red 4.1 Press brake. 5. If signal = yellow 5.1 Prepare to stop.
* Signal = green? **
Continue driving. C
Signal = red?
Press brake.
Signal = yellow?
Prepare to stop.
N
C End
http://ThrivingAndLiving.blogspot.com
4
Solution 2 We can solve the same problem using a different approach. No need to
test if the signal is yellow. We can logically assume that if it is not green, two
conditions would remain: either red or yellow. Green is tested first; red next.
Therefore, neither green nor red, we proceed immediately to step when the color is
yellow. Thus, we eliminate the condition of testing yellow.
Start
Signal = green?
Continue driving. C
Signal = red?
Press brake.
N
Prepare to stop.
End
http://ThrivingAndLiving.blogspot.com
5
Initialize your Storage
Algebra uses literals (x and y variables) in solving an equation. In programming,
variables or identifiers are treated as memory storage. We need to name (and
initialize) it at the start of every program. Just like in an algebraic equation,
the value of these identifiers varies as the execution of the program progresses.
Problem C introduces the use of initialization or preparation symbol.
Parallelogram is also used specifically to signify process dedicated either to
input or output tasks. Problem C. Design a flowchart from the given arithmetic
operations: 1. Initialize x with 3; y with 4; z with 0. 2. Add x and y and store
it at z. 3. If z < 10 3.1 Display “Sum is less than 10”. Solution`
Start
z= x+y
z < 10
N
End
Input/Output box used as an I/O function which makes data available for processing
(input) or displaying (output) of processed information.
http://ThrivingAndLiving.blogspot.com
6
Break Large Task into Small Tasks
We may run not just into steps but series of steps. This would be a dilemma for
programmers and analysts if they are working on larger systems. It would hard for
them to contain the problem if something goes wrong. One way to avoid this kind of
situation is to modularize inter-related tasks into one package. Solution for
Problem D shows how flowcharting approaches modularization. It has a main program
that jumps into subtasks (addNumbers/subtractNumbers) and returns to the calling
program (main) after execution. Subtasks are smaller programs within a program.
That is why it starts and ends with terminal symbols. Instead of the START/END
texts inside these terminal symbols, the name of subtask is indicated; RETURN
signals the end of the execution within subtask and returns to the calling
program. Problem D. Design a flowchart with two modules set. 1. addNumbers. 2.
subtractNumbers. addNumbers: 1.1 Initialize x and y with zero. 1.2 Enter number
and store to x. 1.3 Enter number and store to y. 1.4 Add 1 to y. 1.5 Add y to x.
1.6 Print the value of x. subtractNumbers: 2.1 Initialize z with -4. 2.2 Subract 1
to z. 2.3 If z < -4 2.3.1 Add 2 to z. else 2.3.2 Subract 1 to z. 2.4. Print the
value of z.
Solution:
Start
*
addNumbers
subtractNumbers
End
http://ThrivingAndLiving.blogspot.com
7
addNumbers A
x=0 y=0
y= y+1
Accept x
x= x+1
Accept y
RETURN
subtractNumbers
z = -4
z <-4
Y
z=z+2
N
z=z-1 z=z-1
1
Print the value of z.
Off-page connector is used to direct the next instruction located on ANOTHER page.
Label it either by letter or number or combination of both. Page 1
RETURN
Page 2
http://ThrivingAndLiving.blogspot.com
8
Connectors used on loops
We can see on the solution of Problem E how connectors are utilized in doing
repetitive tasks. Connectors are best applied when loops occur in the program.
Problem E. Design a flowchart from the given pseudocode: 1. Initialize identifiers
start with 1; finish with 4. 2. if start < 4 2.1 Display value of start. 2.2 Add 1
to start. 2.3 if finish > 0 2.2.1 Display value of finish. 2.2.2 Subtract 1 to
finish. 2.2.3 Proceed to 2.3 2.4 Store 4 to finish. 2.5 Proceed to 2. 3. Display
value of start. 4. Display value of finish. Solution
Start A
start = 1 finish = 4
C
N
Display value of finish
start = start + 1
http://ThrivingAndLiving.blogspot.com
9
Common Flowcharting Error
1. Hanging process. This is a common error where the designer left process or
predefined box hanging and does not specify the next task to do. Use may use flow
lines or connectors to correct this problem.
green?
NO!
YES
2. Decision box with three-outgoing branch. You may notice from other textbooks
the use of 3-outgoing branch. Because this material is used as introduction to
programming, stick with the use of 2-outgoing branch for now. The decision box on
this case is designed only to answer conditions with YES or NO; TRUE or FALSE.
YES
NO
NO
NO!
YES
http://ThrivingAndLiving.blogspot.com
10
3. Too many end terminal symbols. Flowchart designers who are lazy to route the
next step to END often create more than one terminal symbol. Remember always that
you are only allowed to have one set of START/END terminal symbols in a flowchart.
Again, you may correct this error by using flow lines or connectors.
Signal = green?
Y Continue driving.
Signal = green?
Y Continue driving.
End N N
Signal = red?
Y Press brake.
Signal = red?
Y Press brake.
N A
End
End
NO!
YES
http://ThrivingAndLiving.blogspot.com
11
Problem Exercises
I. Design a flowchart based from the given tasks. Problem A. Initialize x and y
with value 0. Store 10 to x. Store -3 to y. if y<x 4.1 Display “x is greater than
y” 4.2 Display value of x. 5. Display value of y. 1. Initialize age with a value
of 0. 2. Accept age. 3. if age<18 3.1 Print “Minor: you cannot vote”. 4. if age >=
18 4.1 Print “Your age is eligible to vote.” 5. if age >= 65 5.1 Print “Senior
Citizen: Vote wisely. Our future is at stake.” Initialize num with value 0.
Display “Enter a number”. Accept num. if num>0 4.1 Display “Number is positive”.
else 4.2 if num<0 4.2.1 Display “Number is negative”. else 4.2.2 Display “Number
is origin”. 5. Display value of num. 1. Initialize inputGrade and grade with value
0. 2. Accept inputGrade. 3. if inputGrade <= 100 3.1 if inputGrade >= 98 3.1.1
grade = 1.0 4. if inputGrade <= 97 4.1 if inputGrade >= 95 4.1.1 grade = 1.25. 5.
if inputGrade <= 94 5.1 if inputGrade >= 91 5.1.1 grade = 1.5. 6. if inputGrade <
= 90 6.1 if inputGrade >= 89 6.1.1 grade = 1.75. else 6.2.1 if inputGrade <= 88
and inputGrade >= 86 6.2.1.1 grade = 2. else 6.2.1.2 grade = 5. 7. Print the value
of grade. 12 1. 2. 3. 4. 1. 2. 3. 4.
Problem B.
Problem C.
Problem D.
http://ThrivingAndLiving.blogspot.com
II.
Formulate your own flowchart that will solve the following problems.
1. Show steps on how to withdraw money from ATM. Include situation of what to do
when machine captures your ATM card. 2. Design a modularize approach of how to
convert Celcius to Farenheit temperature and vice versa. The user enters a
temperature and later asked on what temperature conversion will it make. Compute
and display the converted temperature value. Use the following formula in
conversion: Celcius = 5/9 * (Farenheit -32) Farenheit = 9/5 * Celcius + 32 3.
Write a flowchart that will display message “Programming is fun!” 10 times. Your
flowchart should be flexible enough to handle change of number of times the
message is displayed: you only need to change the value 10 into either 5, 15, 100
or 1000 and nothing more.
http://ThrivingAndLiving.blogspot.com
13