BIT 142:Intermediate Programming (2007 Winter)
Lessons

Table of Contents
Lesson 01 Lesson 02 Lesson 03 Lesson 04
Lesson 05 Lesson 06 Lesson 07 Lesson 08
Lesson 09 Lesson 10 Lesson 11 Misc. / Unused

 

Lesson 01
 
Individual Pre-Class Exercises:
<Due: Jan 8 (Monday)>
  1. Get Visual Studio
  2. Orient yourself to BIT 142
  3. Create a simple console application  (Hand-In) (Ch 3.3 (walkthrough), 3.2 (explanation of the program) )   Demo Video
  4. Basic Console I/O     (Sect. 3.5)
  5. Basic Arithmetic Operators (Sect. 3.6, 3.8)
  6. Comparison Operators (Sect. 3.9)
  7. Defining & Using an Instance Method (Sect. 4.1-4.3 (mostly 4.3))
  8. Single-file Demo for PCE's (Sect. 4.1-4.3 (mostly 4.3)) (You need to do this, and use this as the 'template' for the exercises you do after this point)
  9. Function Calls: A Handy Trick (on your own)
  10. Data Types (Hand-In) (Sect. 5.11, Appendix L)
  11. Order Of Operations (Hand-In) (End of Sect. 3.9, Appendix A)
  12. Console I/O, Operators (Hand-In) (previous readings)
  13. String Basics (Sect. 16.2) (Hand-In)
  14. Comparing Strings (Sect. 16.5)
     
  15. How to hand in pre-class exercises and homework
In-Class Exercises:
<Class Date: Jan 3rd>

Review:

  1. Create a simple console application (Ch 3.3 (walkthrough), 3.2 (explanation of the program) )  Demo Video
  2. How to hand in pre-class exercises and homework
  3. Defining & Using an Instance Method
  4. Single-file Demo for PCE's (Sect. 4.1-4.3 (mostly 4.3)) (You need to do this, and use this as the 'template' for the exercises you do after this point)
  5. Basic Console I/O

Preview:

  1. % operator
  2. integer division
  3. Different types of loops
  4. nested loops
Instructor's Materials:
Notes
Slides (for the first day)


Slides (Lecture #2)

 

Lesson 02

 

Individual Pre-Class Exercises:
<Due: Jan 10 (Wednesday)>
  1. C# Intro: Namespaces
  2. Integer vs. real division (End of Sect. 5.6, also Sect. 3.8) (Hand-In) (Demo Video   VS Project Used in the Video  (How to access demo projects) )
  3. Modulus operator ( % ) (Section 3.8) (Hand-In)    (Demo Video)
  4. Fahrenheit to Celsius (Based on your previously acquired knowledge) (Hand-In)
     
  5. Logical operators (Section 6.8)
  6. if ; if ...else  ; switch statements (If: Sect. 5.3 / If...Else: Sect. 5.4) (Hand-In)
     
  7. Simple loops - while, for -(Sect. 5.5)
     
  8. keywords: break / continue (Section 6.7)
  9. Compound Assignment operators (Section 5.9), Increment / Decrement operators (Sect. 5.10)
In-Class Exercises:
<Class Date:
Jan 10th >

Review Topics:

  1. Q+A: Remainder ('Modulus') operator
  2. Q+A: Integer division
  3. Nested Loops: Multiplication Table

Preview Topics:

  1. Random # basics   Demo File
  2. Random numbers, manually bounded
  3. Basic parameter review
  4. Reference Parameters (out, ref) , and normal return values

Warning: Don't worry about the recursion section (Sect. 7.13) - we'll see that in more detail later on

Instructor's Materials:
Notes
Slides

 

Lesson 03

DUE: Assignment 1 (Due Weds, January 17th)

Individual Pre-Class Exercises:
<Due: Jan 15th  (Monday)>

  1. Sentinel-controlled loops: Averaging numbers (Sect. 5.7) (Hand-In)
     
  2. Nested Loops: Rectangles  (Sect. 5.8) (Hand-In (Demo Video   VS Project Used in the Video)
  3. Nested Loops: Hollow Rectangles (Sect. 5.8) (Hand-In)
     
  4. Printing A Range Of Numbers (Previously acquired knowledge) (Hand-In)
     
  5. keywords: break / continue (Section 6.7)
  6. Compound Assignment operators (Section 5.9), Increment / Decrement operators (Sect. 5.10)
     
  7. Built-in Math functions  (Hand-In (Sect. 7.3)
     
  8. Basic Parameters (Sect. 4.4)
  9. Return Values (Previous Knowledge)
  10. Printing numbers, w/ params (Sect. 4.4)
  11. Design: return values vs. out vs. ref parameters (Sect. 7.14) (Hand-In)
    For this PCE, you are encouraged to discuss this with your group.  Also, there may be multiple, valid interpretations of what a correct answer is for this exercise - you should focus on being able to clearly explain a reasonable rationale for your choices.
     
  12. Generating Random Numbers (Sect. 7.9 (Shift/scale: 7.9.1)) (Hand-In)
In-Class Exercises:
<Class Date: Jan 17th>

Review:

  1. Q+A: Remainder ('Modulus') operator
  2. Q+A: Integer division

Preview:

  1. Random numbers, manually bounded   (Demo File)
     
  2. Nested Loops: Multiplication Table
     
  3. Basic parameter review
  4. Reference Parameters (out, ref) , and normal return values
     
  5. Arrays: Basics (Sect. 8.1, 8.2)
  6. Arrays: Tracking grades in an array
     
  7. Multidimensional Arrays (Sect. 8.10)
    DEMO Project: MultiDim Arrays
Instructor's Materials:
Notes
Slides

 

Lesson 04

DUE: Assignment 2 (Due Weds, Jan 24th)

Individual Pre-Class Exercises:
<Due: Jan 22nd>
  1. Using The Distance Formula (Demo Video   Word Document Used in the Video)
    (There is nothing to hand in for this PCE.  Personally, I'd recommend doing a couple of examples by hand in order to make sure that you understand the formula.  You will be using the formula on homework assignment 2, et al.)
     
  2. Nested Loops: Triangle of Numbers (Sect. 5.8) (Hand-In)
     
  3. Detecting Prime Numbers (Previous Knowledge) (Hand-In)
     
  4. Arrays: Basics (Sect. 8.1, 8.2)
  5. Arrays: Usage (Sect. 8.3)
  6. Arrays: Using only part of the array (Hand-In TODO: Make it clear that the array has to be 10 elements long, regardless
  7. Fibonacci numbers in an array (Hand-In)
     
  8. Passing arrays to functions (Sect. 8.7, 8.8)
     
  9. Returning an array from a method
     
  10. Overloading: Basics (Sect. 7.12) (Hand-In) (Demo Video   VS Project Used in the Video  (How to access demo projects) )
  11. Overloading: Create your own (Sect. 7.12)

In-Class Exercises:
<Class Date: Jan 24th>

Review:

  1. Q+A

Preview:

  1. Basic OOP - objects & instance vars.
  2. Review of classes & instances
  3. Classes with instance data
  4. Access Control (public, private)
     
  5. String Allocation Exercise
    String Allocation Rules    
    (Sample Project For String Allocation Exercise)

  6. Jagged Arrays: Tracking Grades
    Demo: Jagged Arrays (Upper-Tri Matrix)
  7. Jagged Arrays: Counting Arrays
Instructor's Materials:
Notes
Slides
 

 

Lesson 05

 

Individual Pre-Class Exercises:
<Due: Jan 29>
  1. Classes & instances (Sect. 9.2)
    Background Info:
       OOP Concepts (from Sun Microsystems - the Java People)
    (Focus on the "What is an Object?", "What is a class?", and "What is inheritance?" sections - the others are nice to read, but not mandatory)
     
  2. Instance Variables (Sect. 4.2+, Sect. 9.2)
  3. Access Control (public, private) (Sect. 9.3)
  4. Variable Scope (class, instance, local/param vars) (Sect. 7.11) (Hand-In)
     
  5. Designing a class: Circle
  6. Testing a class: Circle
     
  7. Constructors  (Sect 4.9, Sect. 9.6) (Hand-In)
     
  8. C# Properties  (Sect 4.5) (Hand-In)
  9. Read-only Properties
     
  10. String Allocation Exercise
    String Allocation Rules
    HowManyStrings.cs.txt
    String Allocation Practice -ANSWERS
     
  11. StringBuilder class

In-Class Exercises:
<Class Date: Jan 31st>

Review:

  1. Q+A : Basic OOP (Methods + Data ; Encapsulation)

Preview:

  1. Preview: Inheritance: 3D Point class
    Warning: The book mostly has a case study for the Inheritance aspects of OOP: you may need to supplement w/ help around more specific topics
     
  2. Inheritance: Basic Example (Chapter 10: Inheritance)
  3. Inheritance: Constructors
  4. Inheritance: Calling Methods in the base class
  5. Inheritance: Abstract base class
     
  6. Designing a class: Circle
  7. Testing a class: Circle
     
  8. Composing a class out of other classes (Circle with a Point for a location)
  9. Overlap method
  10. Interaction between classes
     
Instructor's Materials:
Notes
Slides
 

 

Lesson 06

Assignment 3 (Due Wednesday, Feb 7th)

Individual Pre-Class Exercises:
<Due: Feb 5th>

  1. StringBuilder class (Hand-In)
    Name Game: Analyzing String Creation
    Name Game Project (VS 2003)
     

  2. Mixing Arrays and Classes: An array within a class (Previous Knowledge)  (Hand-In)  (Demo Video     Starter Project)
     
  3. Inheritance: Basic Example (Chapter 10: Inheritance) (Hand-In)
  4. Inheritance: Constructors
  5. Inheritance: Calling Methods in the base class (Hand-In)
  6. Inheritance: Abstract base class
     
  7. (Non)Inheritance: Array of objects (Hand-In)
     
  8. Inheritance: Polymorphism, manually (Chapter 11: Polymorphism) (Hand-In)
     
  9. Basic Polymorphism
    (treat this a 'preview' - if you've got time, look at this so you'll be better prepared for class,
    but don't worry about it (or spend a lot of time on it) you get stuck)
In-Class Exercises:
<Class Date: Feb 7th>

Review:

  1. Midterm Exam: Q+A & Review   (including inheritance)

Preview:

  1. Polymorphism: ToString Example
  2. Polymorphism: ToString on your Car class
     
  3. Optimization: StringBuilder
    DEMO: StringBuilder: First Try
Instructor's Materials:
Slides
 
 

 

Lesson 07

 

Individual Pre-Class Exercises:
<Due: Feb 21st>
  1. Review for the exam!
     

  2. Optimization: StringBuilder (Hand-In)
    DEMO: StringBuilder: First Try
     

  3. Polymorphism Preview
  4. Basic Polymorphism (Hand-In)
  5. Polymorphism: All combinations of baseRef, derivedRed, baseObj, derived Obj
  6. Polymorphism: ToString (Hand-In)
     
  7. Polymorphism: virtual, override, new (Read Briefly)
    File: Inheritance.zip

In-Class Exercises:
<Class Date: Feb 14th>

  1. <Midterm Exam>
     
  2. Recursion By hand: Warm-up #1
  3. Recursion By hand: Warm-up #2

 

Instructor's Materials:
Notes
Slides

 

Lesson 08

Assignment 4 (Due Wednesday, Feb 21st)

Individual Pre-Class Exercises:
<Due: 11/13>
  1. What does this code print? (Hand-In)
     
  2. Recursion By hand: Warm-up #1
  3. Recursion By hand: Warm-up #2 (Hand-In)
  4. Recursion By hand: Warm-up #3 (Hand-In)
     
  5. Basic (Crashing) Recursion (Sect. 7.13)
  6. Basic Recursion (Sect. 7.13) (Hand-In) CAP
     
  7. Object Allocation Exercise
    Object Allocation Rules
    HowManyObjects.cs.txt
    <Answers to be gone over in class>
In-Class Exercises:
<Class Date: Feb 21st>

Review:

  1. Recursion By hand: Warm-up
  2. Recursion By hand: More Complicated

Previews:

  1. Recursive Power Function
  2. Recursive Multiplication
  3. Fibonacci Numbers (And Arrays!)
     
  4. Counting objects (review, solution)
Instructor's Materials:
Notes
Slides   

 

Lesson 09

DUE: Assignment 5 ( OPTIONAL: Due Weds, Feb 28

Individual Pre-Class Exercises:
  1. Recursively Printing Even Numbers (Hand-In)
  2. Recursive Power Function
  3. Recursive Multiplication (Hand-In)
  4. Write Factorial
  5. Fibonacci Numbers (And Arrays!)
     
  6. Sorting & Searching: setup for the class (Hand-In)
     
  7. Object Allocation Exercise (Hand-In)
    Object Allocation Rules
    HowManyObjects2.cs.txt
     
In-Class Exercises:
<Class Date: Feb 28th>

Review:

  1. Recursion

Preview:

  1. Linear Search By Hand

  2. Binary Search By Hand

  3. Bubble Sort By Hand
  4. Selection Sort (Algorithm, and by hand)

Instructor's Materials:
Notes

Slides   

 

Lesson 10
Individual Pre-Class Exercises:
  1. Linear Search
  2. Binary Search
  3. Write recursive binary search
  4. Linear Search: Measuring Performance (Hand-In)
  5. Binary Search: Measuring Performance (Hand-In) (This doesn't have to be recursive)
  6. BubbleSort
  7. BubbleSort: Measuring Performance (Hand-In)
  8. Analyzing the different algorithms (Hand-In) (Demo Video: Scatter Plots in Excel)
In-Class Exercises:
<Class Date: Mar 7th>

Review:

  1. Final Exam: Q+A & Review

Preview:

  1. < Algorithms Review >
    Runtimes.xls
     
  2. Big "Oh" Notation
     
  3. Using .Net's Array.Sort, Array.Search

Instructor's Materials:
Notes
Slides

 

Lesson 11

Individual Pre-Class Exercises:
<Due: 12/4>

  1. Review for the exam
     

  2. TODO for next term: Inheritance: Abstract base class

In-Class Exercises:
<Class Date: Mar 15th>

  1. <Final Exam>

 

Instructor's Materials:
Slides

Back to BIT 142's homepage

Unused Lecture Material

BIT 143's Lessons Page

TODO

Add more about 'class design' - figuring out what properties / methods something should have.  Also, more on how to create classes that interact with each other.