Introduction to Flowcharting

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 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.
1 Introduction to Flowcharting Computer Science Principles ASFA.
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:

Introduction to Flowcharting Computer Science Principles 2013-2014 ASFA

What is a Flowchart? 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 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.

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

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

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

Four Flowchart Structures Sequence Decision Repetition Case

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

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

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. Flowchart C++ Code YES NO x < y? Calculate a as x times 2. if (x < y) a = x * 2;

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

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

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

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

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

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

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

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

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

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

Answer Sequence Decision Repetition Case

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

Answer Repetition

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

Answer Sequence

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

Answer Case

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

Answer Decision

Examples ???