Week of February 7, 2016

Topics for this week: Methods

Activity checklist
  Read chapter 6 in your course packet.
  Review the slides Methods
  Watch the video on How Methods Work
  Study the sample code here that demonstrates the use of methods.
  Complete lab #10, due by 11:59pm on Tuesday.
  Complete lab #11, due by 11:59pm on Thursday.
  Complete project #4, due by 11:59pm on Sunday.
  Take the exam, it is available through Wednesday.

  objectives

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 next exam. By the end of this unit, you should be able to:

Reading assignment
  1. Chapter 10 in the course packet introduces the concept of a method and how to use methods to solve programming problems.
  2. The slides on "Methods" cover this material in more detail.

important concepts

You should be sure that you understand the following important ideas about methods:

  1. Methods are basic building blocks of a program. They allow us to break our programs into small, meaningful pieces, where each piece has a well defined operation that it performs. A well written method should just do one task, but do it completely.
  2. The .Net library provides a large number of pre-defined methods that do common mathematical operations, such as finding the square root of a number.
  3. A method prologue is a set of comment lines that explain what a method is for and how it should be used. Pre-conditions in the method prologue are conditions that parameters passed to the method must meet in order for the method to work correctly.
  4. A variable's scope defines where in the program that variable can be seen from.
  5. A variable's lifetime defines when a variable comes into being and when it ceases to exist.

Lab Assignment

This week you should complete labs 10 and 11. These labs introduce methods and explain how to use stepwise refinement to solve a problem.