1 flowchart

18
FLOWCHARTING Flowchart A chart that contains symbols referring to computer operations, describing how the program performs. A graphic map of the path of control or data through the operations in a program or an information-handling system. Symbols such as squares, diamonds, and ovals represent various operations. These symbols are connected by lines and arrows to indicate the flow of data or control from one point to another. Symbols

Upload: charlene-leuterio-delas-alas

Post on 04-Mar-2015

1.451 views

Category:

Documents


2 download

TRANSCRIPT

Page 1: 1 Flowchart

FLOWCHARTING

Flowchart A chart that contains symbols referring to computer operations, describing how the

program performs.

A graphic map of the path of control or data through the operations in a program or an

information-handling system.

Symbols such as squares, diamonds, and ovals represent various operations.

These symbols are connected by lines and arrows to indicate the flow of data or control

from one point to another.

Symbols

Page 2: 1 Flowchart

Flowlines

indicated by straight lines with optional arrows to show the direction of data flow

the arrowhead is necessary when the flow direction might be in doubt

used to connect blocks by exiting from one and entering another

Terminal box flattened ellipses indicate the start and the end of a module

an ellipse uses the name of the module at the start

the end is indicated by the word end or stop for the top or Control Module

a start has no flowlines entering it and only one exiting it; an end or exit has one

flowline entering it but none exiting it

Page 3: 1 Flowchart

Initialization Box Initialization box - is used for declaring / initializing variables needed to solve a certain

process. Take note: You can only use variables that are placed inside the Initialization

box.

Declaration - binding of an identifier to the information that relates to it

- stating a variable name to be used

Initialization - to set (a starting value of a variable)

- to prepare (a computer or a printer) for use; boot

- to format (a storage medium, such as a disk)

Variable

A symbol representing such a quantity. For example, in the expression a2 + b2 = c2, a, b,

and c are variables which may represent any value.

Naming Convention

Do not use reserved words as your variable names.

Name your variables close to its functionality.

Always start with a letter.

Bad Variable Names Good Variable Names

High+Low Age

1st_Name First_Name

print Salary

Page 4: 1 Flowchart

Process box the rectangle indicates a processing block, for such things as calculations, opening and

closing files, and so forth

a processing block has one entrance and one exit

Input/Output box the parallelogram indicates input to and output from the computer memory

an I/O block has one entrance and only one exit

Page 5: 1 Flowchart

Decision box the diamond indicates a decision

it has one entrance and two and only two exits from the block

one exit is the action when the resultant is TRUE and the other exit is the action when

resultant is FALSE

Connectors the connector block is used as a connection between two sections of a flowchart that is

not adjacent or closely located to each other

Note: These connectors should be used as little as possible. They should be used to

enhance readability. Overuse decreases readability and produces a cluttered effect.

Page 6: 1 Flowchart

Flowchart Case Study:

Create a flowchart having a variable that is initialized to your

current age. Your flowchart should be able to show your age 5 years from

now.

Create a flowchart having 3 variables. Two of the variables is used

to initialize the Birth Year and the Current Year. The third variable is used

to compute for the current age. Your flowchart should display the age

value.

Page 7: 1 Flowchart

Flowchart Case Study:

1. Create a flowchart that computes for the circumference of a circle. Assume that the

value for radius is 7.23. Your flowchart should be able to show the value of the

circumference.

2. Create a flowchart that computes for the area of a circle. Assume that the user only

knows the value for diameter. Your flowchart must be able to accept a value for the

diameter and should be able to show the value of the Area.

Additional facts:

The pie value is 3.1416 which is constant and should never be changed. You can

compute the circumference by using this formula 2πR. And area is πR2

Page 8: 1 Flowchart

Flowchart Case Study:

Create a flowchart that lets the user enter a name,

address, Birthday, Age, Sex, and Phone Number. Your flowchart

should display the variables with the following format:

Create a flowchart that will compute for the Average score of a

student based on three quizzes. The quizzes are entered by the user,

the value may range from 0 to 100. However, the Average may have a

value having decimal places.

Example:

Q1: 98Q2: 79Q3: 88Ave is 83.33

Page 9: 1 Flowchart

Conditional Statements

What is a Condition? Conditions are statements that result to a Boolean value. The Boolean value may either

be a TRUE or FALSE, 0 or 1 value. Conditions are categorized into two:

1) LOGICAL OPERATORS

2) RELATIONAL OPERATORS

In programming, there are three basic logic operators that you

could use for conditional statements. They are the following:

NOT truth table

The NOT operator reverses the logic or result of a certain condition

AND/OR truth table

Page 10: 1 Flowchart

Try this!

Relational Operators

Page 11: 1 Flowchart

Relational Operators are used in order to get the Boolean result of a certain condition.

Boolean Result

The result may be a TRUE or FALSE value, depending on the condition that is being

evaluated.

The Relational Operator may be the following:

Exercise:

Assume that you have variables called X and Y. What would be the results of the conditions if

we were to compare them with different values and different relational operators.

More on Decision Box

Page 12: 1 Flowchart

It should be noted that what you place inside the diamond box are conditions that

either results to TRUE or FALSE.

Note: You don’t place conditions that are in essay form, you must be able to represent it

in a mathematical form.

Flowchart Case Study:

Draw a flowchart that will let theuser

enter a number, increase the value of the

number by 5 if it is greater than 10, and display

the result. Otherwise do nothing.

Draw a flowchart that will let the user

enter a number, increase the value of the

Page 13: 1 Flowchart

number by 5 if it is greater than 10, and display the result. Otherwise multiply the value by 5

and display the result.

Draw a flowchart for a college’s

admissions office. Create variables to store

the student’s numeric high school grade

point average and the admission test score.

Print the message “Accept” if the student

has a grade point average of 3.0 or above

and an admission test score of at least 60. If

the student does not meet neither of the

qualification criteria, print “Reject”.

Flowchart Quiz

1. Draw a flowchart that will let the user

enter a character to determine the user’s

gender (Male or Female). Display “Male” if

the user enters the value of ‘M’ and

“Female” for the value of ‘F’. (Assume all

inputs are correct)

Page 14: 1 Flowchart

2. Draw a flowchart to print “TRUE” if A is greater than B, and C is less than D or if A is greater

than B and D is less than 1. Print “False” if otherwise. (All values are entered by the user).