0% found this document useful (0 votes)
2 views28 pages

Chapter II Flowcharts and Algorithm Student Copy 1

Uploaded by

Japeth Matta
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
2 views28 pages

Chapter II Flowcharts and Algorithm Student Copy 1

Uploaded by

Japeth Matta
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 28

2020

Flowchart & Algorithms

I. Discuss the earliest method of computing and its history.


II. Understand an algorithm.
III. Discuss the programming development cycle.
IV. Describe the steps in program development.
V. Explain the importance of program analysis.
VI. Discuss the intellectual differences between man and machine.
VII. Describe modelling tools.
VIII. Define what is a flowchart.
IX. Distinguish flowchart from a pseudocode.
X. Explain the use of the different flowcharting symbols.
XI. Discuss the different types of flowcharts.
XII. Discuss the importance of algorithm to modelling tools.
CHAPTER

Learning Outcomes: At the end of this Chapter:


 Discuss the earliest method of computing and its history.
 Understand an algorithm.
 Discuss the programming development cycle.
 Describe the steps in program development.
 Explain the importance of program analysis.
 Discuss the intellectual differences between man and machine.
 Describe modelling tools.


OVERVIEW
Years before the dawn of computers, human had already begun writing
sequences of steps necessary to accomplish a particular task. For instance, in
culinary, a recipe is prepared according to the team-up of ingredients lined up
in place and arranged in the order in which they shall be tossed into the wok.
The order is necessary to make sure that what is being prepared goes with what
is expected by the costumers. A slight mistake in the sequence would certainly
affect the taste of the food. That is why there is a need to list down not only the
lineup of ingredients but most importantly the step-by-step procedure in cooking
the food.

But maybe, one of the most important turn of events which shapes the
method of writing down sequences of steps was after Pearl-Harbor. With the
soldiers sent to the front lines, women were recruited to do manual calculations
tor airborne trajectories on equipment that defies distance and gravity. They were
called “COMPUTERS”. Later, with the advent of electronic calculating machine,
the name “COMPUTER” was passed on to the latter and taught it to do math to
high speed which would spend many hours to complete, if done through manual
calculations. Computations were broken into elementary steps so that the
machine can execute and derive results with great precision. These elementary
steps that carry out specific task in logical order is what we called Algorithm.
An Algorithm is a step by step sequence of instructions that describe how data
is to be manipulated to generate specific output. Once coded into a computer-
language would transform into a computer program. A Computer program is
a set of instructions created for the purpose of telling the computer what to do
step by step and how the result should be generated according to the required
output based on a given set of data.
PROGRAMMING
DEVELOPMENT CYCLE
A program is developed for a certain purpose, and that is to provide
solution to a given problem using a computer. One have to design an
algorithm taken from the pieces of the basic steps arranged in the order
necessary to shape up a solution. These steps when collected will certainly
provide the required solution to the problem. After the program is
developed, it has to pass through the continuous process of refinement.
This process in which the program has to go by from beginning to end is
called Programming Development Cycle. A Programming
Development Cycle refers to the unbroken step of defining, coding,
compiling, executing and fine tuning the program until it is free from all
infirmities and the output generated conforms to the expected result.
Another reason why it is called a cycle is it starts over from where it ends.

STEPS IN PROGRAMMING DEVELOPMENT CYCLE


1. Defining and analyzing the problem.
2. Planning and designing the solution
3. Coding the solution
4. Testing and debugging the solution
5. Implementation
6. Maintenance & documentation

VISUAL REPRESENTATION OF THE PROGRAMMING CYCLE

1. Defining
& analyzing
the problem
6. 2. Planning
Maintenance the solution
&

5. 3. Coding
Implementat the solution
ion 4. Test &
Debug the
Solution

Figure 2-1 These steps need to be observed continuously until the program is completed, refined and applied.

Figure 0-1. These steps need to be observed continuously until the program is completed, refined and applied.
DEFINING & ANALYZING
THE PROBLEM

The question normally asked at this stage is “What task is to be done?”.


