Download presentation

Presentation is loading. Please wait.

Published byReginald Stanley Modified about 1 year ago

1
Flow Control Analysis & Design Tool: Flowcharts Flowchart - a graphical way of writing algorithms –Rectangle is used for calculations –Parallelogram is used for input and output –Circle is used as connector –Diamond is used as decision –Symbols are connected by arrows to represent the order of the operations

2
Flowcharts Symbols: Calculations Calculations (e.g. arithmetic expressions) are shown in rectangles Examples: Total = Cost + Tax Num = Num + 1Total = Cost + Tax Num = Num + 1 (add one to the current value of Num and make that the new value of Num)

3
Flowcharts Symbols: Input/Output Data input and output are shown in parallelograms Input means a read operation of data from a peripheral device to memory (e.g. a user typing in data at a keyboard) READ Num WRITE Num Output means a write operation of data to a peripheral device from memory (e.g. data displayed to the monitor)

4
Flowcharts Symbols: Decisions Decisions are shown within diamonds and specify a condition to be tested Based on the condition being TRUE or FALSE, the next operation will be determined Gross > Rate = 0.31 Rate = 0.28 True False A decision is composed of : A condition An operation to be done if condition is TRUE Possibly an operation to be done if condition is FALSE

5
Flowcharts Symbols: Start and End Every algorithm starts somewhere and terminates somewhere Every flowchart must have one start symbol and one end symbol Start and end symbols are ovals square = num x num input num print square start stop A start symbol denotes the start of the algorithm An end symbol indicates the algorithm has terminated

6
Sequential Algorithm Flowchart Pseudocode Algorithm: –PROMPT for Age of Child1 –READ Age of Child1 –PROMPT for Age of Child2 –READ Age of Child2 –CALCULATE Allowance for Child1 = Age of Child1 x Rate –CALCULATE Allowance for Child2 = Age of Child2 x Rate –DISPLAY Allowance for Child1 –DISPLAY Allowance for Child2 Allow1 = Age1 x Rate input Age1 start Print Allow1 stop prompt Age1 Allow2 = Age2 x Rate Print Allow2 input Age2 prompt Age2

7
Selection Algorithm Flowchart Previous Pseudocode Algorithm: –PROMPT for Age –READ Age –IF Age less than 10 THEN CALCULATE Allowance = Age x YoungRate ELSE CALCULATE Allowance = Age x OlderRate –DISPLAY Allowance Allow = Age x YoungRate start Print Allow stop prompt Age Allow = Age x OlderRate Age < 10 FALSETRUE input Age

8
Looping Algorithm Flowchart Previous Pseudocode Algorithm: –Set KidsPaid to 0 –Set Total to 0 –WHILE KidsPaid < 3 DO PROMPT for Age READ Age CALCULATE Allowance = Age x Rate ADD Allowance to Total INCREMENT KidsPaid –DISPLAY Total start Display Total stop Read Age Calc Allowance KidsPaid < 3 FALSETRUE KidsPaid = 0 Total = 0 Add Allowance to Total Increment KidsPaid Prompt Age

Similar presentations

© 2016 SlidePlayer.com Inc.

All rights reserved.

Ads by Google