Compound Conditional Logic

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

Computer Programming 12 Mr. Jean April 2 nd, 2014.
Tutorial 4 Decision Making with Control Structures and Statements Section A - Decision Making JavaScript Tutorial 4 -Decision Making with Control.
Warm Up Explain how to simplify the expression 27 ÷ (9 + 6) + 7 = f
3.1 EXPONENTS. LESSON 3.1 RECALL 5 3 = 5 x 5 x 5 = 125 Write the Base (5) Write the Base the number of time as the Power ( 3 ) Multiply the numbers together.
Computer Science: A Structured Programming Approach Using C1 Objectives ❏ To understand how decisions are made in a computer ❏ To understand the logical.
1 Karel – Chapter 5 Conditionally Executing Instructions Note: Original slides provided by and modified for Mr. Smith’s AP Computer.
Computer Science: A Structured Programming Approach Using C1 5-2 Two-Way Selection The decision is described to the computer as a conditional statement.
Computer Science: A Structured Programming Approach Using C1 5-2 Two-Way Selection The decision is described to the computer as a conditional statement.
Python Mini-Course University of Oklahoma Department of Psychology Day 2 – Lesson 7 Conditionals and Loops 4/18/09 Python Mini-Course: Day 2 - Lesson 7.
Exponent Quiz Review. Evaluate the expression 4 2  Answer: 16.
The Need for Algorithms
Canvas and Arrays in Apps
HTTP and Abstraction on the Internet
Lesson 1-15 AP Computer Science Principles
Unit 5 Lesson 3: Introduction to Arrays
HTTP and Abstraction on the Internet
Finding Trends with Visualizations
Lesson 2-9 AP Computer Science Principles
Seven Habits – Habit 3.
Sequence, Selection, Iteration The IF Statement
Section 7.1 Logical Operators
Topic: Conditional Statements – Part 2
Creating Functions with Parameters
Functions and Top-Down Design
Selection—Making Decisions
Lesson 5-15 AP Computer Science Principles
Building an App: Color Sleuth
Get your computer. Log in but go no further.
Chapter 5 Decisions. Chapter 5 Decisions ssential uestion: How are Boolean expressions or operators used in everyday life?
Rapid Research - Data Innovations
Looping and Random Numbers
Lesson 2-9 AP Computer Science Principles
SECTION 1-2 : ORDER OF OPERATIONS and EVALUATING EXPRESSIONS
Sending Bits on the Internet
Expressions and Control Flow in JavaScript
Lesson 9: "if-else-if" and Conditional Logic
Lesson 8: Boolean Expressions and "if" Statements
Types, Truth, and Expressions (Part 2)
Stand Quietly.
UNIT 3 CHAPTER 1 LESSON 4 Using Simple Commands.
“Day E” May 9, :01 - 9:01 Math 9: :03 Science
HAPPY NEW YEAR! Lesson 7: If-statements unplugged
During the last lecture we had a discussion on Data Types, Variables & Operators
Agenda Warm-up Lesson 2 hw corrections Lesson 3 hw questions? Lesson 4
Math Talk: Mental computation
“Day F” May 10, :01 - 9:01 Exploratory 9: :03 10:05 -11:05
Visual Basic – Decision Statements
Warm-up: Simplify (x3 – 27) ÷ (x – 3) 2. 3.
Evaluate the limit: {image} Choose the correct answer from the following:
if-else Structures Principles of Engineering
Monday, November 6th Fill in your agenda with:
Bellwork~Simplify 1.) 90 2.) 32 3.) 45 4.) 162.
“Day F” November 30, :51 - 8:51 Exploratory 8:53 - 9:53
When do we make decisions?
“Day B” October 28, :51 - 8:51 Exploratory 8:53 - 9:53
Chapter 4: Boolean Expressions, Making Decisions, and Disk Input and Output Prof. Salim Arfaoui.
“Day B” Monday December 7, 2015
Selection—Making Decisions
“Day E” December 8, :01 - 9:01 Math 9: :03 Science
Exploratory Social Studies English Math Express 3rd LUNCH Science Math
“Day C” January 9, :01 - 9:01 Math 9: :03 Science
Advisory Lessons Westport Middle School
“Day A” February 11, :51 - 8:51 Math 8:53 - 9:53 Science
“Day E” February 7, :51 - 8:51 Math 8:53 - 9:53 Science
Plenary
Dear Power point User, This power point will be best viewed as a slideshow. At the top of the page click on slideshow, then click from the beginning.
How do I add and subtract complex numbers?
Warm-Up Look over your vocabulary terms on your flipbook and your properties in your notebook. Be sure to keep these out on your desk for the activity.
Presentation transcript:

Compound Conditional Logic Lesson 3-20 AP Computer Science Principles

Objectives Students will be able to: Evaluate compound conditionals composed of AND, and OR, and NOT operators. Write if statements in JavaScript that use boolean operators &&, || and !. Use AND, OR, and NOT operators to simplify the expression of compound boolean logic within a program.

Review Complete page 1 of the Compound Conditionals Worksheet. Review your answers with someone else: Is my partner’s solution correct? Is my partner’s solution different from my own in any way? Are there ways we could improve our solutions?

If the day is any day but “Monday” the program writes “At least it’s not Monday”

If the user is a teenager the program writes “You are a teenager” If the user is a teenager the program writes “You are a teenager”. Otherwise it writes “You are not a teenager”

If the day is a weekend day the program writes “It is the weekend” If the day is a weekend day the program writes “It is the weekend”. Otherwise it writes “It is not the weekend”.

Compound Conditionals Nested and chained conditionals are important tools when designing boolean conditions in our programs. In fact, every boolean condition can be expressed in some way using nesting and chained conditionals. That said, often when we write out these solutions they are long or force us to write redundant code. Today were are going to learn some new tools that won’t let us write any new conditions, but WILL allow us to write many complex conditions much more clearly.

Video

Compound Conditionals Worksheet and Stage 20 Complete pages 2-4 of the Compound Conditionals Worksheet. When done complete Stage 20.

Wrap-up What’s the trickiest logical statement you encountered in this lesson?  What made it tricky?