Hence, the most important thing to consider before solving a problem is to
identify and define the exact problem to be solved. One must have a complete
understanding about the needs and wants of the user. To avoid redundancy,
make sure that the problem defined is indeed the problem to be solved.

PROBLEM ANALYSIS
The problem itself is first broken into a few larger parts and its part into
smaller divisions and into smallest subdivisions if necessary, until it makes you
comfortable solving them piece by piece if necessary. Always remember that the
key to providing a good solution to a problem is to fully understand the entire
task and the details that comes with it.

Consider the following scenario:

Suppose a Mother gave her daughter money amounting to 10


thousand (10,000.00) pesos for initial payment for her school-fees reminding
her not to use the amount for shopping as she had to find ways to solve the
problem by herself.

Inspired with the determination to enter college for the second time,
the daughter hit the university belt. When she was close to the university,
she noticed a tiangge along the street where she immediately saw the
beautiful dresses and bags; she paused for a while and after a short
moment of hesitation, she went inside to shop. When she came out, she was
carrying those items feeling happy and contented. Counting with what is
left of her money, she realized that five thousand (5,000.00) pesos went to
her shopping spree.
Defining the Problem
Obviously, the 5,000.00 pesos that went to the shopping spree is the
problem – she can no longer turn to her mother to replace her shortage as she
was forewarned and advised. Finding for a solution is all her business now.

Analyzing the Problem

So let us find ways on how to solve her problem. We shall assume sources
of funds coming from friends and relatives. Five thousand is a big amount. If we
split it into two, we have two thousand five hundred (2,500.00) each. But still
2,500.00 is not a small amount to share. Splitting it into five, we have five one
thousand (1,000.00) each of her five friends, but still 1,000.00 is difficult to ask
from friends, then maybe, we can further break it down to 10 or perhaps to
twenty or maybe more.

Splitting it by ten (10) will give us


the following:
Splits Amount
1 500
2 500
3 500
4 500
5 500
6 500
7 500
8 500
9 500
10 500

Hence, the manner of splitting the said amount into smaller quantity is
clear and simple application of problem analysis. In problem analysis, our task
is not to outright solve the problem but to slice it in parts and further into smaller
parts until it becomes easier for us to start rendering a solution for each of the
broken pieces.
PLANNING THE
SOLUTION

One of the best technique in writing a good program is by planning.


Planning is a method of preparing the steps in logical manner to achieve a
specific task. If we effectively plan our actions it can reduce time and effort in
writing a program than we would without planning. A plan is like a map, as we
progress, we can always see how much progress we have advanced and how far
though we are from where we started. Knowing where we are helps us make good
decisions on where to go and what to do next.

The tasks involved in programming development is not as easy as ABC, it


is for this reason that planning is an important tool on how we should accurately
solve the problem than immediately coding the program and then later realize
that our lengthy code is not the solution to the problem.

In solving a problem, the programmer prepare on paper a plan containing


the details necessary to solve the problem. The program plan is like a script for
a korea novella written by the scriptwriter. The written script is played by actors
with respect to their roles. Similarly, a program-plan communicates the idea to
all the segments in the program on what they must accomplish. Once a solution
plan has been established, the programmer focuses on how each step of the plan
can be achieved by a computer. This requires the construction of an algorithm
for each of the segments in the plan.

ALGORITHM

An algorithm is a step by step process on how a problem is to be solved.


Example:
Let us create a situation for two workers, of these two workers, one
is human whom we shall call “Juan”, and the other one a cyborg
(cybernetic organism) which we shall call “Bagwis”. We will position
them on the field each with an empty bucket in front of them.
Opposite are two faucets located 20 meters away from where they
stood. Both defers in speed and intelligence. Juan can think with
cleverness while Bagwis’ lone advantage is speed as it can move and
act a lot faster than its human counterpart. Now, suppose we were
given control over these creatures to perform a specific task what
could possibly happen?
 Ways of doing the task
