Unit III Talking Points—Boolean/Conditional Expresions

CS 1130 Visual Basic—Fall 2017

Day 09 — Unit III Introduction


Review Comp.Demo Results

The grade book is posted. (Those who haven't sent me a code may wish to do so.) As is usual, most people did not demonstrate competency. Remember that I am checking for "competency". That means I was able to conclude that you were able and willing to carry out the tasks as specified. There is also a measure of being able to perform in the time allowed—that you have the skill/knowledge

Generally, there is no way to provide feedback on CD I (except if you used C# rather than Visual Basic). If you wish we can sit down and go through the process—just make an appointment.

For CD II, I will go over possible correct solutions and respond to questions.   [ Display solution to CD II.a and respond to questions. ]  

Remember, you must "pass" CD II before you can retake later competency demos

Questions? Comments? Wonderings?

Boolean Data & Operators—Conditional Expressions

As I indicated last time, the next topic is conditional expressions (or Boolean expression— capitalized because the name comes from the mathematician George Boole). Boolean data is another kind of data that can have only two values—true or false. (Actually, Boolean variables can be undefined also, which should cause an error.) We use Boolean expressions to determine the state of program data (and, thus, our program). Then, eventually we (our code) will make decisions based on the program state as indicated by the Boolean expression.

Boolean variables or expressions appear in three places—assignment statements, selection/if statements, and looping/do statements.

This unit focusses on the evaluating and producing Boolean expressions that indicate some program state.   Questions? Comments? Wonderings?

Program State

Data in a program represents the problem we are attempting to solve. At any given point in time, the data values represent the state of the program. Our program will want to manipulate the data (change the program state), determine the program state (Boolean assignment statement), and/or take some action depending on the state (If or Do statements). When Boolean data is involved we can think of the situation as asking (and answering) questions of the data. Some examples of program state (or questions we can ask of data) are:

The number and kind of program states (questions we might need to ask) is unlimited. That makes it a little hard to talk about.

To determine whether a particular program state exists, we need to be able to think about the program state in terms of the variables (data) that define problem we are working on, and on "manipulations" of that data. The manipulations are arithmetic operators, numeric functions, and string operators & functions that we have seen in Unit II. And now, we need to become familiar with additional operators—Boolean operators.

Boolean operators

There are two types of Boolean operators:  1) relational operators that compare two values (two numeric values or two string values) and   2) logical operators that combine two (Boolean) values.

Boolean/Conditional Expressions

As with numeric and string data, Boolean data has "expressions"— combinations of literals, variables, operations, functions, and parentheses that produce a single value. Examples for the questions notes above are:

Any questions/wonderings about the material above?     [ Respond to questions/comments. ]  

Unit III Practice/Learning Activity

[ Display and discuss the learning/practice activity. Respond to questions/comments. ]     (When no further questions/discussion, students work on the activity ]  

Day 10— Unit III Work Day


The main activities for today are:

Next Time:

Day 11— Unit III Competency Demo


The main activities for today are:

Next Time: