100% found this document useful (1 vote)
1K views30 pages

Flowchart

Here is the flowchart for the above algorithm: START Input NAME, OVERTIME, ABSENT NetHours = OVERTIME - (2/3) * ABSENT Y is N NetHours > 40 PAYMENT  $50 Y is N NetHours > 30 PAYMENT  $40 Continue similar logic down to NetHours ≤ 10 Print "Bonus for", NAME, "is $", PAYMENT STOP

Uploaded by

sajid_bosco
Copyright
© Attribution Non-Commercial (BY-NC)
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPT, PDF, TXT or read online on Scribd
100% found this document useful (1 vote)
1K views30 pages

Flowchart

Here is the flowchart for the above algorithm: START Input NAME, OVERTIME, ABSENT NetHours = OVERTIME - (2/3) * ABSENT Y is N NetHours > 40 PAYMENT  $50 Y is N NetHours > 30 PAYMENT  $40 Continue similar logic down to NetHours ≤ 10 Print "Bonus for", NAME, "is $", PAYMENT STOP

Uploaded by

sajid_bosco
Copyright
© Attribution Non-Commercial (BY-NC)
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPT, PDF, TXT or read online on Scribd
You are on page 1/ 30

FLOWCHARTS

The Flowchart
 A graphical representation of the sequence of operations
in an information system or program.
 Information system flowcharts show how data flows from
source documents through the computer to final
distribution to users.
 Program flowcharts show the sequence of instructions
in a single program.
 Different symbols are used to draw each type of
flowchart.
The Flowchart
A Flowchart
 shows logic of an algorithm
 emphasizes individual steps and their
interconnections
 e.g. control flow from one action to the next
Flow Charts
A flow chart can be used to:

 Define and analyse processes.


 Build a step-by-step picture of the process
for analysis, discussion, or communication.
 Define, standardise or find areas for
improvement in a process.
Flowchart Symbols
Flow Chart Symbols
Denotes the beginning and end of the program.

OVAL
Flow Chart Symbols
Denotes a process to be carried out.

Processing Function (Rectangle)


Flow Chart Symbols
Denotes an input/output operation.

Parallelogram
Flow Chart Symbols
Denotes the decision or a branch to be made.

Decision Making and Branching


DECISION STRUCTURES

Y N
is
A>B

Print Print
A B
Flow Chart Symbols
Denote the direction of the logic flow in the
program.

Flow lines
Flow Chart Symbols
Display
Information display by printers or plotters.
Flow Chart Symbols

Connector or joining of two parts of program


Example
START

Input
M1,M2,M3,M4

GRADE=(M1+M2+M3+M4)/4

N Y
IS
GRADE>50

PRINT PRINT
“FAIL” “PASS”

STOP
Example 2
 Draw a flowchart to convert the length in
feet to centimeter.
Example 2
START

Input
Lft

Lcm = Lft x 30

Print
Lcm

STOP
Example 3
Draw a flowchart that will read the two sides
of a rectangle and calculate its area.
Example 3
START

Input
W, L

A=LxW

Print
A

STOP
Example 4
 Draw a flowchart that will calculate the roots
of a quadratic equation
ax 2  bx  c  0
 Hint: d = sqrt (b2 – 4ac), and the roots are:
x1 = (–b + d)/2a and x2 = – (b + d)/2a
Example 4
START

Input
a, b, c

d = sqrt(b x b – 4 x a x c)

x1 = (–b + d) / (2 x a)

X2 = – (b + d) / (2 x a)

Print
x1 ,x2

STOP
Relational Operators

Relational Operators
Operator Description
> Greater than
< Less than
= Equal to
 Greater than or equal to
 Less than or equal to
 Not equal to
Example 5
 Write an algorithm that reads two values, determines the
largest value and prints the largest value with an
identifying message.
ALGORITHM
Step 1: Input VALUE1, VALUE2
Step 2: if (VALUE1 > VALUE2) then
MAX  VALUE1
else
MAX  VALUE2
endif
Step 3: Print “The largest value is”, MAX
Example 5
START

Input
VALUE1,VALUE2

Y is N
VALUE1>VALUE2

MAX  VALUE1 MAX  VALUE2

Print
“The largest value is”,
MAX

STOP
Assignment 1
 Draw a flowchart that reads three
numbers and prints the value of the largest
number.
Algorithm
Step 1: Input N1, N2, N3
Step 2: if (N1>N2) then
if (N1>N3) then
MAX  N1 [N1>N2, N1>N3]
else
MAX  N3 [N3>N1>N2]
endif
else
if (N2>N3) then
MAX  N2 [N2>N1, N2>N3]
else
MAX  N3 [N3>N2>N1]
endif
endif
Step 3: Print “The largest number is”, MAX
Example 6
 Flowchart: Draw the flowchart of the
above Algorithm.
Example 7
 Write and algorithm and draw a flowchart
to
a) read an employee name (NAME),
overtime hours worked (OVERTIME),
hours absent (ABSENT) and
b) determine the bonus payment
(PAYMENT).
Example 7
Bonus Schedule
OVERTIME – (2/3)*ABSENT Bonus Paid

>40 hours $50


>30 but  40 hours $40
>20 but  30 hours $30
>10 but  20 hours $20
 10 hours $10
Step 1: Input NAME,OVERTIME,ABSENT
Step 2: if (OVERTIME–(2/3)*ABSENT > 40) then
PAYMENT  50
else if (OVERTIME–(2/3)*ABSENT > 30) then
PAYMENT  40
else if (OVERTIME–(2/3)*ABSENT > 20) then
PAYMENT  30
else if (OVERTIME–(2/3)*ABSENT > 10) then
PAYMENT 20
else
PAYMENT  10
endif
Step 3: Print “Bonus for”, NAME “is $”, PAYMENT
Example 7
 Flowchart: Draw the flowchart of the
above algorithm?

You might also like