Guided with the natural and inherent power of human
intellect, Juan will perform the task according to the
order necessary to achieve his job and adjust when
necessary under the circumstances – but not with
Bagwis. Cyborgs are run by sequences of logical
instructions known as computer programs, and for
obvious reasons, computers are not capable of slicing
the steps embedded within the phrase “Go fetch
water”.so except the phrase is broken into elementary
steps and loaded internally in the form of instructions
Bagwis could simply do nothing. Accordingly, to afford
the computer opportunity to perform similar acts, the
steps taken by Juan had to be extracted, listed and
arranged in exact order.

The following steps are more likely to be taken by juan in logical


order.
1. Pick up the bucket;
2. Walk over to the faucet;
3. Put down the bucket;
4. Move the bucket under the faucet;
5. Open the faucet;
6. Check if bucket is filled with water;
7. If not yet filled, take step 6 again;
8. If filled, close the faucet;
9. Pull the bucket away from the faucet;
10. Lift the bucket;
11. Turn back;
12. Walk to the starting line;
13. Halt;
14. Turn back;
15. Put the bucket down;
16. Stop.

The above steps are collectively known as algorithm; a kind of process we


exactly need to provide instructions for Bagwis to follow the same way Juan is
expected to do.

Thus, if we hope to see Bagwis become functional, we must avoid giving it


with commands in a single phrase containing multiple steps. Instead, we have
to follow the sequences of action as contained in the procedural steps like those
listed above and tell Bagwis what to do step bystep in such logical fashion.

INTELLECTUAL DISPARITY (DIFFERENCE)

One important thing to note is the fact that computers do not possess the
inherent intellect in the same way human would demonstrate in the conduct of
his task. Computers are dependent on programs which contains a series of steps
taken from the natural sequence of human actions, and perform them with
remarkable speed and precision. Although computers work a thousand times
faster than humans, still, it executes line of command one at a time. Each time
each line is executed, a pause occurs between each succeeding steps. But
because of its amazing speed, pauses are almost undetected.

Hence, as soon as Bagwis “picked up the bucket” with such a tremendous


speed, it just have to pause and wait for the next feed until we supply the next
instruction “Walk over to the faucet” and pause again as it waits for the next feed
and goes on until we finally say “Stop”.

Speed is the primary reason why we are using computers. However, the
procedures we intend the machine to perform are found not from technical
phrases known to it but from the very basic steps at which human shall readily
demonstrate if given the task to do it by himself.

MODELLING TOOLS

It has been mentioned that an algorithm is formulated for the purpose of


solving a programming task. However there are different ways on how an
algorithm may be presented for purposes of laying the concepts and the steps
necessary to solve the problem.

2 modelling tools:
1. Pseudocode – a non-standard English-like statements containing
sentences and phrases that look closely similar to the syntax of a
programming language. Unlike a programming language which observes a
strict rule on keywords and syntax, there is none in pseudocode. As long
as the contained statements are readable, understandable and outlines
the logical processes needed to accomplish the task – it is pseudocode.
The algorithm are statements that were written almost similar to
pseudocode.
As might be observed in figure 2, it contains logical steps that were
expressed in an English-like statements. It suggests in plain language how
the sales amount should be computed and displayed after inputting and
multiplying quantity being sold by the corresponding unit price. Take
note also, how the statements are placed within the context of BEGIN and
END instructions.

Begin:
Clear the screen
Display
“Quantity Sold”
Accept Quantity
Display “Unit Price”
Accept Unit Price

Compute Amount = Quantity X Unit price


Display Amount
End

Figure
Figure1-2
0-3.Sample
SamplePseudocode
Pseudocode

2. Flowchart – graphical representation of the step by step process in solving


a problem. A visual diagram showing the progress of work through the
sequence of operations. It is a tool well acknowledged by many as an
important technique reflective in an instant of the true picture of the entire
programming task. Hence, a flowchart facilitates visual understanding of
the whole procedure so it can be viewed in a single print instantly showing
the description of the entire operations in solving the problem.
Here is a flowchart of how program development can be done.

