A little Boolean Logic. IF loving you is wrong THEN I dont want to be right.

Slides:



Advertisements
Similar presentations
The Important Thing About By. The Important Thing About ******** The important thing about ***** is *****. It is true s/he can *****, *****, and *****.
Advertisements

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.
Chapter 4: Control Structures I (Selection)
Chapter 4 - Control Statements
Thinking out loud. Traffic Scenario 1A 2B 2A 1B How would you set up the intersection? An exercise in Monday morning quarterbacking.
IF statement (i) Single statement. IF ( logical expression ) statement Example: read(*,*) a if (a. lt. 0) a = -a write(*,*) a Or read(*,*) a if (a < 0)
Computer Programming 12 Mr. Jean April 2 nd, 2014.
Logical Operators and While Loops CS303E: Elements of Computers and Programming.
PHYS707: Special Topics C++ Lectures Lecture 2. Summary of Today’s lecture: 1.More data types 2.Flow control (if-else, while, do-while, for) 3.Brief introduction.
Lecture 3: Control Structures - Selection BJ Furman 10SEP2012.
The "if structure" is used to execute statement(s) only if the given condition is satisfied.
Computer Science & Engineering 2111 IF and Boolean Functions 1 CSE 2111 Lecture-IF and Boolean Functions.
CS&E 1111 ExIFs IFs and Nested IFs in Excel Objectives: Using the If function in spreadsheets Nesting If functions.
Biconditionals & Counterexamples Geometry Chapter 02 A BowerPoint Presentation.
Notes on Logic Continued
A Quick Look at Quantified Statements. Why are Quantified Statements Important? The logical structure of quantified statements provides a basis for the.
Chapter 6 Horstmann Programs that make decisions: the IF command.
Section 4.2: Functions that Test Conditions (continued)
2-1 Making Decisions Sample assignment statements PayAmount = Hours * Rate PayAmount = 40*Rate + (Hours – 40)*Rate*1.5.
© Janice Regan, CMPT 102, Sept CMPT 102 Introduction to Scientific Computer Programming Logical and Relational Expressions Nested if statements.
Programming with MATLAB. Relational Operators The arithmetic operators has precedence over relational operators.
Chapter 9 IF Statement Bernard Chen. If Statement The main statement used for selecting from alternative actions based on test results It’s the primary.
Think about the following expression If the number entered is greater than 15 but less than 25 or the number is 100 and the letter chosen is after p but.
XOR and XNOR Logic Gates. XOR Function Output Y is TRUE if input A OR input B are TRUE Exclusively, else it is FALSE. Logic Symbol  Description  Truth.
1. We’ve learned that our programs are read by the compiler in order, from top to bottom, just as they are written The order of statement execution is.
110-G1 Motivation: Within a program, may have to perform the same computation over and over Many programs share the same computation (e.g. sorting) To.
Logic Disjunction A disjunction is a compound statement formed by combining two simple sentences using the word “OR”. A disjunction is true when at.
Boolean expressions, part 2: Logical operators. Previously discussed Recall that there are 2 types of operators that return a boolean result (true or.
If…else statements. Boolean Expressions Boolean expression - An expression whose value is either true or false true = 1 false = 0 Datatype: boolean.
Conditional Expression One of the most useful tools for processing information in an event procedure is a conditional expression. A conditional expression.
CSC115 Introduction to Computer Programming Zhen Jiang Dept. of Computer Science West Chester University West Chester, PA 19383
Logic and Reasoning Conditional Statements. Logic The use and study of valid reasoning. When studying mathematics it is important to have the ability.
Nested Statements Excel Discovery By Sam Griffiths.
ITEC 109 Lecture 11 While loops. while loops Review Choices –1 st –2 nd to ?th –Last What happens if you only use ifs? Can you have just an else by itself?
Conditional Statements and the Converse Geometry Unit 11, Day 7 Ms. Reed.
Boolean Values The true story ;=P. Expressions.
The Fine Points of Conditionals. When squirrels get together for a party, they like to have cigars. A squirrel party is successful when the number of.
A: A: double “4” A: “34” 4.
“If John studies then he will get an A.” s a s a F F T F T T T T T T F F.
Shortcoming of the FOR-DO loop When you use the FOR-DO loop you must know how many times you want to perform an action. What if you didn’t know how many.
Lesson thirteen Conditional Statement "if- else" ©
Conditional statements and boolean expressions Arithmetic, relational and logical operators.
Control Structure  What is control Structure?  Types of Controls  Use the control structure in VBScript.  Example Summery.
Structure Based Test Design
IF Statements flowcharts and pseudocode Please open the speaker notes - they contain additional information!
Computer Science 1000 LOGO II. Boolean Expressions like Excel and Scratch, LOGO supports three Boolean operators less than (
Chapter 1 – Part 3 ELEMENTARY LOGIC
Conditional Statements
Sequence, Selection, Iteration The IF Statement
Thinking out loud.
Shortcoming of the FOR-DO loop
CSC115 Introduction to Computer Programming
And the text with form..
JavaScript conditional
2-1 Making Decisions Sample assignment statements
Computers & Programming Languages
DESICION TABLE Decision tables are precise and compact way to model complicated logic. Decision table is useful when input and output data can be.
Created by: Alexis Wallace
IF Statements.
Visual Basic – Decision Statements
Conditional Logic Presentation Name Course Name
Lecture Notes – Week 2 Lecture-2
© T Madas.
C.2.10 Sample Questions.
C.2.8 Sample Questions.
Conditional Statements
C.2.8 Sample Questions.
Calculate 81 ÷ 3 = 27 3 x 3 x 3 3 x 3 x 3 x 3 ÷ 3 = This could be written as
Flow of Control Flow of control is the order in which a program performs actions. Up to this point, the order has been sequential. A branching statement.
True or False True or False
Presentation transcript:

A little Boolean Logic

IF loving you is wrong THEN I dont want to be right

IF-THEN Statements If, Then, Else (a.k.a. Otherwise) What is your procedure? In excel this is written as : IF(Condition, True Value, False Value)

Sample Problem 1 If a driver is going over 65 mph a speeding ticket should be issued.

Sample Problem 1 Yes Speed > 65 No Issue Ticket No Ticket

Sample Problem 1 Speed Caught TravelingAction To Be Taken 65Issue Ticket 55No Ticket Speed Caught TravelingAction To Be Taken 65=IF(A11<65,"No Ticket","Issue Ticket") 55=IF(A12<65,"No Ticket","Issue Ticket")

Nested IF-THEN Statements What if you have a second condition? IF(Cond, True,IF(Cond, True, False))

Sample Problem 2 If a driver is going over 65 mph or under 45 mph a speeding ticket should be issued.

Sample Problem 2 Yes Speed < 40 No Issue Ticket Speed > 65 YesNo Issue TicketNo Ticket

Nested IF-THEN Statements Speed 65Ticket 14Ticket 55No Ticket Speed 65=IF(A11>64,"Ticket",IF(A11<40,"Ticket","No Ticket")) 14=IF(A12>64,"Ticket",IF(A12<40,"Ticket","No Ticket")) 55=IF(A13>64,"Ticket",IF(A13<40,"Ticket","No Ticket"))

Using Formulas 1.Highlight the cell you want to write a formula for. 2.Click into the formula bar and type the operation you wish to perform 3.Remember you must always start a formula with an =

Formula Notations * = multiplication ^ = raise to the power of / = divide by +/- = addition/subtraction ( ) = parenthesis very important for order of operation

Functions Excel has tons of built in functions to perform everything from rounding to advanced statistical tests.

Lets kick it up a notch! 1A 2B 2A 1B

Directions Break the problem into steps and verbalize what you want to do with your partner. Draw a flow chart that outlines your solution Add columns to your spread sheet and perform to perform the necessary calculations in stages

Data Table Traffic Lane Max Length of Light Minimum Length of Light Time for car to clear intersection # Of Cars Time Needed Time Given (s) # Of Cars Leftover Lane 1A Lane 1B Lane 2A Lane 2B

Bam! Bam! Bam! 1A 1B 2 3 3

Tips Break the problem into steps and verbalize what you want to do with your partner. Draw a flow chart that outlines your solution Add columns to your spread sheet and perform to perform the necessary calculations in stages

Reflection How did you attack this problem? What helped you in solving the problem? Where did you get lost or stuck?

What was this activity about?

Problem Solving Step 1: What am I trying to find? Step 2: What information do I know? Step 3: What equation will I use? Step 4a: Do I need to solve for any other information? Step 4b: Pick equations to solve for missing variables. Will this work? Step 5: Plug in all the information and crunch the numbers Step 6: Display your answer and ask does this answer make sense? If No If Yes