Week 4 - Boolean Expressions and Conditionals

Learning Objectives

Upon finishing this learning module, you should be able to:

  • Write a program using conditional expressions
  • Use operators to manipulate boolean values

Schedule

Day 1

In class:

  • Conditionals / Booleans / Scope

Outside class:


Day 2

In class:

  • Logic Rewriting Activity

Outside class:


Day 3

In class:

  • Advanced Conditionals
  • Combo Project and Assignment 4 Overview

Outside class:


Day 4



Conditionals

Read Ch 7 on Conditionals.

These videos review some of the ideas. They are not required, but may help with a particular concept.

How scope works with conditionals: (7.6)


Nested and chained conditionals: (7.7)


Boolean Operators like && (and), || (or), and ! (not) (Ch 7.9):


? and switch (Ch 7.12):


Using the Combo Project Template

This week you will need to use the Combo Project Template to create your assignment. It is simply a template that sets up a project with both a Unit Test program and a normal program in the same folder.

This video introduces how to switch between the two programs:


Midterm Review

Check out the Practice Midterm in this week's module. It is a preview of the style of questions you can expect on the midterm exam next week. It is a pen and paper exam that you will take without access to a computer. So practice that way. Either print the exam, or pull it up on screen and then write your answers on paper. Do NOT practice by typing your answers into a text editor - that is not how you will take the exam!

I am not expecting perfect code that would compile without errors. If you miss a ; somwhere, that is okay. If you mess up a line of code but the rest of your logic is correct, you will get most of the points on that question. Focus on getting the logic correct and writing code that is as correct as you can make it.

I recommend doing the first problem and then checking against the provided key. It has a sample of how I might score that problem. See how many of the points you would have earned. Note how even if you were missing some detail, all the other correct parts still earned you points.

Once you see how the first problem is scored, do the rest of the problems. As you do them, keep in mind how the scoring works. Don't stop and worry about if you are getting each detail right, just focus on getting down as much of the correct logic as you can.

The midterm will cover up through week 4. It will NOT include week 5.