Introduction to Logic and Conditional Block Dr. José M. Reyes Álamo.

Slides:



Advertisements
Similar presentations
Decision Structures - If / Else If / Else. Decisions Often we need to make decisions based on information that we receive. Often we need to make decisions.
Advertisements

CIS101 Introduction to Computing Week 12. Agenda Your questions Solutions to practice text Final HTML/JavaScript Project Copy and paste assignment JavaScript:
July 13 th.  If/ Else if / Else  Variable Scope  Nested if/else's  Switch statements  Conditional Operator.
CSE115: Introduction to Computer Science I Dr. Carl Alphonce 219 Bell Hall Office hours: M-F 11:00-11:
The UNIVERSITY of NORTH CAROLINA at CHAPEL HILL Adrian Ilie COMP 14 Introduction to Programming Adrian Ilie July 6, 2005.
COMP 14 Introduction to Programming Miguel A. Otaduy May 21, 2004.
If Statements Sections 1.25, Control Structures o All code thus far executes every line of code sequentially o We want to be able to repeat,
Tutorial 4 Decision Making with Control Structures and Statements Section A - Decision Making JavaScript Tutorial 4 -Decision Making with Control.
Selection and Testing Shirley Moore CS 1401 Spring 2013 February 21 and 26,
EMT1111 Logic and Problem Solving Dr. José M. Reyes Álamo Lecture 1.
EMT1111 Logic and Problem Solving Fall 2012 Dr. José M. Reyes Álamo Lecture 1.
COMP 1001: Introduction to Computers for Arts and Social Sciences Programming in Scratch Monday, May 16, 2011.
EMT1111 Logic and Problem Solving Dr. José M. Reyes Álamo Lecture 1.
EMT1111 Logic and Problem Solving Dr. José M. Reyes Álamo Lecture 1.
CSCI 3328 Object Oriented Programming in C# Chapter 5: C# Control Statement – Part II UTPA – Fall
PAGES:51-59 SECTION: CONTROL1 : DECISIONS Decisions.
Variables, operators, canvas, and multimedia Dr. José M. Reyes Álamo.
CONTROL STRUCTURE The if, elseif, and else & switch Statements 1.
CONTROLLING PROGRAM FLOW
1 Week 2: Variables and Assignment Statements READING: 1.4 – 1.6 EECS Introduction to Computing for the Physical Sciences.
Loops, Databases, Procedures, and Lists Dr. José M. Reyes Álamo.
PHP Logic. Review: Variables Variables: a symbol or name that stands for a value – Data types ( Similar to C++ or Java): Int, Float, Boolean, String,
If…else statements. Boolean Expressions Boolean expression - An expression whose value is either true or false true = 1 false = 0 Datatype: boolean.
Branches and Program Design
Copyright 2003 Scott/Jones Publishing Making Decisions.
EMT 2390L Lecture 9 Dr. Reyes Reference: The Linux Command Line, W.E. Shotts.
Copyright © 2012 Pearson Education, Inc. Chapter 4: Making Decisions.
Software Engineering Principles Dr. José M. Reyes Álamo.
Java Decision Making and booleans (Java: An Eventful Approach, Ch 4), Slides Credit: Bruce, Danyluk and Murtagh CS 120 Lecture October 2012.
Lecture 2 Conditional Statement. chcslonline.org Conditional Statements in PHP Conditional Statements are used for decision making. Different actions.
Chapter 15 JavaScript: Part III The Web Warrior Guide to Web Design Technologies.
Chapter 51 Logical Operators Used with Boolean expressions Not – makes a False expression True and vice versa And – will yield a True if and only if both.
Chapter 51 Decisions Relational and Logical Operators If Blocks Select Case Blocks.
Variables, operators, canvas, and multimedia Dr. José M. Reyes Álamo.
Copyright 2003 Scott/Jones Publishing Standard Version of Starting Out with C++, 4th Edition Chapter 4 Making Decisions.
Basic Conditions. Challenge: ● Ask the user his/her name ● If it’s “Wally,” jeer him ● Pause video and try on your own.
CST336, Dr. Krzysztof Pietroszek Week 2: PHP. 1.Introduction to PHP 2.Embed PHP code into an HTML web page 3.Generate (output HTML) web page using PHP.
Chapter 3 Decisions Three control structures Algorithms Pseudocode Flowcharts If…then …else Nested if statements Code blocks { } multi statement blocks.
COMP Loop Statements Yi Hong May 21, 2015.
Chapter 7: The Repetition Structure Introduction to Programming with C++ Fourth Edition.
CSCI/CMPE 4341 Topic: Programming in Python Chapter 4: Control Structures (Part 2) Xiang Lian The University of Texas – Pan American Edinburg, TX
Conditional statements and boolean expressions Arithmetic, relational and logical operators.
Control Flow (Python) Dr. José M. Reyes Álamo. 2 Control Flow Sequential statements Decision statements Repetition statements (loops)
IST 210: PHP LOGIC IST 210: Organization of Data IST210 1.
Variables, operators, canvas, and multimedia Dr. Reyes.
Control Flow (Python) Dr. José M. Reyes Álamo. 2 Control Flow Sequential statements Decision statements Repetition statements (loops)
Chapter 7 Control Structures. Java has very flexible three looping mechanisms. You can use one of the following three loops:  while Loop  do...while.
Conditional Statements A conditional statement lets us choose which statement will be executed next Conditional statements give us the power to make basic.
IST 210: PHP Logic IST 210: Organization of Data IST2101.
PHP Condtions and Loops Prepared by Dr. Maher Abuhamdeh.
Control Flow (Python) Dr. José M. Reyes Álamo.
Chapter 4: Making Decisions.
CiS 260: App Dev I Chapter 4: Control Structures II.
JavaScript: Control Statements.
JavaScript: Control Statements I
SELECTION STATEMENTS (1)
Microsoft Visual Basic 2005 BASICS
Loops, Databases, Procedures, and Lists
Computers & Programming Languages
Variables, operators, canvas, and multimedia
Lecture Notes – Week 3 Lecture-2
Pages:51-59 Section: Control1 : decisions
Chapter 8: More on the Repetition Structure
Introduction To Robot Decision Making
Computer Science Core Concepts
Relational Operators.
Pages:51-59 Section: Control1 : decisions
Types, Truth, and Expressions (Part 2)
Software Engineering and Animations
Presentation transcript:

Introduction to Logic and Conditional Block Dr. José M. Reyes Álamo

2 Pending Items Post the following Labs into your OpenLab portfolio ASAP: –Android Zoo App –PaintPot –I started grading and most of you don’t have them. You must post them by midnight to get credit before I do my final round of grading. Post you final project idea into your OpenLab portfolio with the following information: –App you are planning to develop –Your team member –Even though you will work in groups, portfolios will be graded individually.

3 Outline Boolean expressions Relational operators If and Ifelse statement

Boolean Expression

5 AND operator AND operators (&) = All statements must be TRUE for the operation to be TRUE. STATEMENT 1STATEMENT 2AND Example: Check if the following operation is TRUE or FALSE X>10 & Y 10 & Y<=-4 If X = 11 and Y = 1 11>10 & 1 10 & 1<=- 4 If X=20 and Y >10 & & -10<=-4 TRUE AND FALSE TRUE FALSE TRUE

6 OR operator OR operators (|) = At least one statement must be TRUE for the operation to be TRUE. STATEMENT 1STATEMENT 2OR Example: Check if the following operation is TRUE or FALSE X>10 || Y 10 || Y<=-4 If X = 11 and Y = 1 11>10 || 1 10 || 1<=- 4 If X=2 and Y =2 2 >10 || 2 10 || 2<=- 4 TRUE OR FALSE TRUE FALSE

7 NOT operator NOT operator (!, ~) = Inverts the Boolean value of a variable or expression. STATEMENT 1NOT

Logic Control if – if-else statement

9 If and ifelse statement Test statement If test statement is TRUE, then do the following… If test statement is TRUE, then do the following.. If test statement is FALSE, then do the following… If test statement is FALSE, skip the if statement

10 Algorithm – Pseudo Code // Use if statement to check the default size. defaultSize = 5; smallSize = 3; bigSize = 8; If defaultSize 3 Display in LabelResult = The dot size is set to default; end

11 ASSIGNMENTS Idea for final project due TODAY IN CLASS LAB: –LAB9 QuizMeQuizMe READING ASSIGNMENTS: –AppInventor CH20 (Repeating Blocks)AppInventor CH20 (Repeating Blocks) –AppInventor CH22 (Working with Databases)AppInventor CH22 (Working with Databases) READING ASSIGNMENT EVALUATION: –Complete the reading assignments (2 CHAPTERS) and answer the RA10_AppInventorCh20andCh22 on Blackboard. First draft for final project due NEXT WEEK.