1 / 11

Introduction to Logic and Conditional Block

Introduction to Logic and Conditional Block. Dr. José M. Reyes Álamo. Pending Items. Post the following Labs into your OpenLab portfolio ASAP: Android Zoo App PaintPot

drea
Download Presentation

Introduction to Logic and Conditional Block

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. 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

  4. Boolean Expression

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

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

  7. NOT operator • NOT operator (!, ~) = Inverts the Boolean value of a variable or expression. NOT STATEMENT 1 ! TRUE = FALSE ! FALSE = TRUE !(11>10)= FALSE

  8. Logic Controlif – 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<8 &&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 QuizMe • READING ASSIGNMENTS: • AppInventor CH20 (Repeating Blocks) • 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.

More Related