acse 2006 8 th conference n.
Download
Skip this Video
Loading SlideShow in 5 Seconds..
ACSE 2006 8 th Conference PowerPoint Presentation
Download Presentation
ACSE 2006 8 th Conference

Loading in 2 Seconds...

play fullscreen
1 / 30

ACSE 2006 8 th Conference - PowerPoint PPT Presentation


  • 66 Views
  • Uploaded on

ACSE 2006 8 th Conference. The Iconic Programmer Stephen Chen. 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). Structured Programming.

loader
I am the owner, or an agent authorized to act on behalf of the owner, of the copyrighted work described.
capcha
Download Presentation

PowerPoint Slideshow about 'ACSE 2006 8 th Conference' - solana


An Image/Link below is provided (as is) to download presentation

Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author.While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server.


- - - - - - - - - - - - - - - - - - - - - - - - - - E N D - - - - - - - - - - - - - - - - - - - - - - - - - -
Presentation Transcript
acse 2006 8 th conference

ACSE 20068th Conference

The Iconic Programmer

Stephen Chen

overview
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

structured programming
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

iconic programmer
Iconic Programmer
  • Each structure has an icon
  • Program by assembling icons

ACSE -- The Iconic Programmer

sequence
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

actions
Actions
  • Action
    • Manipulate data
  • Iconic Programmer
    • Declare
    • Assign
    • Output

ACSE -- The Iconic Programmer

declarations
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

assignments
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

mathematical expressions
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

output
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

sample program
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

branching
Branching
  • Branching allows a program to make decisions
    • Diamonds represent conditions
    • Two outgoing paths from condition
    • Paths (with sequences) can be skipped

ACSE -- The Iconic Programmer

example of branching
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

decisions
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

relational operators
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

compound conditions
Compound Conditions
  • Allow us to put two (or more) sub-conditions into a condition
    • AND
    • OR

ACSE -- The Iconic Programmer

slide17
AND
  • The expression is TRUE if and only if both input variables are TRUE

ACSE -- The Iconic Programmer

slide18
OR
  • The expression is TRUE if either input variable is TRUE

ACSE -- The Iconic Programmer

inclusive and exclusive or
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

two branches
Two Branches
  • Did you roll a doublet?
    • die1 == die2  double move
    • Normal move

ACSE -- The Iconic Programmer

multiple branches
Multiple Branches
  • What is your grade classification?
    • >= 80  honours
    • >= 60  pass
    • Not pass

ACSE -- The Iconic Programmer

looping
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

example of looping
Example of Looping
  • Program specification
    • Take user inputs until they guess correctly
  • Program
    • Declare and initialize number
    • Declare guess
    • Input and compare guess
    • Input and compare guess

ACSE -- The Iconic Programmer

looping icon
Looping Icon
  • Loops have same components as branches
    • Condition selects one of two paths
    • Optional path “loops back” to condition

ACSE -- The Iconic Programmer

java syntax branches
Java syntax – branches
  • Basic shell

if (/*boolean expression*/)

{

// conditional statements

}

ACSE -- The Iconic Programmer

java syntax exclusive branches
Java syntax – exclusive branches

if (/*boolean expression*/)

{

// conditional statements

}

else

{

// default statements

}

ACSE -- The Iconic Programmer

java syntax multiple branches
Java syntax – multiple branches

if (/*boolean expression*/)

{

// conditional statements

}

else if (/*boolean expression*/)

{

// more conditional statements

}

ACSE -- The Iconic Programmer

java syntax loops
Java syntax – loops
  • Basic shell

while (/*boolean expression*/)

{

// repeatable statements

}

ACSE -- The Iconic Programmer

common error
Common Error
  • Decision to loop does not require a branch
  • Decisions are not structures
  • Branches - selected actions
  • Loops - repeated actions

ACSE -- The Iconic Programmer

sample program telephone banking
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?

ACSE -- The Iconic Programmer