Decision Structures. Chapter 4

Size: px
Start display at page:

Download "Decision Structures. Chapter 4"

Transcription

1 Decision Structures Chapter 4

2 Chapter 4 Objectives To understand: o What values can be stored in a Boolean variable o What sequence structures are and when used o What decision structures are and when used o The difference between dual-alternative and singlealternative decision structures o What nested instructions are o What relational operators are and how they are used 4-2

3 4.1 Boolean Variables Boolean Variables hold only two values o True o False o Initial Value is usually set to be TRUE What it looks like in variable definitions 4-3

4 4.1 Boolean Functions Boolean Functions return one value from the choice of o o True False Also primitive functions that are Boolean o User prompted to answer Yes (true) or No (false) Ask the following question: 4-4

5 4.2 If/Else Decision Structure Used to check a condition and make a decision If a Boolean condition is o True then one set of instructions are executed o False then a different set is executed All previous instructions have been consecutively executed o One o After o The o Other 4-5

6 If/Else Flow Chart Used to check a condition and make a decision

7 Storyboard A storyboard design for this conditional statement is: BOTH actions will NOT be performed only ONE can be! If the hole is wider than the penguin penguin falls down the hole Else penguin says Drats! End If TRUE FALSE The penguin falling or speaking are instructions that are conditionally executed o o They do NOT always execute Executed only under certain conditions

8 4.2 Decision Structure Flowchart Penguin falls down into the hole 4-8

9 4.2 If/Else Statement Location If/Else Tile 4-9

10 4.2 Using If/Else Instruction Two empty slots in instruction o o IF part ELSE part Empty If/Else instruction Choose placeholder or true/false after dragging to location Replace placeholder with Boolean variable or a Boolean function Instructions tiles added to both the IF part and ELSE part More than one instruction can be added to both the IF and ELSE part 4-10

11 Single-Alternative Decision 4.2 Structures If/Else is a dual-alternative decision structure o Two paths of execution One following TRUE Other following FALSE Single-alternative decision structures are similar to the dual-alternative o The ELSE part is empty 4-11

12 Single-Alternative Decision 4.2 Structures Start Penguin turns to face hole Hole wider than penguin? F T Penguin walks to center of hole Penguin falls into hole End 4-12

13 4.2 Nested If/Else Instructions When an If/Else instruction is placed inside another If/Else instruction The inner If/Else executes only if the outer If/Else is true 4-13

14 Start Nested If/Else Instructions 4.2 Penguin faces hole False Within 2 meters True Too Far! False Hole wider? True Drats! Penguin walks Penguin falls in End 4-14

15 4.3 Relational Comparisons Relational Operators are used to compare values and determine whether relationships exist Greater than Less than Equal to Compare two values and determine how they relate to each other Operator Meaning = = Equal to! = Not equal to > Greater than > = Greater than or equal to < Less than < = Less than or equal to 4-15

16 4.3 Relational Operators Used to write your own comparison In If/Else and other tests Operates on two pieces of data a and b Alice uses a and b for placeholders Drag the desired tile and replace either the a or b with a value 4-16

17 Demonstration in Robot Example Concept illustrated o Relational operations are defined using relational operators

18 Boolean Logic Can check for multiple conditions at one time with Boolean logic Boolean logic operators are used to build an expression composed of multiple conditions o o o And Or Boolean: A and B: both must be true to be true In Alice: Both A and B Boolean: A or B: one or both must be true to be true In Alice: Either A or B, or both Not Inverses what you feed it Example: if A = True then not A is False In Alice: not A

19 Boolean Logic in Functions Choose World object Then choose functions o Select desired Boolean function o Drag to conditional instruction like If/Else Condition

20 4.3 Logical Operators Tests more than true/false can do complex testing! o Test two conditions to see if they BOTH are true! o Or ONLY one condition is true! o Or NEITHER condition is true! 4-20

21 Example Can combine multiple conditions Example: o o Penguin within 2 meters And circle is wider than penguin Similar to nested If/Else but does not do what is in second Else statement o Penquin say too far away 4-21

22 Testing Value of Object s Property Sometimes you might want to see what a property of an object is o Color o Opacity o isshowing 4-22

23 How to Testing Object s Property Create an empty If/Else instruction Select object to test Click properties tab Drag desired property s tile and drop onto If/Else instruction s condition Menu appears showing all comparisons to perform o Select desired comparison Another menu appears allowing you to select value that you want to compare property to o Ex: color property will give list of colors 4-23

24 Storyboard Frog and ladybug are in garden Ladybug says Excuse me Frog turns to face ladybug If ladybug s color is red o Frog says EEK! Go away! Else o Frog says Good Morning Endif 4-24

25 Property Test Demonstration 4-25

26 Homework Read chapter 4 Answer questions in handout Do lab assignments after handing in answered questions Due one week after assigned with 1 week grace

Class-level Methods. Chapter 6 part 1

Class-level Methods. Chapter 6 part 1 Class-level Methods Chapter 6 part 1 Classes and Objects Classes o In Alice, classes are predefined as 3D models Objects o An object is an instance of a class Class: Frog (Uppercase first letter) Objects:

More information

3 Programming. Jalal Kawash Mandatory: Chapter 5 Section 5.5 Jalal s resources: How to movies and example programs available at:

3 Programming. Jalal Kawash Mandatory: Chapter 5 Section 5.5 Jalal s resources: How to movies and example programs available at: 3 Programming 1 Mandatory: Chapter 5 Section 5.5 Jalal s resources: How to movies and example programs available at: http://pages.cpsc.ucalgary.ca/~kawash/peeking/alice-how-to.html JT s resources: www.cpsc.ucalgary.ca/~tamj/203/extras/alice

More information

Variables and Functions Chapter 3

Variables and Functions Chapter 3 Variables and Functions Chapter 3 3-1 Variables Named storage location in computer s memory Programs may need to store data when running o Stored in a variable Types of data that can be stored o Local

More information

World-level Classes and Methods. Chapter 6

World-level Classes and Methods. Chapter 6 World-level Classes and Methods Chapter 6 Programs Grow Code seems to grow and grow Makes program more difficult to read and process in our minds Games and other software can have thousands, even millions

More information

Decision Making in C

Decision Making in C Decision Making in C Decision making structures require that the programmer specify one or more conditions to be evaluated or tested by the program, along with a statement or statements to be executed

More information

Getting Started with Java Using Alice. 1 Copyright 2013, Oracle and/or its affiliates. All rights reserved.

Getting Started with Java Using Alice. 1 Copyright 2013, Oracle and/or its affiliates. All rights reserved. Getting Started with Java Using Alice 1 Copyright 2013, Oracle and/or its affiliates. All rights Objectives This lesson covers the following objectives: Use the IF control structure to effect execution

More information

Using Functions in Alice

Using Functions in Alice Using Functions in Alice Step 1: Understanding Functions 1. Download the starting world that goes along with this tutorial. We will be using functions. A function in Alice is basically a question about

More information

Gaddis: Starting Out with Alice Test Bank Chapter Two 1 Chapter Two

Gaddis: Starting Out with Alice Test Bank Chapter Two 1 Chapter Two Gaddis: Starting Out with Alice Test Bank Chapter Two 1 Chapter Two MULTIPLE CHOICE 1. What is the name of the default world method that automatically runs when an Alice program is executed? a. the first

More information

Flow of Control Branching 2. Cheng, Wei COMP May 19, Title

Flow of Control Branching 2. Cheng, Wei COMP May 19, Title Flow of Control Branching 2 Cheng, Wei COMP110-001 May 19, 2014 Title Review of Previous Lecture If else Q1: Write a small program that Reads an integer from user Prints Even if the integer is even Otherwise,

More information

LECTURE 04 MAKING DECISIONS

LECTURE 04 MAKING DECISIONS PowerPoint Slides adapted from *Starting Out with C++: From Control Structures through Objects, 7/E* by *Tony Gaddis* Copyright 2012 Pearson Education Inc. COMPUTER PROGRAMMING LECTURE 04 MAKING DECISIONS

More information

Loops and Conditionals. HORT Lecture 11 Instructor: Kranthi Varala

Loops and Conditionals. HORT Lecture 11 Instructor: Kranthi Varala Loops and Conditionals HORT 59000 Lecture 11 Instructor: Kranthi Varala Relational Operators These operators compare the value of two expressions and returns a Boolean value. Beware of comparing across

More information

Chapter 4: Making Decisions

Chapter 4: Making Decisions Chapter 4: Making Decisions 4.1 Relational Operators Relational Operators Used to compare numbers to determine relative order Operators: > Greater than < Less than >= Greater than or equal to

More information

Chapter 4: Making Decisions

Chapter 4: Making Decisions Chapter 4: Making Decisions CSE 142 - Computer Programming I 1 4.1 Relational Operators Relational Operators Used to compare numbers to determine relative order Operators: > Greater than < Less than >=

More information

Assessment - Unit 3 lessons 16-21

Assessment - Unit 3 lessons 16-21 Name(s) Period Date Assessment - Unit 3 lessons 16-21 1. Which of the following statements about strings in JavaScript is FALSE? a. Strings consist of a sequence of concatenated ASCII characters. b. Strings

More information

Computer Programming: C++

Computer Programming: C++ The Islamic University of Gaza Engineering Faculty Department of Computer Engineering Fall 2017 ECOM 2003 Muath i.alnabris Computer Programming: C++ Experiment #4 Loops Part II Contents Loop Control Statement

More information

Loops! Loops! Loops! Lecture 5 COP 3014 Fall September 25, 2017

Loops! Loops! Loops! Lecture 5 COP 3014 Fall September 25, 2017 Loops! Loops! Loops! Lecture 5 COP 3014 Fall 2017 September 25, 2017 Repetition Statements Repetition statements are called loops, and are used to repeat the same code mulitple times in succession. The

More information

IT Introduction to Programming for I.T. Midterm Exam #1 - Prof. Reed Spring 2008

IT Introduction to Programming for I.T. Midterm Exam #1 - Prof. Reed Spring 2008 IT 101 - Introduction to Programming for I.T. Midterm Exam #1 - Prof. Reed Spring 2008 What is your name?: (0 points) There are two sections: I. True/False..................... 20 points; ( 10 questions,

More information

Programming Logic and Design Ninth Edition

Programming Logic and Design Ninth Edition Programming Logic and Design Ninth Edition Chapter 3 Understanding Structure The Disadvantages of Unstructured Spaghetti Code Spaghetti code Logically snarled program statements Often a complicated mess

More information

Alice. Coverage. Mathematical Expressions, Conditional Statements, Control Structures. Arithmetic Expressions Built-in Functions Conditional Execution

Alice. Coverage. Mathematical Expressions, Conditional Statements, Control Structures. Arithmetic Expressions Built-in Functions Conditional Execution Alice Mathematical Expressions, Conditional Statements, Control Structures Coverage Arithmetic Expressions Built-in Functions Conditional Execution If/Then Statements Control Structures Loops 1 Functions

More information

Name Introduction to Computer Science. 1. A sequence of instructions that tell the computer what to do is known as a?

Name Introduction to Computer Science. 1. A sequence of instructions that tell the computer what to do is known as a? Name Introduction to Computer Science 1. A sequence of instructions that tell the computer what to do is known as a? a. help screen b. mouse click c. computer program d. keystroke 2. Actions to be performed

More information

LAB 5: SELECTION STATEMENTS

LAB 5: SELECTION STATEMENTS Statement Purpose: The purpose of this lab is to familiarize students with Conditional statements and explain how to control the sequence of statement execution, depending on the value of an expression

More information

SELECTION. (Chapter 2)

SELECTION. (Chapter 2) SELECTION (Chapter 2) Selection Very often you will want your programs to make choices among different groups of instructions For example, a program processing requests for airline tickets could have the

More information

CompSci 94 Making Decisions February 8, Prof. Susan Rodger

CompSci 94 Making Decisions February 8, Prof. Susan Rodger CompSci 94 Making Decisions February 8, 2018 Prof. Susan Rodger CompSci 94 Spring 2018 1 Class Today Asking questions and making decisions Using functions If statements CompSci 94 Spring 2018 2 Review

More information

Choose the best answer from each of the following; answer A for True, B for False for any T/F questions.

Choose the best answer from each of the following; answer A for True, B for False for any T/F questions. Alice Quiz: Chapters 1-3 Choose the best answer from each of the following; answer A for True, B for False for any T/F questions. 1) According to the Alice text, learning to program makes you a computer

More information

Chapter 4: Making Decisions. Copyright 2012 Pearson Education, Inc. Sunday, September 7, 14

Chapter 4: Making Decisions. Copyright 2012 Pearson Education, Inc. Sunday, September 7, 14 Chapter 4: Making Decisions 4.1 Relational Operators Relational Operators Used to compare numbers to determine relative order Operators: > Greater than < Less than >= Greater than or equal to

More information

