Designing Software With Flowcharts And Pseudo-code

Slides:



Advertisements
Similar presentations
CS107: Introduction to Computer Science Lecture 2 Jan 29th.
Advertisements

1 ICS102: Introduction To Computing King Fahd University of Petroleum & Minerals College of Computer Science & Engineering Information & Computer Science.
Flow Charts, Loop Structures
Introduction to Flowcharting
Introduction to Flowcharting
Introduction to Flowcharting
Introduction to Flowcharting A Supplement to Starting Out with C++, 4th Edition by Tony Gaddis Published by Addison-Wesley.
Subject: Information Technology Grade: 10
Computer Programming Rattapoom Waranusast Department of Electrical and Computer Engineering Faculty of Engineering, Naresuan University.
 Control structures  Algorithm & flowchart  If statements  While statements.
ITEC113 Algorithms and Programming Techniques
James Tam A High-Level Model For Software Development What is involved in the process of designing, writing and maintaining computer programs?
James Tam Repetition In Pascal In this section of notes you will learn how to rerun parts of your program without having to duplicate the code.
Chapter 2: Algorithm Discovery and Design
Program Design and Development
A High-Level Model For Software Development
Programming Logic and Design, Introductory, Fourth Edition1 Understanding Computer Components and Operations (continued) A program must be free of syntax.
ACSE th Conference The Iconic Programmer Stephen Chen.
Chapter 2: Algorithm Discovery and Design
Chapter 2: Algorithm Discovery and Design
1 Chapter 2 Problem Solving Techniques INTRODUCTION 2.2 PROBLEM SOLVING 2.3 USING COMPUTERS IN PROBLEM SOLVING : THE SOFTWARE DEVELOPMENT METHOD.
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.
Chapter 1 Pseudocode & Flowcharts
ALGORITHMS AND FLOWCHARTS
Adapted from slides by Marie desJardins
CSC103: Introduction to Computer and Programming
COMP An Introduction to Computer Programming : University of the West Indies COMP6015 An Introduction to Computer Programming Lecture 02.
Flow Charting. Goals Create Algorithms using Flow Charting procedures. Distinguish between Flow Charting and Pseudocode. Top-Down Design Bottom-up Design.
Chapter 2: Algorithm Discovery and Design Invitation to Computer Science, C++ Version, Third Edition.
Invitation to Computer Science, Java Version, Second Edition.
Design the program Create a detailed description of program –Use charts or ordinary language (pseudocode) Identify algorithms needed –Algorithm: a step-by-step.
Chapter 2 - Algorithms and Design
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.
S2008Final_part1.ppt CS11 Introduction to Programming Final Exam Part 1 S A computer is a mechanical or electrical device which stores, retrieves,
Extended Prelude to Programming Concepts & Design, 3/e by Stewart Venit and Elizabeth Drake Chapter 2: Flowcharts.
© 2011 Pearson Addison-Wesley. All rights reserved. Addison Wesley is an imprint of Stewart Venit ~ Elizabeth Drake Developing a Program.
An Introduction to Programming with C++ Sixth Edition Chapter 7 The Repetition Structure.
Chapter 2 Pseudocode. Objectives To introduce common words, keywords and meaningful names when writing pseudocode To define the three basic control structures.
Pseudocode Simple Program Design Third Edition A Step-by-Step Approach 2.
Flowcharts and Algorithms. Review of Terms  A computer is a machine that can represent and manipulate data –Ultimately the data and the instructions.
1 Chapter 2 - Algorithms and Design print Statement input Statement and Variables Assignment Statement if Statement Flowcharts Flow of Control Looping.
PROGRAMMING PAPER 2 AS Algorithms.
ITEC113 Algorithms and Programming Techniques
Dale Roberts 1 Program Control - Algorithms Department of Computer and Information Science, School of Science, IUPUI CSCI N305.
Control Structures CPS120: Introduction to Computer Science Lecture 5.
Repetition Control Structures Simple Program Design Third Edition A Step-by-Step Approach 5.
Structured Program Development Angela Chih-Wei Tang ( 唐 之 瑋 ) Department of Communication Engineering National Central University JhongLi, Taiwan 2010.
Chapter 1 Pseudocode & Flowcharts
PROGRAM DEVELOPMENT CYCLE. Problem Statement: Problem Statement help diagnose the situation so that your focus is on the problem, helpful tools at this.
CSCI-100 Introduction to Computing
`. Lecture Overview Structure Programming Basic Control of Structure Programming Selection Logical Operations Iteration Flowchart.
(C)opyright 2000 Scott/Jones Publishers Introduction to Flowcharting.
Algorithm Discovery and Design Objectives: Interpret pseudocode Write pseudocode, using the three types of operations: * sequential (steps in order written)
Topic: Control Statements. Recap of Sequence Control Structure Write a program that accepts the basic salary and allowance amount for an employee and.
Topics: Selection Statements. Processing Involving Selecting Instructions An instruction that allows deviation and selection to take place uses the ‘IF’
1 Introduction to Flowcharting Computer Science Principles ASFA.
STEP 3- DEVELOP AN ALGORITHM At this stage we break down the problem into simple manageable steps so that they can be handled easily.
Chapter 2: Algorithm Discovery and Design Invitation to Computer Science.
Flow Charts And Pseudo Codes Grade 12. An algorithm is a complete step-by- step procedure for solving a problem or accomplishing a task.
ALGORITHMS AND FLOWCHARTS
3.1 Fundamentals of algorithms
Algorithms and Flowcharts
Chapter 5: Control Structure
Introduction To Flowcharting
Unit# 9: Computer Program Development
MSIS 655 Advanced Business Applications Programming
Introduction to Algorithms and Programming
` Structured Programming & Flowchart
Presentation transcript:

