Modular flowcharts - PowerPoint PPT Presentation

1 / 19
About This Presentation
Title:

Modular flowcharts

Description:

Terminator. Action box. or module. Selection. Note rounded edges ... Selection (3) 'if condition 1 is true, do Something, or else if condition 2 is true ... – PowerPoint PPT presentation

Number of Views:35
Avg rating:3.0/5.0
Slides: 20
Provided by: computing96
Category:

less

Transcript and Presenter's Notes

Title: Modular flowcharts


1
Modular flow-charts
Applied Computing AC1101
2
Selection
  • Choose to perform an action or not perform it
  • Choose to perform an action or otherwise do
    something else
  • Choose to perform one of a set of possibilities

3
Repetition
  • Do something a fixed number of times
  • Do something until something becomes true
  • While something is true, do something

4
Getting into detail
  • Advantages of structure diagrams
  • Show overall structure of solution
  • Clearly identify individual modules
    (functions?)and relationships between them
  • Limitations
  • Clumsy for showing selection repetition
  • Sometimes easier to understand solution as a flow
    of events and actions than as a structure

5
Modular flowcharts
  • Symbols to show events and actions
  • All symbols connected by lines
  • Lines show allowable actions at any point
  • Modular flowcharts have only one way in and one
    way out
  • Modules have only one entranceand one exit point

6
Flowchart symbols
Note rounded edges
Terminator
Action boxor module
Selection
7
Sequence
Time
No need tosay anything here -Its obviously the
end
8
Selection boxes
Selection box can have two lines coming out, one
for if the condition is true, the other for false
9
Selection (1)
if the condition is true, do Things to do,
otherwise miss it out
10
Selection (2)
if the condition is true, do Things to do, or
else do Other things to do
11
Selection (3)
if condition 1 is true, do Something, or else if
condition 2 is true do Other thing, or else do
Default
12
Repetition (1)
Do these things again and again ...
until this condition has been met
Always does Things to do at least once
13
Repetition (2)
Only does Things to do while the condition is
true ... so may not do Things to do at all
14
Top-down design using flowcharts
  • Modules must have only one entry and one exit
    point
  • So nesting becomes possible
  • Helps to identify functions
  • And so on

15
Nesting of top-down design
Nesting of modules is easybecause of the
ruleone line in, one line out
16
Example 1
17
Example 2
18
Example 3
19
Exam marks example
  • We have the marks from sixty students who have
    sat an exam.
  • We want to know how many students have passed and
    how many have failed
  • The pass mark is 50

20
Example to work out
  • A survey has been carried out to count the number
    of vehicles crossing the Tay Bridge.The number
    of cars crossing during each hour is recorded,
    giving 24 counts per day.
  • Draw a modular flowchart for a program which
    reads the counts for one day and produces an
    output giving the total number of vehicles
    crossing during the day and the maximum number
    crossing in one hour.
  • If time, calculate total income for the day (each
    vehicle pays 80p) and average vehicles per hour
  • Can you identify candidates for separate
    functions?

21
Summary - modular flowcharts
  • Good way to show flow of program,especially
    selection and repetition
  • Because only one entrance and exit allowed, very
    good for representing stepwise refinement
  • Helps to identify functions
  • Good for checking correctness of solutions
Write a Comment
User Comments (0)
About PowerShow.com