
Understanding Flowcharting: Symbols and Structures
Learn about the symbols and structures used in flowcharting, including decision structures, sequence structures, and case structures. Explore how to represent different actions and conditions in flowcharts with the help of visual examples.
Uploaded on | 0 Views
Download Presentation

Please find below an Image/Link to download the presentation.
The content on the website is provided AS IS for your information and personal use only. It may not be sold, licensed, or shared on other websites without obtaining consent from the author. If you encounter any issues during the download, it is possible that the publisher has removed the file from their server.
You are allowed to download the files provided on this website for personal or commercial use, subject to the condition that they are used lawfully. All files are the property of their respective owners.
The content on the website is provided AS IS for your information and personal use only. It may not be sold, licensed, or shared on other websites without obtaining consent from the author.
E N D
Presentation Transcript
Flowcharting: Decision Structure 1
Review What do each of the following symbols represent? A Terminal Connector Input/Output Operation Process 2
Review Name the four flowchart structures. Sequence Decision (Today) Case (Today) Repetition 3
Review: Sequence Structure A series of actions are performed in sequence The pay-calculating example was a sequence flowchart. 4
Decision Structure One of two possible actions is taken, depending on a condition. 5
Decision Structure (if-else) A new symbol, the diamond, indicates a yes/no question. If the answer to the question is yes, the flow follows one path. If the answer is no, the flow follows another path NO YES 6
Decision Structure (if-else) In the flowchart segment below, the question is x > y? is asked. If the answer is no, then process A is performed. If the answer is yes, then process B is performed. NO YES is x > y? Process A Process B 7
Decision Structure(if-else) The flowchart segment below shows how a decision structure is expressed. What would this look like in code? Flowchart if (x>y) { } else { } NO YES is difference = x y; x > y? Calculate difference as x - y Calculate difference as y - x difference = y - x; 8
Decision Structure (if) The flowchart segment below shows a decision structure with only one action to perform. It is expressed with only one process. Flowchart YES x > y? NO Calculate difference as x - y 9
Case Structure (if-else if) One of several possible actions is taken, depending on the contents of a variable. 10
Case Structure (if-else if) The structure below indicates actions to perform depending on the value in yearsEmployed. If yearsEmployed == 1 bonus is set to 200 If yearsEmployed == 2, bonus is set to 400 If yearsEmployed is any other value, bonus is set to 800 If yearsEmployed == 0, bonus is set to 0 CASE yearsEmployed 0 2 Other 1 SET bonus = 0 SET bonus = 400 SET bonus = 800 SET bonus = 200 11
Module - Subprograms A program module (such as a procedure or function) is represented by a special symbol. 12
Modules START The position of the module symbol indicates the point the module is executed. Read Input. A separate flowchart MUST be constructed for the module. Call CalcPay With Input, store result in totalPay The module flowchart will have the subprogram name in the START terminal instead of START Display Total Pay: + totalPay END 13
Review What do each of the following symbols represent? Decision Terminal Input/Output Operation Connector Module Process 14