Section 4.2: Functions that Test Conditions (continued)

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

Question #1 Start Question #2 Question #3 Question #4 Question #5 Question #7 Question #6 Question #8 Question #9 Question #10 Final Question.
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.
Warm Up Example 1 Check whether the ordered pair is a solution of 2x – 3y > -2 a.(0,0) 2(0)-3(0)> -2 0> -2 True b.(0,1) 2(0)-3(1)> -2 -3> -2 False.
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.
The "if structure" is used to execute statement(s) only if the given condition is satisfied.
Children Aged 5 to
CSC 142 G 1 CSC 142 Conditionals [Reading: chapter 5]
Internet Safety Jeopardy
July 13 th.  If/ Else if / Else  Variable Scope  Nested if/else's  Switch statements  Conditional Operator.
CSC 160 Computer Programming for Non-Majors Lecture #9: Booleans Prof. Adam M. Wittenstein
Section 6.1: Structures (continued). Example 1: in-left-side? ; Purpose: To determine whether a point is in the leftmost 150 pixels of the screen. ; Contract.
True/False. False True Subject May Go Here True / False ? Type correct answer here. Type incorrect answer here.
Boolean Algebra Module M4.1 Section 5.1. Boolean Algebra and Logic Equations Switching Algebra Theorems Venn Diagrams.
CSC 160 Computer Programming for Non-Majors Chapter 4: Conditional Expressions and Functions Prof. Adam M. Wittenstein
 x (x 2  0) 1. True2. False.  x (3x + 2 = 12) 1. True2. False.
Determine whether each curve below is the graph of a function of x. Select all answers that are graphs of functions of x:
Generalized De Morgan’s Theorem Lecture L5.4 Section 5.1.
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.
Apply Properties of Rational Exponents
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.
AP Statistics Section 6.3C More Conditional Probability.
BASIC LOGIC GATES. In studying digital in integrated circuits, one must start with the simples group of circuits, the SSIs or Small Scale Integrated Circuits.
TABLES AND VALUES Section 1.5. Open Sentence Equation.
Multiplication of Real Numbers Section 2.5. Multiplying Rules 1) If the numbers have the same signs then the answer is positive. (-7) (-4) = 28 2) If.
Basic Definitions of Set Theory Lecture 24 Section 5.1 Fri, Mar 2, 2007.
4 Themes of S.S. HistoryGeographyEconomicsCivics and Government Culture and Society
A: A: double “4” A: “34” 4.
Conditional statements and boolean expressions Arithmetic, relational and logical operators.
System of Two Linear Inequalities (section 6.6) Today’s Objective: I can graph a system of two linear inequalities.
Title Category #1 Category #2 Category #3Category #
Section 11-7 Ratios of Areas.
4-1 LOGIC OPERATIONS In Chapter 3 we discussed the fact that data inside a computer is stored as patterns of bits. Logic operations refer to those operations.
Factors, multiple, primes: Factors from prime factors
Review Operation Bingo
Computers & Programming Languages
البرمجة بلغة الفيجول بيسك ستوديو
Who Wants To Be A Millionaire?
Section 5-1 Parallelograms.
Propositional Equivalences Rosen 5th and 6th Editions section 1.2
Name Not Precise Enough
DESICION TABLE Decision tables are precise and compact way to model complicated logic. Decision table is useful when input and output data can be.
GCSE English Language: Exam Paper Outline
Factors, multiple, primes: Prime factors
True or False: {image} is one-to-one function.
4105 CHALLENGING REVIEW QUIZ
SECTION 2-4 : SOLVING EQUATIONS WITH THE VARIABLE ON BOTH SIDES
Lecture 5 Binary Operation Boolean Logic. Binary Operations Addition Subtraction Multiplication Division.
Truth tables Mrs. Palmer.
Evaluating Boolean expressions
C# Revision Cards Data types
Systems of Linear Equations: An Introduction
© T Madas.
Millennium High School Agenda Calendar
Millennium High School Agenda Calendar
Millennium High School Agenda Calendar
Composition & Inverses Review
Chapter 2 Sets Active Learning Lecture Slides
Inequalities TRUE FALSE.
Factors, multiple, primes: Multiples
Fractions: Simplifies to a unit fraction?
Division of Real Numbers
Standard Form: Multiplying powers of 10
If there is any case in which true premises lead to a false conclusion, the argument is invalid. Therefore this argument is INVALID.
MENTAL MATH Here We Go….
Standard form: In standard form?
True or False True or False
Coordinates: Naming 2D coordinates – quadrant 1
If there is any case in which true premises lead to a false conclusion, the argument is invalid. Therefore this argument is INVALID.
Exercise (6).
Presentation transcript:

Section 4.2: Functions that Test Conditions (continued)

Another Boolean-valued function ;Purpose ;To determine if someone is between 18 and 25. ;Contract ;18-to-25? : number -> boolean “Examples of 18-to-25?:” (18-to-25? 17) “should be” false (18-to-25? 48) “should be” false (18-to-25? 21) “should be” true (18-to-25? 18) “should be” true (18-to-25? 25) “should be” true

Another Boolean-valued function ; 18-to-25? : number -> boolean (define (18-to-25? age) … age …)) “Examples of 18-to-25?:” (18-to-25? 17) “should be” false (18-to-25? 48) “should be” false (18-to-25? 21) “should be” true (18-to-25? 18) “should be” true (18-to-25? 25) “should be” true

Another Boolean-valued function ; 18-to-25? : number -> boolean (define (18-to-25? age) … (>= age 18) … (<= age 25) …) “Examples of 18-to-25?:” (18-to-25? 17) “should be” false (18-to-25? 48) “should be” false (18-to-25? 21) “should be” true (18-to-25? 18) “should be” true (18-to-25? 25) “should be” true

Another Boolean-valued function ; 18-to-25? : number -> boolean (define (18-to-25? age) (and (>= age 18) (<= age 25))) “Examples of 18-to-25?:” (18-to-25? 17) “should be” false (18-to-25? 48) “should be” false (18-to-25? 21) “should be” true (18-to-25? 18) “should be” true (18-to-25? 25) “should be” true

Next time… Writing Conditional Functions