START

Identify the program


requirements

Prepare the algorithm of the


flowchart

Write the program code

Compile the program code

Y
Is there a Debug the program X
syntax error?

Run the program

Is there Y
X
logical error?

STOP

Programming therefore is not just a problem solving, it also needs to


follow a certain flow in order to arrive at a solution. It also needs patience, not
just critical thinking. If a programmer lacks patience, then the program may
not materialize.
In real life, we also need to be a problem solver, follow order and
sequence, follow rules, be patient in doing any work and think critically.
Actually, to be a programmer, we must possess many good values such as
being able to work in a team, considerate, patient, analytical and critical
thinker and obedient to order and flow.
Let us consider the pseudocode example in figure 2.

START

CLS

Display
“Quantity sold”

GET QUANTITY

DISPLAY UNIT
PRICE

GET PRICE

AMT= QTY * PRICE

DISPLAY AMT

END

Figure 1-3 A flowchart showing the graphical representation of the statements


taken from the pseudocode in figure 1-2

CODING THE
SOLUTION

Coding is the stage where the defined procedure is described in the


pseudocode or as visually symbolized by a flowchart is transformed into a
machine code through a programming language. A pseudocode or a flowchart
serves as the blueprint which shows the exact flow of the steps in solving a
problem, but these modelling tools are something beyond the machine’s
comprehension.
One of the things that brings programmer and computer together is a
programming language through which the exchange of information is facilitated
and the gap between their spoken languages is reduced.

The only thing understandable to computers are numbers Zero (0) and one
(1). These binary numbers serve the basic concept that makes the native
language of the computer.

Anyone with deep interest in systems development can use assembly


language. However, coding in assembly language is difficult due to its symbolic
codes that is used to represent machine instructions. C language as it is
popularly known is a middle-level language because it belongs to the center
level between the binary codes and another language which simplifies a
programming task known as high level programming language. COBOL, Java
and Visual Basic just to name a few, are high-level programming languages.
It is said to be high level because its structure is written in English like
statements.

Nonetheless, the starting line for drawing out our plan in solving a problem
does not begin with the use of any of the programming languages but from the
basic concept of algorithm through a flowchart or a pseudocode. It is only
after an algorithm or a flowchart have been developed that the whole process
is ready for conversion into statements ruled by a computer language.

TESTING AND
DEBUGGING THE SOLUTION

Testing and debugging is the method of validating the program to ensure


that it will correctly work on the required task. Testing and debugging are closely
related. A Program is run to test whether or not it conforms to the required
processes. If the rule of language is violated, it normally throws errors but
generates results if the rule is appropriately followed. However, being free from
errors does not mean the program is doing its job correctly. In most cases, a
program is executed faultlessly but there were times when the generated output
brings us wrong results.

1. THE COMPILATION PROCESS


After coding, the translated statements (derived from flowchart and
pseudocode) had to be compiled to generate an executable code. In
the computer dialect, the terms “translated statements” and
“executable code” simply refers to a source-code and object code
respectively. The source code is the totality of instructions written
in English-like statements made under programming language
rules of syntax. But a source code is without meaning to the
computer until it is translated into an object code by means of a
compiler. A compiler is a special kind of software which translates
a source code into an object or executable code which a compiler
can put into action. Figure 1-4 shows the compilation diagram:

SOURC OBJEC
E T
CODE COMPILER CODE

Figure 0-4 shows how a compiler generates an object-code from a source-code

2. THE DEBUGGING PROCESS


The reason why a program must be compiled was because the
object-code or the executable code had to be created. However, no
object-code or executable code maybe generated through the
compilation process until the program is released from any form of
errors; be it typographical or grammatical in nature.

Errors detected during the compilation process are called syntax


error . this type of error is generated when the grammatical rules
as prescribed by the compiler is violated.

3. TEST RUN
A test run is performed for purposes of correcting and removing
output errors left undetected during the compilation process.
During the test run, dummy data is fed into the program to suggest
output that might be expected.

