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

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

View Full Document Right Arrow Icon
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
Background image of page 1

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

View Full DocumentRight Arrow Icon
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
Background image of page 2
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.
Background image of page 3

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

View Full DocumentRight Arrow Icon
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
Background image of page 4
Exercise 1 Exercise 1 Evaluate the Expression 1==2==0 and not (9%3)
Background image of page 5

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

View Full DocumentRight Arrow Icon
Exercise 1 Exercise 1 Evaluate the Expression 1==2==0 and not 0
Background image of page 6
Exercise 1 Exercise 1 Evaluate the Expression 1==2==0 and 1
Background image of page 7

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

View Full DocumentRight Arrow Icon
Exercise 1 Exercise 1 Evaluate the Expression 0 ==0 and 1
Background image of page 8
Exercise 1 Exercise 1 Evaluate the Expression 1 and 1
Background image of page 9

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

View Full DocumentRight Arrow Icon
Exercise 1 Exercise 1 Evaluate the Expression 1 (true)
Background image of page 10
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
Background image of page 11

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

View Full DocumentRight Arrow Icon
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
Background image of page 12
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?
Background image of page 13

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

View Full DocumentRight Arrow Icon
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?
Background image of page 14
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;
Background image of page 15

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

View Full DocumentRight Arrow Icon
Image of page 16
This is the end of the preview. Sign up to access the rest of the document.

Page1 / 44

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

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

View Full Document Right Arrow Icon
Ask a homework question - tutors are online