while (condition) { body_statements; for (initialization; condition; update) { body_statements;

while (condition) { body_statements; for (initialization; condition; update) { body_statements; ITEC 136 Business Programming Concepts Week 01, Part 01 Overview 1 Week 7 Overview Week 6 review Four parts to every loop Initialization Condition Body Update Pre-test loops: condition is evaluated before

More information

Announcements. HW0 is posted on schedule, due next Friday at 9pm (pretty easy)

Announcements. HW0 is posted on schedule, due next Friday at 9pm (pretty easy) Branching Announcements HW0 is posted on schedule, due next Friday at 9pm (pretty easy) Office hours (attempt problems before going): - HW only or Lab only (check calendar) - Write name on whiteboard if

More information

Creating a Fancier Fox and Inheritance in Alice 3

Creating a Fancier Fox and Inheritance in Alice 3 Creating a Fancier Fox and Inheritance in Alice 3 Jonathon Kuo under the direction of Professor Susan Rodger June 2017 Adapted from Dr. Rodger s Alice 2 tutorial, Creating a Fancier Chicken to use in several

More information

Lecture 5 Tao Wang 1

Lecture 5 Tao Wang 1 Lecture 5 Tao Wang 1 Objectives In this chapter, you will learn about: Selection criteria Relational operators Logical operators The if-else statement Nested if statements C++ for Engineers and Scientists,

More information

Computer Programming: C++

Computer Programming: C++ The Islamic University of Gaza Engineering Faculty Department of Computer Engineering Fall 2017 ECOM 2003 Muath i.alnabris Computer Programming: C++ Experiment #3 Loops Part I Contents Introduction For-Loop

More information

Microsoft Visual Basic 2005: Reloaded

Microsoft Visual Basic 2005: Reloaded Microsoft Visual Basic 2005: Reloaded Second Edition Chapter 4 Making Decisions in a Program Objectives After studying this chapter, you should be able to: Include the selection structure in pseudocode

More information

Announcements. Homework 0: using cin with 10/3 is NOT the same as (directly)

Announcements. Homework 0: using cin with 10/3 is NOT the same as (directly) Branching Announcements Homework 0: using cin with 10/3 is NOT the same as 3.3333 (directly) With cin, it will stop as soon as it reaches a type that does not match the variable (into which it is storing)

More information

Accelerating Information Technology Innovation

Accelerating Information Technology Innovation Accelerating Information Technology Innovation http://aiti.mit.edu/program/philippines-summer-2012/ Philippines Summer 2012 Lecture 1 Introduction to Python June 19, 2012 Agenda About the Course What is

More information

Classes, Objects, and World-level Methods. Alice

Classes, Objects, and World-level Methods. Alice Classes, Objects, and World-level Methods Alice Larger Programs As you become more skilled in writing programs, you will find that programs quickly increase to many, many lines of code. Games and other

More information

Step 1: Changing the Penguins Colors. Download the starting world that goes with this tutorial. We are

Step 1: Changing the Penguins Colors. Download the starting world that goes with this tutorial. We are Changing Color, Ui Using Text Objects, and Random Selection in Alice By Jenna Hayes Under the direction of Professor Susan Rodger Duke University, July 2008 Download the starting world that goes with this

More information

Chapter 4: Making Decisions

Chapter 4: Making Decisions Chapter 4: Making Decisions Understanding Logic-Planning Tools and Pseudocode Decision Making A tool that helps programmers plan a program s logic by writing plain English statements Flowchart You write

More information

BIL101E: Introduction to Computers and Information systems Lecture 8

BIL101E: Introduction to Computers and Information systems Lecture 8 BIL101E: Introduction to Computers and Information systems Lecture 8 8.1 Algorithms 8.2 Pseudocode 8.3 Control Structures 8.4 Decision Making: Equality and Relational Operators 8.5 The if Selection Structure

More information

Changing Camera Views! Part 2: Simple Scene Change & Lighting Fixes

Changing Camera Views! Part 2: Simple Scene Change & Lighting Fixes Changing Camera Views! Part 2: Simple Scene Change & Lighting Fixes By Bella Onwumbiko under the direction of Professor Susan Rodger Duke University July 2013 Introduction! In this tutorial, we will set

More information

Coloring Randomly: Random Selec2on in Alice. By Jenna Hayes under the direc2on of Professor Susan Rodger Duke University July 2008

Coloring Randomly: Random Selec2on in Alice. By Jenna Hayes under the direc2on of Professor Susan Rodger Duke University July 2008 Coloring Randomly: Random Selec2on in Alice By Jenna Hayes under the direc2on of Professor Susan Rodger Duke University July 2008 Step One: Crea,ng Color Method Download the Alice World that goes along

More information

Accelerating Information Technology Innovation

Accelerating Information Technology Innovation Accelerating Information Technology Innovation http://aiti.mit.edu Cali, Colombia Summer 2012 Lesson 1 Introduction to Python Agenda What is Python? and Why Python? Basic Syntax Strings User Input Useful

More information

Two Types of Types. Primitive Types in Java. Using Primitive Variables. Class #07: Java Primitives. Integer types.

Two Types of Types. Primitive Types in Java. Using Primitive Variables. Class #07: Java Primitives. Integer types. Class #07: Java Primitives Software Design I (CS 120): M. Allen, 13 Sep. 2018 Two Types of Types So far, we have mainly been dealing with objects, like DrawingGizmo, Window, Triangle, that are: 1. Specified

More information

More Things We Can Do With It! Overview. Circle Calculations. πr 2. π = More operators and expression types More statements

More Things We Can Do With It! Overview. Circle Calculations. πr 2. π = More operators and expression types More statements More Things We Can Do With It! More operators and expression types More s 11 October 2007 Ariel Shamir 1 Overview Variables and declaration More operators and expressions String type and getting input

More information

Viewing Flowcharts in Crystal C/C++

Viewing Flowcharts in Crystal C/C++ Viewing Flowcharts in Crystal C/C++ Part 1: Simple Flowcharts Part 2: Simplify a Complex Flowchart Part 3: Examples Viewing Flowcharts in Crystal C/C++ 1 Viewing Flowcharts in Crystal C/C++ 2 Flowchart

More information

Plotting Points. By Francine Wolfe Professor Susan Rodger Duke University June 2010

Plotting Points. By Francine Wolfe Professor Susan Rodger Duke University June 2010 Plotting Points By Francine Wolfe Professor Susan Rodger Duke University June 2010 Description This tutorial will show you how to create a game where the player has to plot points on a graph. The method

More information

Topics. Introduction to Repetition Structures Often have to write code that performs the same task multiple times. Controlled Loop

Topics. Introduction to Repetition Structures Often have to write code that performs the same task multiple times. Controlled Loop Topics C H A P T E R 4 Repetition Structures Introduction to Repetition Structures The for Loop: a Count- Sentinels Nested Loops Introduction to Repetition Structures Often have to write code that performs

More information

Lecture Programming in C++ PART 1. By Assistant Professor Dr. Ali Kattan

Lecture Programming in C++ PART 1. By Assistant Professor Dr. Ali Kattan Lecture 08-1 Programming in C++ PART 1 By Assistant Professor Dr. Ali Kattan 1 The Conditional Operator The conditional operator is similar to the if..else statement but has a shorter format. This is useful

More information

In this lab, you will learn more about selection statements. You will get familiar to

In this lab, you will learn more about selection statements. You will get familiar to Objective: In this lab, you will learn more about selection statements. You will get familiar to nested if and switch statements. Nested if Statements: When you use if or if...else statement, you can write

More information

Making Billboards. By Deborah Nelson Duke University, Under the direc:on of Professor Susan Rodger, July 14, 2008

Making Billboards. By Deborah Nelson Duke University, Under the direc:on of Professor Susan Rodger, July 14, 2008 Making Billboards By Deborah Nelson Duke University, Under the direc:on of Professor Susan Rodger, July 14, 2008 Setting Up a World Open a new world, with any template and save it in a directory that you

More information

Selec%on and Decision Structures in Java: If Statements and Switch Statements CSC 121 Fall 2016 Howard Rosenthal

Selec%on and Decision Structures in Java: If Statements and Switch Statements CSC 121 Fall 2016 Howard Rosenthal Selec%on and Decision Structures in Java: If Statements and Switch Statements CSC 121 Fall 2016 Howard Rosenthal Lesson Goals Understand Control Structures Understand how to control the flow of a program

More information

STUDENT OUTLINE. Lesson 8: Structured Programming, Control Structures, if-else Statements, Pseudocode

STUDENT OUTLINE. Lesson 8: Structured Programming, Control Structures, if-else Statements, Pseudocode STUDENT OUTLINE Lesson 8: Structured Programming, Control Structures, if- Statements, Pseudocode INTRODUCTION: This lesson is the first of four covering the standard control structures of a high-level

More information

A Simple Quiz for Alice 3.2: Ask User Functions.

A Simple Quiz for Alice 3.2: Ask User Functions. A Simple Quiz for Alice 3.2: Ask User Functions. By Lana Dyck under the direction of Professor Susan Rodger Duke University June 2009, added Part 2 July 2011, Edited for Alice 3 use and Part 3,4 added

More information

IDENTIFY WAYS OF REPRESENTING ALGORITHMS.

IDENTIFY WAYS OF REPRESENTING ALGORITHMS. IDENTIFY WAYS OF REPRESENTING ALGORITHMS. OBJECTIVES: Identify ways of representing algorithms: Content Representation of algorithms as Pseudocode or Flowcharts; use of flow chart symbols: input/output

More information

Telling a Story Visually. Copyright 2012, Oracle. All rights reserved.

Telling a Story Visually. Copyright 2012, Oracle. All rights reserved. What Will I Learn? Objectives In this lesson, you will learn how to: Compare and define an animation and a scenario Demonstrate how to use the four problem solving steps to storyboard your animation Use

More information

4.1. Chapter 4: Simple Program Scheme. Simple Program Scheme. Relational Operators. So far our programs follow a simple scheme

4.1. Chapter 4: Simple Program Scheme. Simple Program Scheme. Relational Operators. So far our programs follow a simple scheme Chapter 4: 4.1 Making Decisions Relational Operators Simple Program Scheme Simple Program Scheme So far our programs follow a simple scheme Gather input from the user Perform one or more calculations Display

More information

Computer Programming: C++

Computer Programming: C++ The Islamic University of Gaza Engineering Faculty Department of Computer Engineering Fall 2017 ECOM 2003 Muath i.alnabris Computer Programming: C++ Experiment #7 Arrays Part II Passing Array to a Function

More information

bool bool - either true or false

bool bool - either true or false Strings & Branching bool bool - either true or false You have the common math comparisons: > (greater than), e.g. 7 > 2.5 is true == (equals), e.g. 5 == 4 is false

More information

CSE115 / CSE503 Introduction to Computer Science I. Dr. Carl Alphonce 343 Davis Hall Office hours:

CSE115 / CSE503 Introduction to Computer Science I. Dr. Carl Alphonce 343 Davis Hall Office hours: CSE115 / CSE503 Introduction to Computer Science I Dr. Carl Alphonce 343 Davis Hall alphonce@buffalo.edu Office hours: Thursday 12:00 PM 2:00 PM Friday 8:30 AM 10:30 AM OR request appointment via e-mail

More information

CS 170 Java Programming 1. Week 10: Loops and Arrays

CS 170 Java Programming 1. Week 10: Loops and Arrays CS 170 Java Programming 1 Week 10: Loops and Arrays What s the Plan? Topic 1: A Little Review Use a counted loop to create graphical objects Write programs that use events and animation Topic 2: Advanced

More information

Chapter Goals. Contents LOOPS

Chapter Goals. Contents LOOPS CHAPTER 4 LOOPS Slides by Donald W. Smith TechNeTrain.com Final Draft Oct 30, 2011 Chapter Goals To implement while, for, and do loops To hand-trace the execution of a program To become familiar with common

More information

Plotting Graphs. Error Bars

Plotting Graphs. Error Bars E Plotting Graphs Construct your graphs in Excel using the method outlined in the Graphing and Error Analysis lab (in the Phys 124/144/130 laboratory manual). Always choose the x-y scatter plot. Number

More information

INTRODUCTION // MODELING PROCESS COMPARISON

INTRODUCTION // MODELING PROCESS COMPARISON INTRODUCTION // MODELING PROCESS COMPARISON INTRODUCTION // MODELING PROCESS IN RHINO ROTATION AXIS PROFILE CRV - TYPE REVOLVE - HIT - PICK PROFILE CRV - HIT - PICK ROTATION AXIS - HIT - TYPE 0 AS START

More information

DECISION STRUCTURES: USING IF STATEMENTS IN JAVA

DECISION STRUCTURES: USING IF STATEMENTS IN JAVA DECISION STRUCTURES: USING IF STATEMENTS IN JAVA S o far all the programs we have created run straight through from start to finish, without making any decisions along the way. Many times, however, you

More information

Today. Homework 1 / Test 1 Making decisions in Java If statements If/Else ( Either-or ) statements Logical NOT operator

Today. Homework 1 / Test 1 Making decisions in Java If statements If/Else ( Either-or ) statements Logical NOT operator Today Homework 1 / Test 1 Making decisions in Java If statements If/Else ( Either-or ) statements Logical NOT operator BIT 115: Introduction To Programming 1 Something to Remember: In parameter order,

More information

Peeking into Computer Science Alice Lab Manual. Lab Manual. Programming

Peeking into Computer Science Alice Lab Manual. Lab Manual. Programming Lab Manual Programming 1 Alice Lab 1: Introduction 2 Table of Contents Lab 1: Introduction... 5 The Alice Interface... 6 Objects... 6 Lab 2: Sequential & Parallel Execution... 15 Do in order... 15 Do together...

More information

Control Structures. Lecture 4 COP 3014 Fall September 18, 2017

Control Structures. Lecture 4 COP 3014 Fall September 18, 2017 Control Structures Lecture 4 COP 3014 Fall 2017 September 18, 2017 Control Flow Control flow refers to the specification of the order in which the individual statements, instructions or function calls

More information

A Quick Review of Chapter 1

A Quick Review of Chapter 1 A Quick Review of Chapter 1 The core of computing is algorithms Algorithm A well-ordered collection of unambiguous and effectively computable operations that, when executed, produces a result and halts

More information

Decision Structures. Lecture 3 MIT 12043, Fundamentals of Programming By: S. Sabraz Nawaz

Decision Structures. Lecture 3 MIT 12043, Fundamentals of Programming By: S. Sabraz Nawaz Decision Structures Lecture 3 MIT 12043, Fundamentals of Programming By: S. Sabraz Nawaz Chapter Topics o Relational Operators o The if Statement o The if-else Statement o Nested if statements o The if-else-if

More information

Foundations of Computer Science Laboratory

Foundations of Computer Science Laboratory Foundations of Computer Science Laboratory LOGO Programming Purpose In previous labs you experienced an imperative language (Karel) and a logic language (Prolog). In this lab you will learn a functional

More information

Lesson 13: Exploring Factored Form

Lesson 13: Exploring Factored Form Opening Activity Below is a graph of the equation y = 6(x 3)(x + 2). It is also the graph of: y = 3(2x 6)(x + 2) y = 2(3x 9)(x + 2) y = 2(x 3)(3x + 6) y = 3(x 3)(2x + 4) y = (3x 9)(2x + 4) y = (2x 6)(3x

More information

5. Selection: If and Switch Controls

5. Selection: If and Switch Controls Computer Science I CS 135 5. Selection: If and Switch Controls René Doursat Department of Computer Science & Engineering University of Nevada, Reno Fall 2005 Computer Science I CS 135 0. Course Presentation

More information

204111: Computer and Programming

204111: Computer and Programming 204111: Computer and Programming Week 4: Control Structures t Monchai Sopitkamon, Ph.D. Overview Types of control structures Using selection structure Using repetition structure Types of control ol structures

More information

Selection Statement ( if )

Selection Statement ( if ) Islamic University Of Gaza Faculty of Engineering Computer Engineering Department Lab 4 Selection Statement ( if ) Eng. Ibraheem Lubbad October 10, 2016 In this lab we will constructs program that allow

More information

5 The Control Structure Diagram (CSD)

5 The Control Structure Diagram (CSD) 5 The Control Structure Diagram (CSD) The Control Structure Diagram (CSD) is an algorithmic level diagram intended to improve the comprehensibility of source code by clearly depicting control constructs,

More information

CSE 546, Fall, 2016 Homework 1

CSE 546, Fall, 2016 Homework 1 CSE 546, Fall, 2016 Homework 1 Due at the beginning of class Thursday, Sept. 15 at 2:30pm. Accepted without penalty until Friday, noon, in my mailbox in the Dept. office, third floor of Jolley. Notes about

More information

Microsoft Visual Basic 2012: Reloaded

Microsoft Visual Basic 2012: Reloaded Microsoft Visual Basic 2012: Reloaded Fifth Edition Chapter Five More on the Selection Structure Objectives After studying this chapter, you should be able to: Determine whether a solution requires a nested

More information

EZware Quick Start Guide

EZware Quick Start Guide EZware Quick Start Guide Your Industrial Control Solutions Source www.maplesystems.com For use as the following: Evaluation Tool for Prospective Users Introductory Guide for New Customers Maple Systems,

More information

Selec%on and Decision Structures in Java: If Statements and Switch Statements CSC 121 Spring 2016 Howard Rosenthal

Selec%on and Decision Structures in Java: If Statements and Switch Statements CSC 121 Spring 2016 Howard Rosenthal Selec%on and Decision Structures in Java: If Statements and Switch Statements CSC 121 Spring 2016 Howard Rosenthal Lesson Goals Understand Control Structures Understand how to control the flow of a program

More information

Overview: Programming Concepts. Programming Concepts. Names, Values, And Variables

Overview: Programming Concepts. Programming Concepts. Names, Values, And Variables Chapter 18: Get With the Program: Fundamental Concepts Expressed in JavaScript Fluency with Information Technology Third Edition by Lawrence Snyder Overview: Programming Concepts Programming: Act of formulating

More information

Overview: Programming Concepts. Programming Concepts. Chapter 18: Get With the Program: Fundamental Concepts Expressed in JavaScript

Overview: Programming Concepts. Programming Concepts. Chapter 18: Get With the Program: Fundamental Concepts Expressed in JavaScript Chapter 18: Get With the Program: Fundamental Concepts Expressed in JavaScript Fluency with Information Technology Third Edition by Lawrence Snyder Overview: Programming Concepts Programming: Act of formulating

More information

Step 1 Turn on the device and log in with the password, PIN, or other passcode, if necessary.

Step 1 Turn on the device and log in with the password, PIN, or other passcode, if necessary. Working with Android Introduction In this lab, you will place apps and widgets on the home screen and move them between different home screens. You will also create folders to which apps will be added

More information

Test #2 October 8, 2015

Test #2 October 8, 2015 CPSC 1040 Name: Test #2 October 8, 2015 Closed notes, closed laptop, calculators OK. Please use a pencil. 100 points, 5 point bonus. Maximum score 105. Weight of each section in parentheses. If you need

More information

CS 115 Lecture 8. Selection: the if statement. Neil Moore

CS 115 Lecture 8. Selection: the if statement. Neil Moore CS 115 Lecture 8 Selection: the if statement Neil Moore Department of Computer Science University of Kentucky Lexington, Kentucky 40506 neil@cs.uky.edu 24 September 2015 Selection Sometime we want to execute

More information

LECTURE 5 Control Structures Part 2

LECTURE 5 Control Structures Part 2 LECTURE 5 Control Structures Part 2 REPETITION STATEMENTS Repetition statements are called loops, and are used to repeat the same code multiple times in succession. The number of repetitions is based on

More information

Announcements. HW 0 due tonight (check that it compiles on CSE labs) (make sure you submit the code part)

Announcements. HW 0 due tonight (check that it compiles on CSE labs) (make sure you submit the code part) Loops Ch 3.3-3.4 Announcements HW 0 due tonight (check that it compiles on CSE labs) (make sure you submit the code part) Scope (See last time: scope.cpp) If... if... else! When in doubt, use parenthesis

More information

ME 365 EXPERIMENT 3 INTRODUCTION TO LABVIEW

ME 365 EXPERIMENT 3 INTRODUCTION TO LABVIEW ME 365 EXPERIMENT 3 INTRODUCTION TO LABVIEW Objectives: The goal of this exercise is to introduce the Laboratory Virtual Instrument Engineering Workbench, or LabVIEW software. LabVIEW is the primary software

More information

while for do while ! set a counter variable to 0 ! increment it inside the loop (each iteration)

while for do while ! set a counter variable to 0 ! increment it inside the loop (each iteration) Week 7: Advanced Loops while Loops in C++ (review) while (expression) may be a compound (a block: {s) Gaddis: 5.7-12 CS 1428 Fall 2015 Jill Seaman 1 for if expression is true, is executed, repeat equivalent

More information

Lesson 18 Automatic door

Lesson 18 Automatic door Lesson 18 Automatic door 1 What you will need CloudProfessor (CPF) PIR (Motion) sensor Servo Arduino Leonardo Arduino Shield USB cable Overview In this lesson, students explore automated systems such as

More information

Graphing on Excel. Open Excel (2013). The first screen you will see looks like this (it varies slightly, depending on the version):

Graphing on Excel. Open Excel (2013). The first screen you will see looks like this (it varies slightly, depending on the version): Graphing on Excel Open Excel (2013). The first screen you will see looks like this (it varies slightly, depending on the version): The first step is to organize your data in columns. Suppose you obtain

More information

Comp 151. Control structures.

Comp 151. Control structures. Comp 151 Control structures. admin quiz this week believe it or not only 2 weeks from exam. one a week each week after that. idle debugger Debugger: program that will let you look at the program as it

More information

Logging Into OneNote. Desktop

Logging Into OneNote. Desktop On your laptop, click the windows button in the bottom left corner. Logging Into OneNote Desktop You will have a windows tile for OneNote 2016. If you do not have a tile for OneNote you can search for

More information

LN #2 (3 Hrs) Variables, Sequence Boolean Logic & Selection CTPS Department of CSE,Coimbatore

LN #2 (3 Hrs) Variables, Sequence Boolean Logic & Selection CTPS Department of CSE,Coimbatore LN #2 (3 Hrs) Variables, Sequence Boolean Logic & Selection CTPS 2018 Objectives To understand variables and their values. To study the computational structure, form and functional elements for sequence

More information

Lab1. Introduction to Python. Lab 4: Selection Statement. Eng. Mai Z. Alyazji

Lab1. Introduction to Python. Lab 4: Selection Statement. Eng. Mai Z. Alyazji Islamic University of Gaza Faculty of Engineering Computer Engineering Dept. Introduction to Computers Lab (ENGG 1003) Lab1 Introduction to Python Lab 4: Selection Statement Eng. Mai Z. Alyazji In this

More information

CS 302: INTRODUCTION TO PROGRAMMING. Lectures 7&8

CS 302: INTRODUCTION TO PROGRAMMING. Lectures 7&8 CS 302: INTRODUCTION TO PROGRAMMING Lectures 7&8 Hopefully the Programming Assignment #1 released by tomorrow REVIEW The switch statement is an alternative way of writing what? How do you end a case in

More information

CS 112 Midterm Exam Fall 2016

CS 112 Midterm Exam Fall 2016 Name: CS 112 Midterm Exam Fall 2016 B There are 7 problems on the exam. The first and last are mandatory, and you may eliminate any one of problems 2 6 by drawing an X through them. Problem 1 is worth

More information

COGS 119/219 MATLAB for Experimental Research. Fall 2016 Week 1 Built-in array functions, Data types.m files, begin Flow Control

COGS 119/219 MATLAB for Experimental Research. Fall 2016 Week 1 Built-in array functions, Data types.m files, begin Flow Control COGS 119/219 MATLAB for Experimental Research Fall 2016 Week 1 Built-in array functions, Data types.m files, begin Flow Control .m files We can write the MATLAB commands that we type at the command window

More information

Module 16: Data Flow Analysis in Presence of Procedure Calls Lecture 32: Iteration. The Lecture Contains: Iteration Space.

Module 16: Data Flow Analysis in Presence of Procedure Calls Lecture 32: Iteration. The Lecture Contains: Iteration Space. The Lecture Contains: Iteration Space Iteration Vector Normalized Iteration Vector Dependence Distance Direction Vector Loop Carried Dependence Relations Dependence Level Iteration Vector - Triangular

More information

Sequence Types FEB

Sequence Types FEB Sequence Types FEB 23-25 2015 What we have not learned so far How to store, organize, and access large amounts of data? Examples: Read a sequence of million numbers and output these in sorted order. Read

More information

CSC 121 Spring 2017 Howard Rosenthal

CSC 121 Spring 2017 Howard Rosenthal CSC 121 Spring 2017 Howard Rosenthal Agenda To be able to define computer program, algorithm, and highlevel programming language. To be able to list the basic stages involved in writing a computer program.

More information

Contents. What is the purpose of this app?

Contents. What is the purpose of this app? Contents What is the purpose of this app?... 1 Setup and Configuration... 3 Guides... 4 nhanced 365 Panels and Tiles... 4 nhanced 365 Fields and Tables... 9 nhanced 365 Views... 12 What is the purpose

More information

Table of Contents WINDOWS 95. What is Windows 95? Features LINC TWO

Table of Contents WINDOWS 95. What is Windows 95? Features LINC TWO Table of Contents What is Windows 95? Windows 95 is a computer-operating system that controls the basic operation of the computer and the programs (also known as applications or software tools) that run

More information