After a test is completed and all sorts of inconsistencies are


corrected, the program is once again executed, but this time a copy
of actual data is mounted. If after execution of the program and the
output still failed to conform to the expected results, the program
once more is corrected, compiled and tested.

During test run, two kinds of errors are normally detected; one is
run-time-error and the other is the logic-error. Run time error
causes the program to end abnormally (ABEND) during execution.
One of the causes of run time error is when a program tries to access
inexistent data-file. On the other hand, logic-error never
terminates the execution of the program but it affects the outcome
of the processing. Usually it is the output, which speaks of logic-
error. When the expected output is found different from what is
actually generated, logic-error will exist. There is logic-error when
what we mean in our program is not what it says during the run.

IMPLEMENTATION

After the program was tested and the output generated using a copy of
the live data conforms to the required output conditions, the actual use of the
program begins. This time a realtime or live data is attached and the program is
executed behind the strict supervision of the implementing programmer. The
output will be strictly examined to make sure that no errors will be left unnoticed
and uncorrected.

MAINTENANCE AND DOCUMNETATION

When the program is effectively controlling and processing, the need for
maintenance and documentation is mandatory. One of the reasons is “further
reference”. It is inevitable that during the program’s use, some changes might
need to be made as when there are changes to company rules or on government
policies; like if new taxes are implemented. The effect brought about by the
changes necessarily affects the programming cycle and the program had to be
updated.
The documentation process does not only mean providing lists of the whole
lines of program but also providing back-ups and storing data files on safe places
where they can be readily referred to as the need arises. Another reason and
treaded to be the most important value of maintenance and documentation is
when the programmer is unavailable or has to leave, the program will be left
under the care of another programmer and the documentation is the only means
by which program’s logic can be traced and some changes or updates are made.
THE FLOWCHART

Learning Outcomes:
At the end of this Chapter you should be able to:
 Define what is a flowchart.
 Distinguish flowchart from a pseudocode.
 Explain the use of the different flowcharting symbols.
 Discuss the different types of flowcharts.
 Discuss the importance of algorithm to modelling tools.

USING A FLOWCHART

A flowchart is a planning tool that graphically portray a programming task. It is a visual


diagram showing the progress of work through a sequence of operations. A pictorial representation
on how an algorithm works is quite easier to understand through a flowchart. An algorithm is the
source of steps necessary to solve a problem, yet the method of presenting those steps into plain
English like statements slows down comprehension as one had to read the entire words representing
each step before an idea is perceived and context is understood. This is the reason why flowchart is
more popular than the rest of other modelling tools. Flowchart graphically represents detail of steps
in solving a problem and allows users to visualize the logic simply by looking at the symbols as
portrayed in the diagram’s construct (idea).

BENEFITS AND LIMITATIONS OF USING A FLOWCHART

Some of the benefits of flowcharts are as follows


 The logic of the program is easily communicated to another person without
having to explain in details its contents.
 Flowchart helps in effectively and efficiently showing a segmented solution of
a problem sliced into smaller parts so it can be easily viewed and understood
at a glance.
 For purposes of documentation, flowcharts serve the purpose as it presents
the steps in a more detailed form.
 Once the flowchart is drawn, it becomes easier to write the code the program
into any programming languages.
 The flowchart is very useful in correcting errors. Steps containing faults that
are difficult to pick-up on lengthy text are easily understood in the flowchart.

Some of the limitations of flowcharts are as follows


 When the logic of the program develops in more detailed and in rapid
proportions, the flowchart has a tendency of becoming difficult and
uncoordinated.
 When major adjustments are required to be made, the flowchart may require
significant modifications or even complete re-drawing.
 Flowchart is meant for human communications only. No part of it is
understandable to the machine.
 Except for its logic, none of the current programming language is exclusively
represented by the flowchart.

TYPES OF FLOWCHART

