Week 2 - Boolean Expressions and Conditionals
Learning Objectives
Upon finishing this learning module, you should be able to:
- Use relational operators to construct simple boolean statements
- Write a program using conditional expressions
Recommended Schedule
Day 1
- Type Conversions, Const, other Operators
- Read 2.7, 2.11-13, and 2.16
- Do MentalCodeOpsCasts WS
Day 2
- Booleans and If
- Read Ch 3.1-3.4
- CppLab conditionals 1
Day 3
- Nested Ifs
- Conditional Operators
- Read Ch 3.5-3.8
- CppLab conditionals 2
Day 4
- Boolean Operations/Switch
- Do BooleanPractice WS
- Read Ch 3.10-3.11, 3.13-3.16
Data Conversions and Other Operators
Read the last parts of chapter 2 (2.7, 2.11-13, and 2.16). These videos cover two of the topics, Casts and Constants:
Do the MentalCodeOpsCasts worksheet (see Classroom files link). Like last week, try doing in your head, then check it using the debugger.
One of your takeaways should be that the operators like ++ and += are pretty simple if you use them on a line by themselves. But, if you mix them into more complex expressions, they quickly get very tricky:
z += y /= --x + 6; //valid but insane c++
Conditionals
Read Ch 3.1-3.4. This video introduces some of the key concepts:
Do Conditionals 1 CPPLab. There is a link to CPPLab at the top of this page. Your username is the same as your Chemeketa username. Initial password is "changeme" without quotes. You can change it on the login screen.
CPPLab is designed to give you the practice you need to really learn how to program. Some of the problems are easy, some are hard. Each assignment is scored on a generous curve - you should make sure to do some work on each one but not panic if every now and then you get stuck.
Read powerpoint on Scope from the Classroom/sides examples. It covers some useful background material that the book does not mention until later. This video walks through some demonstrations of how scope affects variables:
Read Ch 3.5-3.8. This video introduces some of the ideas:
Do Conditionals 2 CPPLab.
This video demonstrates using the debugger to trace your way through the computer tax example:
Read Ch 3.10-11 and 3.13-16.
Note: you do not need these parts of Chapter 3 to do the assignment or CPPLabs. Next week involves less material, if necessary you can worry about mastering these section next week.
These videos cover the basics of those sections:Do the Boolean Practice worksheet (see Classroom slides/examples link below for WS and key).
Do the assignment.