Week of FEbruary 28, 2016
Topics for this week: Solving Problems that Require Decisions
||Read chapter 9 in your course packet.
||Review the slides on Solving Problems with Decisions
||Review the sample program
||Watch the video
Debugging your programs
lab #16, due by 11:59pm on Tuesday.
lab #17, due by 11:59pm on Thursday.
||Complete project #6
and submit it to Canvas before 11:59pm on Sunday. Late programs will lose 20% of the possible points
for each day that they are late. If you turn this program in prior to 11:59pm on Saturday you will
receive a 5 point bonus, if it meets all of the specifications and gives the correct answers.
It is expected that you will meet the objectives outlined here by the end of the week.
You might want to test yourself to see how well you fare. You can be guaranteed that you
will be tested on these concepts. By the end of this unit, you should
be able to:
- Demonstrate that you can solve problems that require decision logic.
- Demonstrate that you can correctly write and evaluate simple boolean expressions.
- Demonstrate that you can correctly use logical AND and OR to create and evaluate more complex boolean expressions.
- Describe the precedence rules for C# operators.
- Explain how short-circuit evaluation of a boolean expression works.
- Correctly use the if statement in a C# program.
- Correctly use the if-else statement in a C# program.
- Correctly use nested if-else statements in a C# program.
- Correctly use a switch statement in a C# program.
- Describe and correctly use enumerations in a C# program.
- Correctly use the conditional operator in a C# program.
- Correctly use DeMorgan's law to simplify boolean expressions.
- Use compiler messages to find and repair syntax problems in your programs.
All reading should be done before you come to class. Your ability to understand
the material discussed in class will be greatly enhanced when you come to class
- Chapter 5 in the course packet covers relational operators, boolean operators, and
logical expressions. It explains how to write and use selection statements
(if, if...else, and switch). An important application of control structures
is Input Validation. As you will be required to do input validation
in most of the programs that you write from this point on, you should be sure that
you understand how to do this.
- The slides on "Control Statements" covers the syntax and use of the if statement,
if-else statement, and the switch statement. The use of blocks in a conditional
statement is discussed as well as the use of nested if-else statements. This set of slides also
presents enumerations and discusses logical operators.
Here are some important concepts that you will want to be sure that you understand.
- The normal flow of control in a program is to execute each statement in turn, from beginning to end.
However, there are often cases where it is desirable to change that order, based on whether some condition
is true or not. For example, if it a weekday, you go to school. If it is not a weekday, you stay home.
- Two statements that test a condition and then alter the flow of control accordingly are the if statement and
the if-else statement. Conditions are tested using relational operators, such as == (equals),
< (less than), and > (greater than).
- The Boolean operators && (and) and || (or) are used to combine conditions. For example,
if it is a weekday, and if it is not a holiday, then go to school. Be sure that you understand the
shortcut rule as it applies to the evaluation of complex boolean expressions.
- Lab 13 introduces De Morgan's Theorem, which helps when you are dealing with negative conditions,
for example when it is not a weekday, and it is not a workday. You will want to be sure that
you understand how to apply this theorem.
After studying the assigned reading material, you should spend some time going through the
review exercises at the end of the chapter. You should also try out one or two of the
programming exercises. If you only do the minimum amount of work required to pass this
class, you will never really master the concepts. To really learn the concepts taught
in class, you should take every opportunity to put into practice what you are learning.
Learning to program is like learning to play a musical instrument. It takes constant
This week you should complete labs 16 and 17.
* Lab #16 will help you to understand how conditional control structures
work in C#. Lab #16 also discusses De Morgan's law.
* Lab #17 introduces you to some GUI components that allow the user to make choices.
This week you should complete project #6. It will test your abilities
to design, code and test a C# program that uses decision logic.