1 / 8

Flow Control Analysis & Design Tool: Flowcharts

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

lowell
Download Presentation

Flow Control Analysis & Design Tool: Flowcharts

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

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. Total = Cost + Tax Num = Num + 1 Flowcharts Symbols: Calculations • Calculations (e.g. arithmetic expressions) are shown in rectangles • Examples: • Total = Cost + Tax • Num = Num + 1 (add one to the current value of Num and make that the new value of Num)

  3. READ Num WRITE Num 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) • Output means a write operation of data to a peripheral device from memory (e.g. data displayed to the monitor)

  4. False Gross > 50000 Rate = 0.28 True Rate = 0.31 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 • 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. start input num square = num x num print square stop 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 • A start symbol denotes the start of the algorithm • An end symbol indicates the algorithm has terminated

  6. start prompt Age1 input Age1 prompt Age2 input Age2 Allow1 = Age1 x Rate Allow2 = Age2 x Rate Print Allow1 Print Allow2 stop Sequential AlgorithmFlowchart • 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. start prompt Age input Age TRUE FALSE Age < 10 Allow = Age x OlderRate Allow = Age x YoungRate Print Allow stop Selection AlgorithmFlowchart • 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. start KidsPaid = 0 Total = 0 KidsPaid < 3 TRUE FALSE Prompt Age Read Age Display Total Calc Allowance stop Add Allowance to Total Increment KidsPaid Looping AlgorithmFlowchart • 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

More Related