1 CSI 101 Elements of Computing Fall 2009 Lecture #4 Using Flowcharts Monday February 2nd, 2009.

Slides:



Advertisements
Similar presentations
GCSE Computing Lesson 5.
Advertisements

How Are Algorithms Developed?
Programming Logic and Design Eighth Edition
Introduction to Flowcharting
Introduction to Flowcharting
CHAPTER 1: AN OVERVIEW OF COMPUTERS AND LOGIC. Objectives 2  Understand computer components and operations  Describe the steps involved in the programming.
Introduction to Flowcharting A Supplement to Starting Out with C++, 4th Edition by Tony Gaddis Published by Addison-Wesley.
Using Flowcharts. Sample Flowchart (without text) 2.
Computer Programming Rattapoom Waranusast Department of Electrical and Computer Engineering Faculty of Engineering, Naresuan University.
CS0004: Introduction to Programming Repetition – Do Loops.
The Little man computer
Lecture 2 Introduction to C Programming
Introduction to C Programming
ITEC113 Algorithms and Programming Techniques
 2007 Pearson Education, Inc. All rights reserved Introduction to C Programming.
Programming Logic and Design, Introductory, Fourth Edition1 Understanding Computer Components and Operations (continued) A program must be free of syntax.
COBOL for the 21 st Century Stern, Stern, Ley Chapter 1 INTRODUCTION TO STRUCTURED PROGRAM DESIGN IN COBOL.
Chapter 1 Program Design
Introduction to C Programming
CSI 101 Elements of Computing Spring 2009 Lecture #5 Designing with Pseudocode Wednesday, February 4th, 2009.
Chapter 3 Planning Your Solution
The Program Design Phases
(C)opyright 2003 Scott/Jones Publishers Introduction to Flowcharting A Supplement to Starting Out with C++, 4th Edition by Tony Gaddis Scott/Jones Publishers.
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.
Web-based Document Management System By Group 3 Xinyi Dong Matthew Downs Joshua Ferguson Sriram Gopinath Sayan Kole.
CSC103: Introduction to Computer and Programming
Structured COBOL Programming, Stern & Stern, 9th edition
1 Chapter 2 Revision: Documentation DFD System FC.
Chapter 2 - Algorithms and Design
PROGRAMMING LANGUAGES Prof. Lani Cantonjos. PROGRAM - set of step-by-step instructions that tells or directs the computer what to do. PROGRAMMING LANGUAGE.
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.
Programming Logic and Design Sixth Edition Chapter 5 Looping.
Flowcharts.
6 Chapter 61 Looping Programming Logic and Design, Second Edition, Comprehensive 6.
Python Repetition. We use repetition to prevent typing the same code out many times and to make our code more efficient. FOR is used when you know how.
Introduction to Programming with RAPTOR
Visual Basic Programming
ALGORITHM List of instructions for carrying out some process step by step. A sequence of instructions which has a clear meaning and can performed with.
Developing Computer Games Testing & Documentation.
1 Chapter 2 - Algorithms and Design print Statement input Statement and Variables Assignment Statement if Statement Flowcharts Flow of Control Looping.
CS161 Topic #16 1 Today in CS161 Lecture #16 Prepare for the Final Reviewing all Topics this term Variables If Statements Loops (do while, while, for)
G045 Lecture 08 DFD Level 1 Diagrams (Data Flow Diagrams Level 1)
PROGRAM DEVELOPMENT CYCLE. Problem Statement: Problem Statement help diagnose the situation so that your focus is on the problem, helpful tools at this.
`. Lecture Overview Structure Programming Basic Control of Structure Programming Selection Logical Operations Iteration Flowchart.
Verification & Validation. Batch processing In a batch processing system, documents such as sales orders are collected into batches of typically 50 documents.
(C)opyright 2000 Scott/Jones Publishers Introduction to Flowcharting.
Use Flowchart modeling to design and create an interactive quiz to be run on Powerpoint. Start Question Click to start the quiz Correct Incorrect, try.
Sequencing The most simple type of program uses sequencing, a set of instructions carried out one after another. Start End Display “Computer” Display “Science”
Intermediate 2 Computing Unit 2 - Software Development.
CSC 1010 Programming for All Lecture 4 Loops Some material based on material from Marty Stepp, Instructor, University of Washington.
Introduction to Operating Systems Prepared by: Dhason Operating Systems.
Copyright 2006 Addison-Wesley Brief Version of Starting Out with C++ Chapter 5 Looping.
ICS124 Session 9 Flowcharting 1. By the end of this section the student will be able to:  Name the three structures of the Structure Theorem  Identify.
Program Design. Simple Program Design, Fourth Edition Chapter 1 2 Objectives In this chapter you will be able to: Describe the steps in the program development.
CMSC 104, Section 301, Fall Lecture 18, 11/11/02 Functions, Part 1 of 3 Topics Using Predefined Functions Programmer-Defined Functions Using Input.
Page ADP PearsonAccess Proctor Training. Page Agenda Test Overview Testing Components Proctor Roles and Responsibilities Overview Administering the Test.
Algorithms and Flowcharts
1 Lecture 2 - Introduction to C Programming Outline 2.1Introduction 2.2A Simple C Program: Printing a Line of Text 2.3Another Simple C Program: Adding.
The Little man computer
Chapter 5: Control Structure
Algorithms An algorithm is a sequence of steps written in the form of English phrases that specific the tasks that are performed while solving the problem.It.
Introduction To Flowcharting
Print slides for students reference
Unit# 9: Computer Program Development
` Structured Programming & Flowchart
Faculty of Computer Science & Information System
CSC115 Introduction to Computer Programming
Flowcharts and Pseudo Code
Developing a Program.
Presentation transcript:

1 CSI 101 Elements of Computing Fall 2009 Lecture #4 Using Flowcharts Monday February 2nd, 2009

2 Let's Talk about Designing ● Why Design? ● Proper Preparation Prevents Poor Performance ● Determine flow and function ● What happens when ● Think through before coding ● Prevents trial and error ● Prevents massive corrections ● Determine most efficient way ● Fewer places to insert errors ● Faster processing

3 Advantages to Designing ● Ensure completeness ● By working through design, can see if you have covered everything requested ● Can see where requirements are vague or lacking ● Provide focus ● Important for large projects with multiple people ● Identify key flow points and transitions ● Can plan adequate and complete test plans

4 Design for Testing? ● To completely test, must be able to completely know flow ● Large projects have multiple tests ● And therefore multiple testers ● Rarely is developer the same person who tests ● Checkpoints ● Key spots in program where status of data is known ● Variation ● Condition or branch that causes different results

5 Examples of Variations ● Conditions ● Something greater or less than ● Need to test how many states? ● 3 – Greater, lesser, or equal ● Flows ● Looping until a particular event or successful test ● How many variations? ● 3 – starting, continuing, and stopping ● Transitions ● Calling a function ● How many variations? ● 2 normal (before and after) and error restore

6 Designing made Easy ● Designs don't have to be large or complex ● Some companies write out big documents ● Detail is important to the person writing ● Most people only need highlights ● The simpler a design is, easier to read and understand ● That's the philosophy behind Flowcharts

7 Flowcharts ● Pictorial ● If you know the symbols, you can read ● Machine independent ● Can be enlarged for emphasis ● Uses simple recognizable shapes ● Few constructs to remember

8 Symbols

9 Sample Flowchart (without text)

10 Terminator ● Starts and ends a process ● Only one flow, either departing or entering START STOP

11 Process ● Contains calculation or process ● Can contain a sequence of consecutive operations ● Has a single flow entering and a single flow exiting Calculate average Sum = A+B+C Ave = Sum/3

12 Decision ● Condition whose result causes one of multiple calculations or processes ● Stated as question with only YES or NO as answer ● One flow entering and two flows exiting Is A > B? Yes No

13 Input/Output ● Read input or write output ● Only one operation, but can have multiple inputs or outputs ● One flow entering and one flow exiting Read A,B,C

14 Connector ● Brings together separate flows that are coming together to perform the same operation ● Multiple flows entering, one flow exiting ● Note there is no “disconnector”

15 B Link ● Continues flow on another page ● Note this is used ONLY to allow a flow to move onto another page. There is never a need to have two links with the same letter or number on the same page! ● Link is labeled with a letter or number, and has a matching link on another page ● Only one flow, either entering or exiting ● Enters at existing page, exits on other page 2

16 External Reference ● Not Input or Output, which use local devices ● Memory transfer from database or other external device ● Denotes Load into register ● One flow entering, one flow exiting Get next Employee record

17 Predefined Function ● Denotes CALL ● Perform a function that has previously been written and stored in a library ● If it's a function that produces a result, the result can be stored into a variable ● One flow entering, one flow exiting ● In box below, MIN is the predefined function ● Low is the variable containing the result Low = MIN(A,B,C)

18 Let’s try one ● Let’s write a flowchart to detail the process of a user logging into a computer account ● What’s the first step? ● Determine input and output ● Input: userid and password ● Output: one of three situations: ● Accepted ● Incorrect userid ● Incorrect password

19 Other Considerations ● Password is encrypted. Must use system’s routine to check it ● The file containing user names cannot be “open” text ● Would mean any process could get list of names ● There must be a system routine to check for existence

20 So what are our steps? ● INPUT userid and password ● CALL check of userid ● DECISION: is userid valid? ● No, send message to user and exit ● Yes, continue ● CALL check of password, passing userid ● DECISION: OK? ● No, send message to user and exit ● Yes, send message of success and exit

21 Answer START Input userid, pwd Exists = UserCheck (userid) Userid exists? No Yes A B

22 Answer, part 2 A OK = PwdCheck( userid, pwd) Pwd ok? “User does not exist” No “Begin work” Yes B “Invalid password” END

23 Extra consideration ● Some systems allow users three chances, in case they misspelled something ● How would that change this flowchart? ● Have a loop ● Must use a counter, as there is no loop structure in flowcharts ● Set counter, flow to decision ● Decision tests if counter <= 3 ● Yes, goes through process again ● No, connect to connector before END terminator

24 Bonus Assignment ● Implement the “3 tries” extra consideration mentioned on the previous slide ● In other words, recreate the flowchart on Slides 21 and 22 but with the “loop” that allows the user three tries ● This is not required; do it if you would like ● Due the same time as Homework Assignment #1 ● Counts as an extra 50 points