ACSE 2006 8 th Conference The Iconic Programmer Stephen Chen.

Slides:



Advertisements
Similar presentations
CS0004: Introduction to Programming Repetition – Do Loops.
Advertisements

 Control structures  Algorithm & flowchart  If statements  While statements.
Chapter 4 Control Structures I. Objectives ► Examine relational and logical operators ► Explore how to form and evaluate logical (Boolean) expressions.
Chapter 10.
Chapter 6 Horstmann Programs that make decisions: the IF command.
COMP 14 Introduction to Programming Miguel A. Otaduy May 18, 2004.
Computer Science 1620 Programming & Problem Solving.
Visual Basic: An Object Oriented Approach 3 – Making Objects Work.
The UNIVERSITY of NORTH CAROLINA at CHAPEL HILL Adrian Ilie COMP 14 Introduction to Programming Adrian Ilie June 30, 2005.
Fundamentals of Python: From First Programs Through Data Structures
Python quick start guide
CC0002NI – Computer Programming Computer Programming Er. Saroj Sharan Regmi Week 7.
Fundamentals of Python: First Programs
This will let you see the game you are going to play on the inside. It will help you see what all goes into creating instance to that goes into setting.
CIS Computer Programming Logic
Chapter 4 The If…Then Statement
Created by, Author Name, School Name—State FLUENCY WITH INFORMATION TECNOLOGY Skills, Concepts, and Capabilities.
EGR 2261 Unit 5 Control Structures II: Repetition  Read Malik, Chapter 5.  Homework #5 and Lab #5 due next week.  Quiz next week.
CHAPTER 4: CONDITIONAL STRUCTURES Introduction to Computer Science Using Ruby (c) 2012 Ophir Frieder et al.
S2008Final_part1.ppt CS11 Introduction to Programming Final Exam Part 1 S A computer is a mechanical or electrical device which stores, retrieves,
Computer Science 12 Mr. Jean May 2 nd, The plan: Video clip of the day Review of common errors in programs 2D Arrays.
Flow of Control Part 1: Selection
Getting Started with MATLAB 1. Fundamentals of MATLAB 2. Different Windows of MATLAB 1.
CPS120 Introduction to Computer Programming The Programming Process.
Making Decisions Chapter 5.  Thus far we have created classes and performed basic mathematical operations  Consider our ComputeArea.java program to.
An Introduction to Programming with C++ Sixth Edition Chapter 7 The Repetition Structure.
Visual Basic Programming
Saeed Ghanbartehrani Summer 2015 Lecture Notes #5: Programming Structures IE 212: Computational Methods for Industrial Engineering.
CS101 Computer Programming I Chapter 4 Extra Examples.
CONTENTS Processing structures and commands Control structures – Sequence Sequence – Selection Selection – Iteration Iteration Naming conventions – File.
Control Structures CPS120: Introduction to Computer Science Lecture 5.
Chapter 7 Selection Dept of Computer Engineering Khon Kaen University.
Introduction to Java Java Translation Program Structure
Algorithms Writing instructions in the order they should execute.
Control Structures RepetitionorIterationorLooping Part I.
School of Computer Science & Information Technology G6DICP - Lecture 4 Variables, data types & decision making.
More Python!. Lists, Variables with more than one value Variables can point to more than one value at a time. The simplest way to do this is with a List.
Iconic Programmer A Visualization Tool for Teaching Concepts without Context.
31/01/ Selection If selection construct.
Controlling Program Flow with Decision Structures.
COMP Loop Statements Yi Hong May 21, 2015.
IST 210: PHP LOGIC IST 210: Organization of Data IST210 1.
Copyright © 2014 by John Wiley & Sons. All rights reserved.1 Decisions and Iterations.
Decisions: Conditional Statements (informally called If Statements) IST 256 Application Programming for Information Systems.
CS Class 04 Topics  Selection statement – IF  Expressions  More practice writing simple C++ programs Announcements  Read pages for next.
An Introduction to Programming with C++ Sixth Edition Chapter 5 The Selection Structure.
4 - Conditional Control Structures CHAPTER 4. Introduction A Program is usually not limited to a linear sequence of instructions. In real life, a programme.
1 Structured Programming Arab Academy for Science and Technology CC112 Dr. Sherif Mohamed Tawfik The Course.
Slide 1 Chapter 4 The If…Then Statement  Conditional control structure, also called a decision structure  Executes a set of statements when a condition.
IST 210: PHP Logic IST 210: Organization of Data IST2101.
Copyright © 2014 Pearson Addison-Wesley. All rights reserved. 4 Simple Flow of Control.
© 2006 Lawrenceville Press Slide 1 Chapter 5 The If…Then Statement (One-Way)  Conditional control structure, also called a decision structure  Executes.
CIS3931 – Intro to JAVA Lecture Note Set 2 17-May-05.
Chapter 4 The If…Then Statement
Conditional Statements and Control Structure
The Selection Structure
Bools & Ifs.
Introduction to MATLAB
Microsoft Visual Basic 2005 BASICS
MSIS 655 Advanced Business Applications Programming
Loops CIS 40 – Introduction to Programming in Python
Coding Concepts (Basics)
3 Control Statements:.
Introduction to Problem Solving and Control Statements
Selection Statements.
Computer Science Core Concepts
Chapter 5: Control Structures II (Repetition)
CS2011 Introduction to Programming I Selections (I)
Flow of Control Flow of control is the order in which a program performs actions. Up to this point, the order has been sequential. A branching statement.
Intro to Programming (in JavaScript)
Presentation transcript:

