Week of January 24, 2016

Topics for this week: Expressions

Activity checklist
  Read chapter 4 in your course packet.
  Review the slides on Expressions
  Review the sample program Expressions
  Review the video Expressions
  Review the video Casts
  Complete lab #6, due by 11:59pm on Tuesday.
  Complete lab #7, due by 11:59pm on Thursday.
  Complete project #2 and submit it to Canvas before 11:59pm on Sunday. 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.
  Take the first exam. It will be in the testing center 1/29 - 2/3

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 on your first midterm. By the end of this unit, you should be able to:

Reading assignment
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 prepared.
  1. Chapter 4 in your course packet explains how to write expressions in C#. It also introduces some of the built-in math functions, which we will talk about in a few weeks. This chapter provides some helpful programming hints and points out some common errors students make when first writing expressions.
  2. The slides on Expressions introduces the arithmetic operators and explains how to write arithmetic expressions. One of the most difficult concepts presented in the slides is the handling of mixed data types. Be sure that you understand this important topic.

Don't pass over this material lighty. There are some subtle concepts here that must be mastered. You will be tested over and over again on problems that involve mixed data types, precedence and integer division.

Important Concepts
Be sure that you understand the following important ideas presented in this unit.

  1. C# provides all of the common arithmetic operations, but in some cases the symbols used are different from what you might be used to. In particular, the multiplication symbol is an asterisk (*) and the division symbol is a slash (/). In addition, C# provides a number of "shortcut" symbols to do often used operations. For example, incrementing a value is done so often in C# that the developers of the language created a new symbol, ++, to signify the increment operation.
  2. When an expression in C# is evaluated, evaluation follows a fixed set of precedence rules. These rules define which operations get done first. For example, in the expression
        num = factor * size - width;
    the multiplication operation will be done before the subtraction. If you are not sure about the precedence rules, or if you want to change the order of operation, you can use parentheses, just like you would in algebra.
  3. One of the most important concepts in this module is the handling of mixed data types in an expression. For example, what happens in the expression
        area = length * width;
    if length is an integer and width is a double? The computer hardware does not know how to multiply an integer by a double. In order to do this processing, the computer must make both width and length the same kind of data. There are precise rules that are used to make these conversions. It is important that you understand these rules.
  4. Occasionally, a programmer will need to make an explicit change of data type. This is done with a cast.
Lab Assignment

This week you should complete labs 6 and 7. These labs will help you to understand how expressions are evaluated, and go though the important topic of developing an algorithm. Be sure that you spend sufficient time studying this these ideas, and practice them during the week. Be sure that you know how to write pseudo-code.

Project #2

This week you should complete your second programming project. In this project, you will create a program that uses expressions. This will give you practice using the concepts that have been discussed this week.

Be sure that you include the declaration that you did not copy any code in all of your source code files. If this statement does not appear in your program, it will not be graded. All program are expected to contain the pseudo-code that you created when designing the solution to the problem.

The first midterm starts this week in the classroom testing center.

There is a study guide for this exam at http://debryro.uvsc.edu/1400/studyOne.html. Be sure to give yourself plenty of time to finish the exam. The exam is open book and has no time limit.

You can find information on the classroom testing center at http://www.uvu.edu/testingservices/.


If you are an internet student who cannot come to the testing center to take your exams, you must make arrangements through the Distance Education office for an exam proctor. The Distance Education help page is at http://www.uvu.edu/de/