Today’s Agenda 1.Collect Pre-Lab 3 2.Alice Programming Assignment 3.Built-in Functions 4.Expressions 5.Control Structure 6.Assign pair programming teams and meet upstairs for Lab 3
Explore the Possibilities CS 112: Foundations of Computer Science Control & Functions Putting the pieces together
Putting together the pieces A major part of learning how to program is figuring out how to put the pieces together that compose a program.
Four Pieces Instructions –A statement that executes on the computer Control Structures –Do in order (sequential) –Do together (parallel) Functions Expressions
Alice Built-in Functions A function computes a value or asks a question –What is King Tut’s distance to Cleopatra? –Is the mummy taller than King Tut?
Control Structures Do in order Do together Conditional – if/else Repetition –Loop –while
pseudocode
Do the mummy walk Do in order –Do together Mummy move forward ¼ meter Do in order –mummy’s left leg turn backward 0.1 revolutions –mummy’s left leg turn forward 0.1 revolutions –Do together mummy move forward ¼ meter Do in order –mummy’s right leg turn backward 0.1 revolutions –mummy’s right leg turn forward 0.1 revolutions
Today’s Summary 1.Alice Programming Assignment 2.Built-in Functions 3.Expressions (+ - * /) 4.Control Structure (if/else, loop, while) 5.Assign pair programming teams and meet upstairs for Lab 3