DOC PREVIEW
TRINITY CSCI 1311 - Conditionals and Boolean Logic
Pages 8

This preview shows page 1-2-3 out of 8 pages.

Save
View full document
View full document
Premium Document
Do you want full access? Go Premium and unlock all 8 pages.
Access to all documents
Download any document
Ad free experience
View full document
Premium Document
Do you want full access? Go Premium and unlock all 8 pages.
Access to all documents
Download any document
Ad free experience
View full document
Premium Document
Do you want full access? Go Premium and unlock all 8 pages.
Access to all documents
Download any document
Ad free experience
Premium Document
Do you want full access? Go Premium and unlock all 8 pages.
Access to all documents
Download any document
Ad free experience

Unformatted text preview:

Slide 1Slide 2Slide 3Slide 4Slide 5Slide 6Slide 7Slide 8Conditionals and Boolean Logic9/16/2009Opening Discussion●Do you have any questions about the quiz?●How is the reading going? Please suggest changes or let me know when you find errors/typos.●Minute Essays–Loops are next week–Basic Java environments: BlueJ.–Doing unrelated things is distracting to others.–Answers of ICPs.Our Problem●The walkToward method has a problem if dx or dy are zero. Specifically, we get a division by zero exception.●We only want to do the division if the value is greater than zero.●We might also want the person to do something when it gets where it is going.Conditional Execution●Methods execute by having the statements happen in order.●Right now, all the statements in a method will happen any time that method is invoked.●We need the ability to make it so that some things only happen some of the time. This is called conditional execution.●The simplest conditional is the if statement.Syntax of if●We will normally write an if statement with the following syntax.–if(condition) {●statements–} [ else {●statements–} ]●The statements only execute if the condition is true.●Else is optional executes if condition is false.Comparison Operators●If you want to compare two numbers use the following.–== for equality. Note there are two of them.–!= for inequality.–>, <, >=, <= for what they look like.●With objects you generally want to call the equals method.–if(v1.equals(v2)) ...Boolean Logic●We only want the person to enter the house if both dx and dy are zero. To do this we use Boolean logic.●Logic operators–|| is inclusive or.–&& is and.–! is not.●Let's look at truth tables for these.●Use parentheses to group things.Minute Essay●Do you have any questions about conditionals or Boolean logic?●The next round of interclass problems will be this coming


View Full Document

TRINITY CSCI 1311 - Conditionals and Boolean Logic

Course: Csci 1311-
Pages: 8
Documents in this Course
Arrays

Arrays

12 pages

Arrays

Arrays

10 pages

Applets

Applets

5 pages

Arrays

Arrays

8 pages

Methods

Methods

12 pages

Drawing

Drawing

8 pages

Load more
Download Conditionals and Boolean Logic
Our administrator received your request to download this document. We will send you the file to your email shortly.
Loading Unlocking...
Login

Join to view Conditionals and Boolean Logic and access 3M+ class-specific study document.

or
We will never post anything without your permission.
Don't have an account?
Sign Up

Join to view Conditionals and Boolean Logic 2 2 and access 3M+ class-specific study document.

or

By creating an account you agree to our Privacy Policy and Terms Of Use

Already a member?