Presentation is loading. Please wait.

Presentation is loading. Please wait.

Flow Control Analysis & Design Tool: Flowcharts

Similar presentations


Presentation on theme: "Flow Control Analysis & Design Tool: Flowcharts"— Presentation transcript:

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 Total = Cost + Tax Num = Num + 1 (add one to the current value of Num and make that the new value of Num) Num = Num + 1

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 > 50000 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 start square = num x num input num print square A start symbol denotes the start of the algorithm stop An end symbol indicates the algorithm has terminated

6 Sequential Algorithm Flowchart
Allow1 = Age1 x Rate input Age1 start Print Allow1 stop prompt Age1 Allow2 = Age2 x Rate Print Allow2 input Age2 prompt Age2 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

7 Selection Algorithm Flowchart
Allow = Age x YoungRate start Print Allow stop prompt Age Allow = Age x OlderRate Age < 10 FALSE TRUE input Age 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

8 Looping Algorithm Flowchart
start Display Total stop Read Age Calc Allowance KidsPaid < 3 FALSE TRUE KidsPaid = 0 Total = 0 Add Allowance to Total Increment KidsPaid Prompt Age 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


Download ppt "Flow Control Analysis & Design Tool: Flowcharts"

Similar presentations


Ads by Google