Flowchart What is a flowchart? A flowchart is a schematic representation of an algorithm or a process or a program. Why should a flowchart be produce before.

Slides:



Advertisements
Similar presentations
Working With Algorithm and Flowcharts
Advertisements

CS 240 Computer Programming 1
A Level Computing#BristolMet Session Objectives#U2 S2 MUST describe the steps of an algorithm using a program flowchart SHOULD explain the data types and.
Flow Control Analysis & Design Tool: Flowcharts
Creating Flowcharts Principles Of Engineering
Algorithms and Problem Solving
Introduction to Flowcharting A Supplement to Starting Out with C++, 4th Edition by Tony Gaddis Published by Addison-Wesley.
Subject: Information Technology Grade: 10
Unit 7.6 Lesson 2 Goals Identify and use flowchart symbols. Plan a sequence of events and incorporate them into a flowchart. Create a simple flowchart.
CS0004: Introduction to Programming Repetition – Do Loops.
LECTURE 1 CMSC 201. Overview Goal: Problem solving and algorithm development. Learn to program in Python. Algorithm - a set of unambiguous and ordered.
 Control structures  Algorithm & flowchart  If statements  While statements.
ITEC113 Algorithms and Programming Techniques
Precedence Parentheses Arithemetic ^ * / + - (exception logical not ~ ) Relational > =
Flowcharts Remember that a solution to a problem is called an algorithm. Algorithms are often a series of steps required to solve the problem. A flowchart.
1 KU College of Engineering Elec 204: Digital Systems Design Lecture 20 Datapath and Control Datapath - performs data transfer and processing operations.
Chapter 3 Planning Your Solution
The Program Design Phases
Algorithm & Flowchart.
ALGORITHMS AND FLOWCHARTS
CSC103: Introduction to Computer and Programming
DCT 1123 Problem Solving & Algorithms
PROGRAMMING, ALGORITHMS AND FLOWCHARTS
How Computers Work Dr. John P. Abraham Professor UTPA.
Flow Charting. Goals Create Algorithms using Flow Charting procedures. Distinguish between Flow Charting and Pseudocode. Top-Down Design Bottom-up Design.
Chapter 2 - Algorithms and Design
08/10/ Iteration Loops For … To … Next. 208/10/2015 Learning Objectives Define a program loop. State when a loop will end. State when the For.
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.
End Show Writing a computer program involves performing the following tasks. 1. Understanding the problem 2. Developing an Algorithm for the problem 3.
Flowcharts.
Property of Jack Wilson, Cerritos College1 CIS Computer Programming Logic Programming Concepts Overview prepared by Jack Wilson Cerritos College.
Control Structures (A) Topics to cover here: Introduction to Control Structures in the algorithmic language Sequencing.
An Introduction to Programming with C++ Sixth Edition Chapter 7 The Repetition Structure.
Visual Basic Programming
PROBLEM SOLVING WITH LOOPS Chapter 7. Concept of Repetition Structure Logic It is a computer task, that is used for Repeating a series of instructions.
ITEC113 Algorithms and Programming Techniques
Basic Control Structures
Advanced Program Design. Review  Step 1: Problem analysis and specification –Specification description of the problem’s inputs and output –Analysis generalize.
1 Program Planning and Design Important stages before actual program is written.
Flowcharting An Introduction. Definition A flowchart is a schematic representation of an algorithm or a process.
Introduction to Loops For Loops. Motivation for Using Loops So far, everything we’ve done in MATLAB, you could probably do by hand: Mathematical operations.
Programming at a high level. Developing a Computer Program Programmer  Writes program in source code (VB or other language) Compiler  Converts source.
1 Programming Tools Flowcharts Pseudocode Hierarchy Chart Direction of Numbered NYC Streets Algorithm Class Average Algorithm.
24 Background Building 25 Computing Terminology, and Speed/Velocity Module 4 Notes: Sensing, Or Operator, Conditional Logic 28 Module 4 Algorithms,
Chapter 7 Problem Solving with Loops
Topic: Control Statements. Recap of Sequence Control Structure Write a program that accepts the basic salary and allowance amount for an employee and.
COMP Loop Statements Yi Hong May 21, 2015.
Algorithms and Pseudocode
W e A re L earning T o  Understand the term control and program  To understand the basic symbols used in Flowol.
Unit 7.6 – Control & Monitoring Overview Key Stage 3 National Strategy ICT Strand.
Program Design & Development EE 201 C7-1 Spring
Control Technology START What is control technology? What is this diagram called? In which program have you used these before? Lets Go!
Algorithms and Flowcharts
Creating a Flowchart Computer Integrated Manufacturing
Creating Flowcharts Name of PowerPoint CIM Name of Lesson
CS1001 Programming Fundamentals 3(3-0) Lecture 2
Introduction To Flowcharting
Creating Flowcharts AIM:
ALGORITHMS AND FLOWCHARTS
Creating Flowcharts Name of PowerPoint CIM Name of Lesson
ALGORITHMS AND FLOWCHARTS
Digital and Analogue Sensing
Faculty of Computer Science & Information System
KU College of Engineering Elec 204: Digital Systems Design
Flowcharts and Pseudo Code
Creating Flowcharts Name of PowerPoint CIM Name of Lesson
Digital and Analogue Sensing
Basic Concepts of Algorithm
Flowcharts Activity One
Creating Flowcharts Name of PowerPoint CIM Name of Lesson
Presentation transcript:

