BIT 142:Intermediate Programming (2007 Spring)
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: Mar 30th - Friday, First week of the class>
  1. Get Visual Studio 2005
  2. Orient yourself to BIT 142
  3. Join the class newsgroup ;
    Send the professor your email address
    (Required)  
     
  4. Create a simple console application  (Hand-In) (Ch 3.3 (walkthrough), 3.2 (explanation of the program) )   Demo Video
  5. Basic Console I/O     (Sect. 3.5)
  6. Basic Arithmetic Operators (Sect. 3.6, 3.8)
  7. Comparison Operators (Sect. 3.9)
  8. Defining & Using an Instance Method (Sect. 4.1-4.3 (mostly 4.3))
  9. 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)
  10. Function Calls: A Handy Trick (on your own)
  11. Data Types (Hand-In) (Sect. 5.11, Appendix L)
  12. Order Of Operations (Hand-In) (End of Sect. 3.9, Appendix A)
  13. Console I/O, Operators (Hand-In) (previous readings)
     
  14. String Basics (Sect. 16.2) (Hand-In)
  15. Comparing Strings (Sect. 16.5)
     
  16. How to hand in pre-class exercises and homework
In-Class Exercises:
<Class Date: Mar 26th - MONDAY, then again on Mar 28th - WEDNESDAY>
(This class meets TWICE during the first week ; it meets ONCE A WEEK thereafter)

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: April 2 (Monday)>
  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)
     
  10. Random.Next(0, N) PCE
In-Class Exercises:
<Class Date:
April 4th (Wednesday) >

 

Review Topics:

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

Preview Topics:

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

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, April 11th)

Individual Pre-Class Exercises:
<Due: April 9th (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)
     
  13. 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.)
In-Class Exercises:
<Class Date: April 11th (Wednesday)>

Review:

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

Preview:

  1. Nested Loops: Multiplication Table
     
  2. Design: return values vs. out vs. ref parameters
     
  3. Arrays: Basics (Sect. 8.1, 8.2)
  4. Arrays: Tracking grades in an array
     
  5. Multidimensional (Rectangular) Arrays (Sect. 8.10)
    DEMO Project: MultiDim Arrays
Instructor's Materials:
Notes
Slides

 

Lesson 04

DUE: Assignment 2 (Due Weds, April 18th)