Designing Software With Flowcharts And Pseudo-code In this section you will learn two different ways of laying out a computer algorithm independent of programming language

A Model For Creating Computer Software Specify the problem Develop a design (algorithm) Implement the design Maintain the design

What Is An Algorithm? The steps needed to solve a problem Characteristics Specific Unambiguous Language independent

Developing An Algorithm: Top-Down Approach General approach Abstract Approach to part of problem Approach to part of problem Approach to part of problem The algorithm Specific steps Specific steps Specific steps Specific steps Particular Bottom Figure extracted from Computer Science Illuminated by Dale N. and Lewis J.

Techniques For Laying Out An Algorithm Pseudo-code Flowcharts

Pseudo-Code Employs 'programming-like' statements to depict the algorithm No standard format (language independent)

Pseudo-Code Statements Output Input Process Decision Repetition Statements are carried out in order Example: calling up a friend Look up telephone number Enter telephone number Wait for someone to answer : :

Variables Are symbols used to store values The value stored can change during the algorithm

Pseudo-Code: Output Used to display information General format: Line of text: Output 'Message' Variable: Output Name of variable Example Output 'Available credit limit: ' limit

Pseudo-Code: Input Used to get information Information is stored in a variable General format: Input: Name of variable Example: Input user_name

Pseudo-Code: Process For computer programs it's usually an assignment statement (sets a variable to some value) General form: variable arithmetic expression Example: x  2 x  x + 1 a  b * c

Pseudo-Code: Decision Making If-then General form: if (condition is met) then statement(s) Example: if temperature < 0 then wear a jacket If-then-else else statements(s)

Pseudo-Code: Decision Making (2) Example: if (at work) then Dress formally else Dress casually

Pseudo-Code: Repetition repeat-until while-do

Pseudo-Code: Repetition (2) repeat-until Repeat at least once (check condition after statement(s)) General form: repeat statement(s) until (condition is met) Example: Go up to buffet table until full

Pseudo-Code: Repetition (3) while-do Repeat zero or more times (check condition before statement(s)) General form: while (condition is met) statement(s) Example: while students ask questions Answer questions