7. SYSTEM FLOWCHART
A SYSTEM FLOWCHART is a graphical representation showing the overview of
the processing employed in the whole system. When a system analyst is developing a new
system application, his ideas need to be written down on paper mostly in graphical illustrations.
One of the most important tools of the system analyst is the system flowchart as it brings
the most effective way of showing what input are required; what actions are to be taken to
process the inputted data, and what outputs should be as required by the system. System
Flowchart also shows connectivity to the software, hardware and peopleware involved in the
operation.

1. STANDARD SYMBOLS

Online
storage (file
Hard disk Magnetic tape
storage on
hard discs)
Visual Display Document
Data Processing
Unit (monitor (Printed
Operation
screen) Copy)
Manual input
Terminal Punch card
(i.e. keyboard)
Sort
(Alphabetical, Communication
Collate
chronological, Line
numeric)
On page
Off page
connector (a Merge (e.g. join
connector
link to or two files of
(link diagram
from another names, one file
from one page
part of a after another
to another)
diagram
System flow chart symbols
2. AS MEDIUM OFCOMMUNICATION
Most of the time the system analyst communicates in part with programmer through
graphical images, and it is within the context that a system flowchart is considered useful.

Input file MASTE Transactio


R FILE
Input file
n File

MERGE Program to
create
Updated Merging
Output file Master Report Output file
file

A system input and output operation diagram

The above system flowchart tells the programmer to write a program which will sequentially
merge or rewrite the contents of both Master and Transaction files into updated Master file and to print a
report showing the contents of the new or updated master file. Files with flow lines pointing the
directions of the process (merge) box are input files. Files pointed by the directions of flow lines away
from the process box are output files.
The figure likewise transmits visual understanding to the programmer that both Master and
Transaction file are input files to the program while the Updated Master file and Merging report
are outputs that should be generated. Transaction and updated master files are stored on a disk. Master
file is stored on magnetic tape while the merging report is to be printed on the paper through a line
printer.

Error Report
Input Validate
Transactions



  Validated
 Transaction
Update
Master file




 Update Report





 The figure illustrates an instance when the output file in one program serves as an
input to another. The flowchart above speaks of (1) source transaction that is previously
recorded manually keyed in through a keyboard; (2) a validation program accepts the source
transaction record, evaluate it and write into validated transaction file when it is authentic, but
dump it to the printer when it bear errors. Once the validated transaction file is free from
errors, it can serve as an input for purposes of updating the master file. Thereafter, together
with the master file the validated transaction file is used to generate an update-repot.
The process as shown above is mostly sequential in nature except during an update
when double pointed arrow is used between update box and the master file. Double pointer
arrow means the access to the master file is direct and that the latter is simultaneously used as
an input and output (I/O) file in an update processing.

8. PROGRAM FLOWCHART

A PROGRAM FLOWCHART is a graphical representation of the logic in solving a


problem. It provides detail of steps and the sequence in which those steps are executed
to generate meaningful results. It describes the flow of the sequential steps necessary
to solve a problem. A programmer normally begins with general picture of the overall
logic and breaks it to fewer larger parts. Each part id then broken into smaller pieces
and further into smaller sections when necessary. Each time each part is reduced, more
details of the steps are described and the smaller each part would become, the greater
the details are emphasized.
After the programmer has completed the necessary breakdowns, the steps are
converted into a flowchart. This is done by assigning appropriate symbols to each line
of instructions and arranged in logical fashion. Once a flowchart is drawn, the logic
can be easily checked, modified and refined to conform to the processing requirement.
Coding translates the logic embedded in the flowchart into a high level language to
generate a source program.
PROGRAM FLOWCHART SYMBOLS

Terminal Process Input/Output

Decision Flow lines Pre - defined

Off page On page


Preparation
connector connector

annotation

Standard program flowcharting symbols


SYMBOLIC TERMS AND USAGE
1. Terminal (Oval)
This terminal symbol is used to indicate the starting as well as the ending point of a
flowchart. In plain language, all program flowcharts should start and end with a
terminal symbol.
 START
 STOP
 RETURN
 BEGIN
 END
 EXIT

START
Note: shaded oval shapes are terminals.
STATEMENT 1 and STATEMENT 2 are
STATEMENT command formats

STATEMENT

STOP

2. PROCESS (rectangular)
A process symbol is used to represent arithmetic operation or when casing individual
variable assignments. This rectangular shape is the most frequently used symbol in
flowcharting. However, each process box may contain only one mathematical
equation; this means, if there two or more independent mathematical calculation to be
made, each calculation must use one process box. The same is true when assigning
data variables.
OPERATORS DESCRIPTION
= EQUAL
- SUBTRACTION
+ ADDITION
/ DIVISION
* MULTIPLICATION
^ OR ** EXPONENTIATION
OPEN For opening files
CLOSE For closing files
List of mathematical operators as well as input/output labels
The following example shows how process symbol is used:

START

Note: shaded rectangular boxes are processes


X=0

X =X + 1

STOP

3. INPUT/OUTPUT (parallelogram)
This shape indicates input and output operations and also specifies the link between
the input and output devices. Hence, the input/output symbol shows the flow of data
and the device where such data is passing through during the processing.
STATEMENT DESCRIPTION
INPUT - When data is keyed in from the keyboard
READ - When data is retrieved from the disk storage
WRITE - When data is stored in disk storage
PRINT - When result is sent to the printer
DISPLAY - When the output is displayed on the screen
Mnemonics used in Input/Output symbol

START

Note: shaded symbol is input/output

INPUT X

PRINT X

STOP

4. Decision (diamond)
Decision symbol is used to evaluate a conditional statement and branch out to the required
process depending on the outcome of the test which could either be true or false. Only three
out of four corners of the decision symbol are used for connective processing. The left and
right shoulders of decision symbol is normally labeled with a tandem indicators such as
“YES” or “NO”, or “TRUE” or “FALSE”. These labels are used to indicate which path or
what course of action to take if the result of the evaluation is “YES” or “TRUE” or if result
is “NO” or “FALSE”.
LOGICAL SYMBOLS
= Equal
> Greater than
< Less than
!= Not equal
Test expression operators

The following flowchart demonstrates how a decision symbol is used to evaluate an expression

START

X=0

INPUT X

False True
X>0

PRINT X

STOP

5. Predefined
Pre-defined symbol indicates another block of code containing processing steps which are
declared but purposely separated from the main line of instructions. Simply, this shape is used to
describe a sub-routine or a function in the program which may be called runtime.
In structured programming, certain block of code must be separated and placed in a
subroutine or a function. The purpose of this is to make the block of code aptly available from any
point of call in the main program.
MAIN

SUB-TEST
START

START
X=0

False True
X=0
INPUT X

PRINT X
SUBTEST

RETURN
DISPLAY
“DONE”

STOP

Using pre-defined process in calling a subroutine’s execution, the control is temporarily transferred to SUB-
TEST. The RETURN command in the subroutine allows control to go back to the main flowchart to
execute the next line of command following the call. IF STOP is put instead of RETURN, the control will
not go back to the main routine and the execution had to end abnormally.
6. Preparation (hexagon)
The preparation box is used to define a set of variables. Normally, variables are defined by
using the process box, but sometimes because of the limitations associate with the process
symbol, its use is critically inappropriate. A process box may be used to define a single
variable and that if two variables are to be defined, then two process boxes have to be drawn.

Preparation box works differently. It accepts variables regardless of its count. It should
immediately follow the terminal START symbol, it must appear only once in the flowchart
and must be used only for defining variables.
The following flowchart shows how set of variables are accommodated into a single preparation
box and how said variables are held into two separate process symbols.

FLOWCHART A FLOWCHART B

START
START

A=0 A=0
B =0
B=0
INPUT A,B

INPUT A,B

PRINT A,B
PRINT A,B

STOP

STOP

7. On-page connector (Small circle)


This symbol is typically small and is used to show a jump from one point to another within
the same page. To show matching jump points, connectors are labelled with a number or with
an upper case letter.
Flowcharts are normally written in a top down fashion; starting from the top of the lengthwise
half of the paper up to the spaces just before the edge below. To indicate the length between
the exit and the entry point within the page, the on-page connector is labeled with the same
alphabet or number on each point.

START

S
A=0
B=0 B=B+A

INPUT A
PRINT A,B

INPUT B
STOP

A = A* 5

S
When the lower edge is reached, the continuation is placed on the right side of the page. Two small circles
are used with letter S as link indicator.
8. Off-page Connector (pentagon)
The off-page connector is a small pentagon shape that is used to show flowcharting jump
from one page to the next. To show matching jump points, connectors are usually labeled
with unique uppercase alphabet. The symbol is used when the flowchart would require
several pages within which the rest of the steps had to be continuously inscribed.

Page 1 of 2 P Page 2 of 2

START

B=B+A

A=0
B=0
PRINT A,B

INPUT A
STOP

INPUT B

A = A* 5

When the edge of the page below is reached, the continuation of the flowchart is laced onto the next
page. To indicate connectivity, a small pentagon is used with the letter P as page link indicator.
9. Flowline (Arrow)
A flowline is used to show directional flow of the process in the flowchart. It helps the
reader to follow the procedural sequences in the flowchart by simply looking at where the
direction of the flowline is heading.
Chapter Quiz
NAME: DATE:
YEAR/COURSE: SCORE:

_______________1. These are elementary steps that carry out specific task in
logical order.
_______________2. It is referred to as a set of instructions created to tell the
computer what to do step by step and how the result should be
generated according to the required output based on a given set of
data.
_______________3. It refers to the unbroken step of defining, coding,
compiling, executing and fine tuning the program until it is free from
all infirmities and the output generated conforms to the expected
result.
_______________4. It is the manner of splitting the said amount into smaller
quantity.
_______________5. It is a method of preparing the steps in logical manner to
achieve a specific task.
_______________6. It is a non-standard English-like statements containing
sentences and phrases that look closely similar to the syntax of a
programming language.
_______________7. It refers to as a visual diagram showing the progress of
work through the sequence of operations.
_______________8. This modelling tool serves as the blueprint which shows
the exact flow of the steps in solving a problem.
_______________9. It is a term referred to the method of validating the
program to ensure that it will correct work on the required task.
_______________10. It is the totality of instructions written in English-like
statements made under programming language rules of syntax.
_______________11. It is a special kind of software which translates a source
code into an object or executable code.
_______________12. These are Errors detected during the compilation process.
_______________13. It is a process performed in computer programming to
correct and remove output errors left undetected during the
compilation process.
_______________14. This programming error causes the program to end
abnormally.
_______________15. What is the complete name of our University President?
II ENUMERATION
A. WHAT ARE THE STEPS IN PROGRAMMING DEVELOPMENT CYCLE?

B. WHAT ARE THE TWO MODELLING TOOLS IN COMPUTER


PROGRAMMING?

C. WHAT ARE THE TWO KINDS OF ERROR DETECTED DURING TEST


RUN?

III. ESSAY
1. Who is more intelligent? A human or a computer? Justify your answer.

IV. ANALYSIS
2. September, It is the harvest season of corn in Alfonso Lista, Mang Juan,
has a passenger jeep and he was hired to load the Corn of Mang Gusting
as he wanted to bring his harvest to Santiago City because price of corn in
the city is more expensive than in the barrio. Mang Gusting’s jeep has only
a maximum load capacity of 3000 kg. The load is exactly 3000kg but with
the two passengers, the load is already beyond the capacity of the vehicle.
Mang Gusting knew the risk if they will not unload some of the sacks of
corn, but he could not resist the request of Mang Juan. While they were
on their way, the front tire of the vehicle blew up in front of the gate of the
IFUGAO STATE UNIVERSITY. One of the students in CCS with the subject
Computer Programming I saw the incident and he decided to site it as an
example for his “real time” algorithm and titled it as : HOW TO CHANGE
A FLAT TIRE OF Mang Gusting’s jeepney”.

You might also like