Individual Pre-Class Exercises:
<Due: April 16th (Monday)>
  1. Nested Loops: Triangle of Numbers (Sect. 5.8) (Hand-In)
     
  2. Detecting Prime Numbers (Previous Knowledge) (Hand-In)
     
  3. Arrays: Basics (Sect. 8.1, 8.2)
  4. Arrays: Usage (Sect. 8.3)
  5. Arrays: Using only part of the array (Hand-In
  6. Fibonacci numbers in an array (Hand-In)
     
  7. Passing arrays to functions (Sect. 8.7, 8.8)
     

  8. Returning an array from a method
     
  9. Overloading: Basics (Sect. 7.12) (Hand-In) (Demo Video   VS Project Used in the Video  (How to access demo projects) )
  10. Overloading: Create your own (Sect. 7.12)

In-Class Exercises:
<Class Date: April 18th (Wednesday)>

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: April 23 (Monday)>
  1. OOP Basics:
    (Demo Video   Example Project)
    OOP Encapsulation:
    (Demo Video   Example Project)

    More 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. Classes & instances (Sect. 9.2)
     
  3. Instance Variables (Sect. 4.2+, Sect. 9.2)
  4. Access Control (public, private) (Sect. 9.3)
  5. Variable Scope (class, instance, local/param vars) (Sect. 7.11) (Hand-In)
     
  6. Designing a class: Circle
  7. Testing a class: Circle (Hand-In) (In order to accomplish this, you will therefore need to do (and hand in) exercise #6, as well)
     
  8. Constructors  (Sect 4.9, Sect. 9.6) (Hand-In)
     
  9. C# Properties  (Sect 4.5) (Hand-In)
  10. Read-only Properties
     
  11. String Allocation Exercise
    String Allocation Rules
    HowManyStrings.cs.txt
    String Allocation Practice -ANSWERS
     
  12. StringBuilder class

In-Class Exercises:
<Class Date:  April 25th (Wednesday)>

Review:

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

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. Class from a narrative: overview
     
  9. Class containing an array
Instructor's Materials:
Notes
Slides
 

 

Lesson 06

 

Individual Pre-Class Exercises:
<Due: April 30th (Monday)>

  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. Extract several classes from a narrative. (Hand-In)
     
  4. OOP Inheritance (Specialization):
    (Demo Video   Example Project)
     

  5. Inheritance: Basic Example (Chapter 10: Inheritance) (Hand-In)
  6. Inheritance: Constructors
  7. Inheritance: Calling Methods in the base class (Hand-In)
  8. Inheritance: Abstract base class
     
  9. (Non)Inheritance: Array of objects (Hand-In)
     
  10. Inheritance: Polymorphism, manually (Chapter 11: Polymorphism)
     
  11. 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: May 2nd (Wednesday)>

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
     
  4. Composing a class out of other classes (Circle with a Point for a location)
  5. Overlap method
  6. Interaction between classes
Instructor's Materials:
Slides
 
 

 

Lesson 07

Assignment 3 (Due Wednesday, May 9th)

Individual Pre-Class Exercises:
<Due: May 7th (Monday)>
(You may hand this in, penalty-free, as late at Monday, May 14th)
  1. Review for the exam!
     

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

  3. TODO: Given a simple example, and some rules of thumb, extract several classes from a narrative
    One of the classes will be composed (in part) of instance from another class.
     

  4. Polymorphism Preview

  5. Basic Polymorphism (Hand-In)
  6. Polymorphism: ToString (Hand-In)

In-Class Exercises:
<Class Date: May 9th (Wednesday)>

  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, May 16th )

Individual Pre-Class Exercises:
<Due: May 14th (Monday)>
  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>
     
  8. Polymorphism: virtual, override, new (Read Briefly) Polymorphism: All combinations of baseRef, derivedRed, baseObj, derived Obj
    File: Inheritance.zip
In-Class Exercises:
<Class Date: May 16th (Wednesday)>

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

 

Individual Pre-Class Exercises:

<Due: May 21st (Monday)>

  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: May 23rd (Wednesday)>

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)
     

  5. Homework Q + A

Instructor's Materials:
Notes

Slides   

 

Lesson 10
Individual Pre-Class Exercises:
<Due: May 28th (Monday)>
  1. StringBuilder Tutorial (Required)
    Example Project #1            Example Project #2             Example Project #3              Example Project #4
     
  2. Linear Search
  3. Binary Search
  4. Write recursive binary search
  5. Linear Search: Measuring Performance (Hand-In)
  6. Binary Search: Measuring Performance (Hand-In) (This doesn't have to be recursive)
  7. BubbleSort
  8. BubbleSort: Measuring Performance (Hand-In)
  9. Analyzing the different algorithms (Hand-In) (Demo Video: Scatter Plots in Excel)
In-Class Exercises:

<Class Date: May 30th  (Wednesday)>

 

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
     

  4. After some thought, I'd like to change the deadlines slightly:


    What I'm thinking is that if you can hit the Wednesday deadline for the original versions of the homework assignments, then I'll definitely be able to get the homeworks graded by that weekend (or at  latest, on Saturday). I'd like for people to have a chance to do a  revision, which tends to be quicker to grade, so I'd be happy to  accept revisions of homework assignments (and only the revisions) up  till Wednesday, June 6th, at 5pm.
    For the PCEs, getting them in to me by Friday (midnight) should  work, so that I can grade them over the weekend.


    I think this should work for everyone - let me know ASAP if you have any questions / concerns!

Instructor's Materials:
Notes
Slides

 

Lesson 11

Individual Pre-Class Exercises:
<Due: June 4th (Monday)>

  1. Review for the exam

In-Class Exercises:
<Class Date: June 6th (Wednesday)>

  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.