Flowchart What is a flowchart? A flowchart is a schematic representation of an algorithm or a process or a program. Why should a flowchart be produce before a computer program? Planning ahead Team work To learn the correct order of instructions in a computer program How to design a flowchart for boiling a kettle? Use common sense: What is the correct order of the following instructions? switch on power switch off power turn on water valve turn off water valve Use previous experiences: Is the kettle full? (How can a PC ‘see’, ‘wait’ and ‘judge’?) Is water boiled?

Flowchart start input sequential decisio n output false true end Flowchart Symbols: input: CPU takes data from outside output: CPU sends data to outside sequential: computing within CPU/memory decision: conditional instructions Rules: Those flowchart symbols should be used in the coursework of this module. start has one output, no input input, sequential and output have one input and one output decision has one input and more than one output. end box has one input, no output. There must be one start and one end in the flowchart. All flow paths should end at the end box.

Lighthouse You need to set up the lighthouse system to respond to the light levels. When the Sun (Input 1) is shining, you do not want the lighthouse (Output 1) to flash. When it is dark, you do. The lighthouse flashes on and off for 1 second when it is dark. (Picture from Flowol2) How can a PC ‘see’, ‘wait’ and ‘judge’? False Input 1 on ? True Flash output 1 Exercise 1: Write a flowchart for controlling “output 1” in the lighthouse

Write a flowchart for a program, which converts an angle in degrees to radians. start Input deg Calculate rad Output rad end deg and rad are two variables, which are the names given to two memory locations for storing data.

Write a flowchart for a program, which converts positive angles in degrees to radians; the program works in a loop and it stops when an angle entered is negative. start Input deg Calculate rad Output rad end deg<0 ? True False

Write a flowchart for a program, which converts angles in degrees to radians; the program works in a loop until 10 angles have been converted. start Input deg Calculate rad Output rad end N=1 N>10 N=N+1 T F programming rules:  ‘=’ means ‘becomes’  variable at right side of ‘=’ has the data before the instruction  variable at left side of ‘=’ has the data after the instruction  arithmetic calculation variable = formula  variables in formula must have values

Factorial Write a flowchart for a program which calculates the factorial (n!) of n. n is an integer number entered from the keyboard. The result, factorial of n is displaced on the PC monitor. n! = n*(n-1)*(n-2)*…….*1 start declare n, res initialize res=1 input n n ≥ 1 ? res = res*n n = n -1 output res end no yes Q: Why res is initialized with 1? Ans: All variables on the right side of ‘=’ must have values. Initial value of res has to be 1, otherwise the program won’t give correct answer. Two variables are needed in the program: n: n res: n! variables are declared (optional) Learning points: 1. counting down 2. multiplication of a sequence of numbers

Supermarket Checkout Write a flowchart to design a program for supermarket checkout. The program should have following functions: The price of each item is typed in on the keyboard. After a price is entered, the number of items and the subtotal price so far are displayed. Enter zero or a negative number on the keyboard to indicate that all items have been checked out. Variables needed in the program: x: price of a single item n: number of items sum:total price Two variables must be initialized Learning points: 1. counting 2. adding 3. breaking the program loop start declare x, n, sum initialize sum=0, n=0 input x x ≥ 0 ? sum = sum+x n = n +1 output n, sum end false true output n, sum

Exercise 2: Write a flowchart for a program which reads 20 real numbers from keyboard and calculate the mean of those 20 numbers.