# Lecture12 - Lecture 12 Project 3 Predicates and Conditional...

This preview shows pages 1–16. Sign up to view the full content.

Engineering 101 Engineering 101 Lecture 12 Lecture 12 Project 3, Predicates and Conditional Project 3, Predicates and Conditional Expressions Expressions Prof. Michael Falk University of Michigan, College of Engineering

This preview has intentionally blurred sections. Sign up to view the full version.

View Full Document
Announcements Announcements Exam 1 Tonight at 7pm. Room Assignment by First Letter of Last Name A-G IOE 1610 H-O FXB 1109 P-U CSE 1670 V-Z CSE 1690
Announcements Announcements You may bring your book, notes, or any other materials you desire. You may bring a calculator. If you have questions about the exam ask the proctor (me or a GSI). You may not communicate with each other or anyone other than the proctor during the exam.

This preview has intentionally blurred sections. Sign up to view the full version.

View Full Document
Logical and Relational Operators Logical and Relational Operators Relational Operators <, >, >=, <=, ==, != Logical Operators (true and true) == true (true and false) == false (false and false) == false (true or true) == true (true or false) == true (false or false) == false
Exercise 1 Exercise 1 Evaluate the Expression 1==2==0 and not (9%3)

This preview has intentionally blurred sections. Sign up to view the full version.

View Full Document
Exercise 1 Exercise 1 Evaluate the Expression 1==2==0 and not 0
Exercise 1 Exercise 1 Evaluate the Expression 1==2==0 and 1

This preview has intentionally blurred sections. Sign up to view the full version.

View Full Document
Exercise 1 Exercise 1 Evaluate the Expression 0 ==0 and 1
Exercise 1 Exercise 1 Evaluate the Expression 1 and 1

This preview has intentionally blurred sections. Sign up to view the full version.

View Full Document
Exercise 1 Exercise 1 Evaluate the Expression 1 (true)
Using operators to construct Using operators to construct conditional expressions conditional expressions Start on some given day. While the day is not a weekend, add 8 hours to my timeclock and work, otherwise rest. 1 2 3 4 5 6 7 8 9 10 1112 13 14 15 16 17 18 19 Su M T W Th F Sa 20 2122 23 24 25 26 27 28 29 30 31

This preview has intentionally blurred sections. Sign up to view the full version.

View Full Document
Using operators to construct Using operators to construct conditional expressions conditional expressions 1 2 3 4 5 6 7 8 9 10 1112 13 14 15 16 17 18 19 Su M T W Th F Sa 20 2122 23 24 25 26 27 28 29 30 31 int Sun=0, Mon=1, Tue=2, Wed=3, Thu=4, Fri=5, Sat=6; int firstday= Tue; int timeclock=0, day = 9; firstday tells which day of the week the first day of the month falls upon
Using operators to construct Using operators to construct conditional expressions conditional expressions 1 2 3 4 5 6 7 8 9 10 1112 13 14 15 16 17 18 19 Su M T W Th F Sa 20 2122 23 24 25 26 27 28 29 30 31 int Sun=0, Mon=1, Tue=2, Wed=3, Thu=4, Fri=5, Sat=6; int firstday= Tue; int timeclock=0, day = 9; How do we determine whether it is a weekday?

This preview has intentionally blurred sections. Sign up to view the full version.

View Full Document
Using operators to construct Using operators to construct conditional expressions conditional expressions 1 2 3 4 5 6 7 8 9 10 1112 13 14 15 16 17 18 19 Su M T W Th F Sa 20 2122 23 24 25 26 27 28 29 30 31 int Sun=0, Mon=1, Tue=2, Wed=3, Thu=4, Fri=5, Sat=6; int firstday= Tue; int timeclock=0, day = 9; (firstday+day-1) % 7 != Sun When is the above true?
Using operators to construct Using operators to construct conditional expressions conditional expressions 1 2 3 4 5 6 7 8 9 10 1112 13 14 15 16 17 18 19 Su M T W Th F Sa 20 2122 23 24 25 26 27 28 29 30 31 int Sun=0, Mon=1, Tue=2, Wed=3, Thu=4, Fri=5, Sat=6;

This preview has intentionally blurred sections. Sign up to view the full version.

View Full Document
This is the end of the preview. Sign up to access the rest of the document.

{[ snackBarMessage ]}

### Page1 / 44

Lecture12 - Lecture 12 Project 3 Predicates and Conditional...

This preview shows document pages 1 - 16. Sign up to view the full document.

View Full Document
Ask a homework question - tutors are online