G6 Computers Ch5 Flowcharts
G6 Computers Ch5 Flowcharts
Overview:
Ove reiterates the concept of breaking aprocess into smaller processes
graphical form. This
and represerting the
steps in a unit builds on theidea of problern
decornposition and solution
conditionaland loop programming constructs. using
students learn to break
Through this
unit, down instructions such
that they can be easily translated
to program
syntax.
Essential Questions:
Why areflowchartsused in planning a process?
• What are the limitations of a flowchart?
Enduring understanding
Studentswill understand that:
Flowchartsare graphic organizers that us sort and sequences of teps
let arrange to be
carried out in completing a process.
A flowchart does not convey why a specific operation ís done, only how a processís done.
• It is easy to skip important details while creating a flowchart since it involves too rmary
symbols.
Content:
• Definition of Flowchart
• Flowchartsymbols and descriptions of these symbols
Designing Flowchartswith decision constructs
Definition of counters and accumulators
Difference between entry controlled loop and exit controlled loop
Essential Vocabulary:
Sequence, Process, Input/Output,Start/Stop, Decision, Counter, Accumulator, Etry
Flowchart,
Controlled loop,Exit controlled loop, Flowlines, Connectors
51
EXYA
SCHOOLs
CMR gobryond
information.
Loop
Hexagon indicates the
beginning of repetition of
structure.
52
EKYA
SCHOOLs
CMR
Advantages of Flowchart:
1.
Communication: Flowchartsare
better way of
concerned or involved. communicatingthe logic of a
system tO all
2. Proper Debugging:
The flowchart helps in debugging (identify and
program) process. remove errors from computer
3. Efficient Program
Maintenance: The maintenance of
operating programs
help of flowchart. becomes easy with the
Disadvantages of Flowchart:
Various Programming Constructs: We can have three types of programming constructs which
we willbe learning through flowcharts.
|. Sequence construct: In the sequence construct the program flow simply moves from one
statement to another.
Here are some real world Sequence constructs:
1. Process of making fruit juice.
2. Additionof two numbers.
Example
Draw a Flowchart that takes two numbers from the user, Start
Enter 2 numbers:
15and 27
Sum= 15+27
Display sum
Stop
53
EKYA
SCHOOLS
CMR
Enter 2 numbers A
and B
Now Aand B_are now like boxes. At the time of calculation, A will have a number in it and B wll
have anothernumber in it. And sum is again like a box where the result of A+B will be kept safe.
15 27 42
B Sum
some other instruction, depending upon the condition met. Here are some real world Selection
constructs:
1. You aregoing for an outing. Draw a 2. Your father has given you some
flowchart to decide whether you money. Draw a flowchart to decide
should carry an "Umbrella"or "Not". whether to buy an ice cream or pizza
from it. If the money given is more
than 50, buy pizza, otherwise buy an
START
ce cream.
Ask "Is
It
raining today?
Start
No Is it Yes
Rainíng? Accept "toney trom father"
Leave Take an
umbrella at umbrella. YES
home IS Money
Buy Pizza
NO
STOP
By lce Cream
54
EKYA
SCHOOS
CMR go beyond
Start
Termal Bax
Pocessng Bex
Example
Accept three numbers and find the average. If the
Now I understand about
averageis greater than 80,print "Good",
fiowchart boxes.
otherwise print "Work Hard".
55
EKYA
SCHOOLs
CMR
Understanding Counters
You can say that a counter was set to0 in the beginning of each round and when one round gets
completed, it is incremented by 1.
If the counter
is denoted by the variable CT,
its value is incremented
by the process CT=CT+1,
where CT on the left side of the"="sign
stores the latest value that is being
calculated on the right
side, by adding 1 to the old values of CT
after each round.
<final value of CT> = <old value of
CT> +1
Round
Counter
In the beginning 0
After first round 1
56
EKYA
SCHOOLS
Number fTimes
of
Value of counter CT (CT CT+1)
Before starting the process
After round 1
CT =0+1=1
After round 2 CT =1+ 1 =2
After round 3 CT=2+1=3
After round 4 CT =3+1=4
The counter is a variable which is used to keep track of the number of repetition in a loop.
Example Example
To read five stories from a book. To print your name five times.
Start
Start
CT=0
CT=0
Accept Name
Start Reading the Story
Print Narne
CT= CT+1
CT= T+1
Open the next Story
Is CT<5 Yes
Is CT<5
Yes
No
No
Stop
Stop
57
EKYA
SCHOOLS
CMR
Understanding an Accumulator
If there is some problem like youhave to find thesum of ten numbers entered, you can assiana
variable for this purpose which will store the sum of numbers entered. With each new numb
entered, its value will increase by the value of the new number entered.
An Accumulator is a variable used for the purpose of calculating the sum of numbers entered in a
loop.
Example
A flowchart to accept 5numbers and find their sum.
Start
Here CT Ís he
cCOunterand SM is the
CT=0, S=0 accumulator.
INPUT N
SM=SM+N
CT-CT+1
owowww
PRINT SM
Stop
Quick Recap
58