1 Introduction to Flowcharting Computer Science Principles 2013-2014 ASFA.

Slides:



Advertisements
Similar presentations
COMPUTER PROGRAMMING I Understand Problem Solving Tools to Design Programming Solutions.
Advertisements

Code Visual to Flowchart Basem AL-yasouri Ayad R Meshalmeha Fadi Alalean Loay abu odah.
Introduction to Flowcharting
Introduction to Flowcharting
Flow Control Analysis & Design Tool: Flowcharts
UNIT 2. Introduction to Computer Programming
Flow Control if, while, do-while Juan Marquez (03_flow_control.ppt)
Introduction to Flowcharting
Introduction to Flowcharting A Supplement to Starting Out with C++, 4th Edition by Tony Gaddis Published by Addison-Wesley.
Computer Programming Rattapoom Waranusast Department of Electrical and Computer Engineering Faculty of Engineering, Naresuan University.
Java Planning our Programs Flowcharts Arithmetic Operators.
Fundamentals of Algorithms MCS - 2 Lecture # 4
Tutorial #7 Flowcharts (reprise) Program Design. Introduction We mentioned it already, that if we thing of an analyst as being analogous to an architect,
Chapter 2- Visual Basic Schneider
Chapter 2: Input, Processing, and Output
Chapter 3 Planning Your Solution
(C)opyright 2003 Scott/Jones Publishers Introduction to Flowcharting A Supplement to Starting Out with C++, 4th Edition by Tony Gaddis Scott/Jones Publishers.
Algorithm & Flowchart.
11 Chapter 4 LOOPS AND FILES. 22 THE INCREMENT AND DECREMENT OPERATORS To increment a variable means to increase its value by one. To decrement a variable.
CSC103: Introduction to Computer and Programming
Lecturer: Omid Jafarinezhad Sharif University of Technology Department of Computer Engineering 1 Fundamental of Programming (C) Lecture 5 Structured Program.
PROGRAMMING, ALGORITHMS AND FLOWCHARTS
Pseudocode Demo for Payroll.c
Design the program Create a detailed description of program –Use charts or ordinary language (pseudocode) Identify algorithms needed –Algorithm: a step-by-step.
Chapter 12: How Long Can This Go On?
1 Introduction to Flowcharting. 2 Writing a program Defining the problem –Write down what the program will do Planning –Write down the steps, draw a flowchart.
1 Introduction to Flowcharting. 2 Writing a program Defining the problem –Write down what the program will do Planning –Write down the steps, draw a flowchart.
Flowcharts! January 13, 2005 These are today’s notes! Do you think we will get more snow?
End Show Writing a computer program involves performing the following tasks. 1. Understanding the problem 2. Developing an Algorithm for the problem 3.
Extended Prelude to Programming Concepts & Design, 3/e by Stewart Venit and Elizabeth Drake Chapter 2: Flowcharts.
Flowcharts.
An Introduction to Programming with C++ Sixth Edition Chapter 7 The Repetition Structure.
Basic Control Structures
1 Program Planning and Design Important stages before actual program is written.
`. Lecture Overview Structure Programming Basic Control of Structure Programming Selection Logical Operations Iteration Flowchart.
Flowcharting An Introduction. Definition A flowchart is a schematic representation of an algorithm or a process.
Pseudocode An Introduction. Flowcharts were the first design tool to be widely used, but unfortunately they do not reflect some of the concepts of structured.
1 Programming Tools Flowcharts Pseudocode Hierarchy Chart Direction of Numbered NYC Streets Algorithm Class Average Algorithm.
(C)opyright 2000 Scott/Jones Publishers Introduction to Flowcharting.
Fundamentals of Algorithms MCS - 2 Lecture # 5. Representation of Algorithms (continued) Flowcharts.
Introduction to Computing Dr. Nadeem A Khan. Lecture 2.
Chapter Topics 2.1 Designing a Program 2.2 Output, Input, and Variables 2.3 Variable Assignment and Calculations 2.4 Variable Declarations and Data Types.
FLOWCHARTING AND ALGORITHMS
Problem Solving Flowcharts. Flowcharts Introduction  Flowcharts allow us to create a visual representation of a solution to a problem DRAW  With flowcharts,
CSE 110: Programming Language I Matin Saad Abdullah UB 404.
Lecture #2: Introduction to Flowcharting مخططات الانسياب Dr. Hmood Al-Dossari King Saud University Department of Computer Science 13 February 2012.
Creating Flowcharts Principles of Engineering
Creating a Flowchart Computer Integrated Manufacturing
ALGORITHMS AND FLOWCHARTS
Creating Flowcharts Name of PowerPoint CIM Name of Lesson
Introduction to Flowcharting
Programming Flowcharts
Introduction to Flowcharting
Flowcharting: Decision Structure
Introduction To Flowcharting
Chapter Topics 2.1 Designing a Program 2.2 Output, Input, and Variables 2.3 Variable Assignment and Calculations 2.4 Variable Declarations and Data Types.
Numbering System TODAY AND TOMORROW 11th Edition
Introduction to Flowcharting
Creating Flowcharts Principles of Engineering
Creating Flowcharts Principles of Engineering
How to develop a program?
Creating Flowcharts Name of PowerPoint CIM Name of Lesson
Faculty of Computer Science & Information System
Creating Flowcharts Name of PowerPoint CIM Name of Lesson
Creating Flowcharts Principles of Engineering
Introduction to Flowcharting
Creating Flowcharts Principles Of Engineering
Creating Flowcharts Name of PowerPoint CIM Name of Lesson
Introduction to Programming
Introduction to Flowcharts
Presentation transcript:

1 Introduction to Flowcharting Computer Science Principles ASFA

2 What is a Flowchart? A flowchart is a diagram that depicts the “flow” of a program. The figure shown here is a flowchart for the pay-calculating program shown in Program 1-1. START Display message “How many hours did you work?” Read Hours Display message “How much do you get paid per hour?” Read PayRate Multiply Hours by PayRate. Store result in GrossPay. Display GrossPay END

3 Basic Flowchart Symbols Terminals –represented by rounded rectangles –indicate a starting or ending point START Display message “How many hours did you work?” Read Hours Display message “How much do you get paid per hour?” Read PayRate Multiply Hours by PayRate. Store result in GrossPay. Display GrossPay END Terminal STARTEND Terminal

4 Basic Flowchart Symbols Input/Output Operations –represented by parallelograms –indicate an input or output operation START Display message “How many hours did you work?” Read Hours Display message “How much do you get paid per hour?” Read PayRate Multiply Hours by PayRate. Store result in GrossPay. Display GrossPay END Display message “How many hours did you work?” Read Hours Input/Output Operation

5 Basic Flowchart Symbols Processes –represented by rectangles –indicates a process such as a mathematical computation or variable assignment START Display message “How many hours did you work?” Read Hours Display message “How much do you get paid per hour?” Read PayRate Multiply Hours by PayRate. Store result in GrossPay. Display GrossPay END Multiply Hours by PayRate. Store result in GrossPay. Process

6 Four Flowchart Structures Sequence Decision Repetition Case

7 Sequence Structure A series of actions are performed in sequence The pay-calculating example was a sequence flowchart.

8 Decision Structure The flowchart segment below shows how a decision structure is expressed in C++ as an if/else statement. YESNO x < y? Calculate a as x times 2. Calculate a as x plus y. if (x < y) a = x * 2; else a = x + y; FlowchartC++ Code

9 Decision Structure The flowchart segment below shows a decision structure with only one action to perform. It is expressed as an if statement in C++ code. if (x < y) a = x * 2; FlowchartC++ Code YESNO x < y? Calculate a as x times 2.

10 Repetition Structure The flowchart segment below shows a repetition structure expressed in C++ as a while loop. while (x < y) x++; FlowchartC++ Code x < y? Add 1 to x YES

11 Controlling a Repetition Structure The action performed by a repetition structure must eventually cause the loop to terminate. Otherwise, an infinite loop is created. In this flowchart segment, x is never changed. Once the loop starts, it will never end. QUESTION: How can this flowchart be modified so it is no longer an infinite loop? x < y? Display x YES

12 Controlling a Repetition Structure ANSWER: By adding an action within the repetition that changes the value of x. x < y? Display x Add 1 to x YES

13 Case Structure CASE years_employed Other bonus = 100 bonus = 200 bonus = 400 bonus = 800 If years_employed = 1, bonus is set to 100 If years_employed = 2, bonus is set to 200 If years_employed = 3, bonus is set to 400 If years_employed is any other value, bonus is set to 800

14 Connectors A A START END The “A” connector indicates that the second flowchart segment begins where the first segment ends.

15 Modules The position of the module symbol indicates the point the module is executed. A separate flowchart can be constructed for the module. START END Read Input. Call calc_pay function. Display results.

16 This flowchart segment shows two decision structures combined. Combining Structures Display “x is within limits.” Display “x is outside the limits.” YESNO x > min? x < max? YES NO Display “x is outside the limits.”

17 Review What do each of the following symbols represent? (Answer on next slide)

18 Answer What do each of the following symbols represent? Terminal Input/Output Operation Process Decision Connector Module

19 Review Name the four flowchart structures. (Answer on next slide)

20 Answer Sequence Decision Repetition Case

21 What type of structure is this? Review (Answer on next slide)

22 Answer Repetition

23 What type of structure is this? Review (Answer on next slide)

24 Answer Sequence

25 What type of structure is this? Review (Answer on next slide)

26 Answer Case

27 What type of structure is this? Review (Answer on next slide)

28 Answer Decision