ACSE th Conference The Iconic Programmer Stephen Chen

ACSE -- The Iconic Programmer 2 Overview Actual slides from first three weeks Want students to focus on programming concepts rather than (JAVA) syntax Want students to learn to think in structures (i.e. problem solve)

ACSE -- The Iconic Programmer 3 Structured Programming Focus on processes – focus on actions 3 structures of structured programming  Sequence  Perform an action  Branch  Select an action (or no action)  Loop  Repeat an action

ACSE -- The Iconic Programmer 4 Each structure has an icon Program by assembling icons Iconic Programmer

ACSE -- The Iconic Programmer 5 Sequence Standard operation of a computer Actions are performed in sequence  First action  Second action  …  Last action Program runs same way each time

ACSE -- The Iconic Programmer 6 Actions Action  Manipulate data Iconic Programmer  Declare  Assign  Output

ACSE -- The Iconic Programmer 7 Declarations A computer needs to allocate storage space for all data that it manipulates  Declaration gives a meaningful name to the data element/storage space Iconic Programmer  Only integer data elements  Give name in text box

ACSE -- The Iconic Programmer 8 Assignments Once the computer has a storage space, it can store/change data in that space Iconic Programmer  Random value  Result of mathematical expression  User input

ACSE -- The Iconic Programmer 9 Mathematical Expressions value = value +1 (math)  The value is equal to the value plus one  Impossible mathematically value = value + 1 (computers)  The storage space for value will become the previous contents plus one Actions: perform math, perform storage

ACSE -- The Iconic Programmer 10 Output When computer is done with program (or during debugging), we may want to see the result – what is in a storage space Iconic Programmer  Value in storage space  Text information (nominally stored)

ACSE -- The Iconic Programmer 11 Sample Program Output the double and triple of an input  Declare a storage space  Assign an input value to the storage space  Declare a second storage space  Assign double the input to this space  Output the value in the second space  Assign triple the input to this space  Output the value in the second space

ACSE -- The Iconic Programmer 12 Branching allows a program to make decisions  Diamonds represent conditions  Two outgoing paths from condition  Paths (with sequences) can be skipped Branching

ACSE -- The Iconic Programmer 13 Example of Branching Program specification  Make withdrawal if funds are sufficient Program actions  Check account balance and withdraw amount  Make withdrawal Need to make withdrawal optional

ACSE -- The Iconic Programmer 14 Decisions Branching selects from two paths Two paths  two states  true (yes)  false (no) Diamond contains a condition  A condition is a true - false question

ACSE -- The Iconic Programmer 15 Relational Operators How to turn integers into true / false ?  Greater than  Less than  Equal to  Not equal to  Greater than or equal to  Less than or equal to

ACSE -- The Iconic Programmer 16 Compound Conditions Allow us to put two (or more) sub- conditions into a condition  AND  OR

ACSE -- The Iconic Programmer 17 AND The expression is TRUE if and only if both input variables are TRUE TRUE 1 FALSE 0 TRUE 1 TRUE 1 FALSE 0 FALSE 0 FALSE 0 FALSE 0

ACSE -- The Iconic Programmer 18 OR The expression is TRUE if either input variable is TRUE TRUE 1 FALSE 0 TRUE 1 TRUE 1 TRUE 1 FALSE 0 TRUE 1 FALSE 0

ACSE -- The Iconic Programmer 19 Inclusive and Exclusive OR Computers use inclusive OR  Stop the bus if passengerA OR passengerB wants to get off Exclusive OR is different  You can get $1000 cash back or 0% financing

ACSE -- The Iconic Programmer 20 Two Branches Did you roll a doublet?  die1 == die2  double move  Normal move

ACSE -- The Iconic Programmer 21 Multiple Branches What is your grade classification?  >= 80  honours  >= 60  pass  Not pass

ACSE -- The Iconic Programmer 22 Looping In Sequence and Branching, each action is performed at most once Looping allows certain actions to be repeated Keeps programs from getting large and unmanageable

ACSE -- The Iconic Programmer 23 Example of Looping Program specification  Take user inputs until they guess correctly Program  Declare and initialize number  Declare guess  Input and compare guess  …

ACSE -- The Iconic Programmer 24 Looping Icon Loops have same components as branches  Condition selects one of two paths  Optional path “loops back” to condition

ACSE -- The Iconic Programmer 25 Java syntax – branches Basic shell if (/*boolean expression*/) { // conditional statements }

ACSE -- The Iconic Programmer 26 Java syntax – exclusive branches if (/*boolean expression*/) { // conditional statements } else { // default statements }

ACSE -- The Iconic Programmer 27 Java syntax – multiple branches if (/*boolean expression*/) { // conditional statements } else if (/*boolean expression*/) { // more conditional statements }

ACSE -- The Iconic Programmer 28 Java syntax – loops Basic shell while (/*boolean expression*/) { // repeatable statements }

ACSE -- The Iconic Programmer 29 Common Error Decision to loop does not require a branch Decisions are not structures Branches - selected actions Loops - repeated actions

ACSE -- The Iconic Programmer 30 Sample Program – Telephone Banking Write a program that implements an ATM interface  1 – get balance  2 – deposit  3 – withdraw  9 – end session What are the key structures?