Pseudo-Code: Fast Food Example Use pseudo-code to specify the algorithm for a person who ordering food at a fast food restaurant. At the food counter, the person can either order not order the following items: a burger, fries and a drink. After placing her order the person then goes to the cashier.

Pseudo-Code: Fast Food Example Approach counter if want burger then order burger if want fries then order fries if want drink then order drink Pay cashier

Pseudo-Code: Fast Food Example (Computer) Approach counter Output 'Order burger?' Input order_burger if order_burger = yes then order_burger Output 'Order fries?' Input order_fries if order_fries = yes then order fries

Pseudo-Code: Fast Food Example (Computer 2) Output 'Order drink?' Input order_drink If order_drink = yes then order drink Pay cashier

Pseudo-Code: ATM Example Use pseudo-code to specify the algorithm for an ATM bank machine. The bank machine has four options: 1) Show current balance 2) Deposit money 3) Withdraw money 4) Quit. After an option has been selected, the ATM will continue displaying the four options to the person until he selects the option to quit the ATM.

Pseudo-Code: ATM Example Approach ATM Repeat Output 'Select option' Output '1) Make withdrawal' Output '2) Make deposit' Output '3) Show balance' Output '4) Quit' Input option

Pseudo-Code: ATM Example (2) If option = deposit then Output 'Enter amount to deposit' Input amount balance  balance + amount If option = withdrawal then Output 'Enter amount to withdraw' balance  balance – amount Output 'Balance is ' balance Until option = quit Stop Can you spot the limitations of this algorithm?

Summary Of Pseudo-Code Statements Statement Purpose Output Display information Input Get information Process Perform an atomic (non-divisible) activity Decision Choose between different alternatives Repetition Perform a step multiple times

Basic Flowcharts Element Process Terminator Input Output Off page Connector Decision Terminator – start or end of algorithm Process – an atomic activity Input – get information Output –display information Decision – choose between alternatives Off page connector – use to connect the different parts of a flowchart if it spans multiple pages Arrow – indicates the order of the steps in an algorithm Variables – used to store information c Arrow Variables

Flowchart: Fast Food Example Draw a flowchart to outline the algorithm for a person who ordering food at a fast food restaurant. At the food counter, the person can either order not order the following items: a burger, fries and a drink. After placing her order the person then goes to the cashier.

Flowchart: Fast Food Example Approach counter Want burger? Order burger Y N Want fries? Order fries Y N Want Drink? Order drink Y N Pay cashier

Flowchart: Fast Food Example (Computer) Approach console 'Order Burger?' Order_ burger Order_ burger = 'yes' Order burger Y N 2

Flowchart: Fast Food Example (Computer 2) 'Order Fries?' Order_ fries Order_ _fries= 'yes' Order fries Y N 3

Flowchart: Fast Food Example (Computer 3) 'Order drink?' Order_ drink Order_ _drink= 'yes' Order drink Y N Pay cashier

Flowchart: ATM Example Draw a flowchart to outline the algorithm for an ATM bank machine. The bank machine has four options: 1) Show current balance 2) Deposit money 3) Withdraw money 4) Quit. After an option has been selected, the ATM will continue displaying the four options to the person until he selects the option to quit the ATM.

Flowchart: ATM Example Approach ATM 5 'Select option' '1) Make deposit' '2) Make withdrawal' '3) Show balance' '4) Quit' option Option = quit Y Stop N 2

Flowchart: ATM Example (2) Option = deposit Y 'Enter amount to deposit' amount balance balance + amount N 4 3

Flowchart: ATM Example (3) Option = withdrawal Y 'Enter amount to withdraw' amount balancebalance - amount N 4

Flowchart: ATM Example (4) 'Balance is' balance 5 Can you spot the limitations of this algorithm?

Summary Laying out an algorithm using flowcharts and pseudo-code Learning basic elements of algorithms: Input Output Decision-Making Repetition Processes