Lecture 25. Nov 30 (Thursday). Conclusion.
We talk about the course, about the history of programming languages, about the final, and about anything else you want to talk about.

Lab 13. Work on Matlab assignments. Use this lab to work on the Matlab assignment. You can get help from the TA and the consultants.   A7 pdf file

Lecture 24. Nov 18 (Tuesday). Matlab.
This lecture introduces you to array operations in Matlab and to plotting. Using them, you will see how to calculate and plot succesive approximations to pi, without having to write a loop or use recursion! This illustrates some of the power of Matlab.   pdf    powerpoint    Euler.m    darts.m    minmax.m


Lecture __. Nov 23 (Thursday). Thanksgiving break.

Lab 12. Free Lab. Because of the Thanksgiving Holidays, there is no special lab session hit week. On Tuesday, the lab will be open and the TA will be there, but you can do what you want, and get help if you need it.

Lecture __. Nov 21 (Tuesday). No lecture.
In place of this lecture, we ask that you spend several hours this week practicing Matlab. Learn how to us the "Help" facility. Learn about the different panes in the Matlab window and practice writing expressions and assignments. Write a few m-files --both script files and some simple functions-- and test them. Figure out how to write if statements and loops, and write and test a few. Your ability to use Matlab will depend not on listening to lectures but on practising.


Lecture 23. Nov 16 (Thursday). Matlab.
We start our four-lecture discussion of Matlab, a programming language that is used heavily in some engineering disciplines. We do not require you to get a textbook for the Matlab portion of the course. Instead, we provide some very brief notes. And, in teaching Matlab, we focus on the part that makes it different from most other programming languages and useful in engineering: its use of various operations on arrays and ability to produce graphs easily. pdf    powerpoint     notes.pdf

Lab 11. Formating in different Locales. In Java, a "locale" is a country together with a language. Class Locale has over 100 instances of Locales defined, and with each, you can retrieve methods that format decimals, currencies, and percentages the way people do it in that Locale. In this lab, you will see how OO techniques make it easy to work with different locales, and you will also see the many different ways that different cultures format numbers. And, the US is in the minority here. pdf    html    JLiveWindow.java    MyJLiveWindow.java

Lecture 22. Nov 14 (Tuesday). Applications and Applets.
A stand-alone Java program --one that can be executed outside of DrJava-- is either an "application" or an "applet". Applets can be executed from a conventional html web page. We show you how to make a Java program into an application and into an applet. pdf    powerpoint


Lecture 21. Nov 09 (Thursday). Listening to GUIs. We show how to listen to mouse clicks on buttons, mouse clicks in on components, and keystrokes.
pdf file   powerpoint file   java files used in class (zip file)    other examples of gui-listeners (zip file)

Lab 10. Timing execution. We show you how to determine how much time a method takes on your computer and use this idea to compare the times of linear search and binary search and the times of insertion sort, selection sort, and quick sort. pdf   html    Sorting.java    TestArrays.java

Lecture 20. Nov 07 (Tuesday). Placing components in a GUI
We discuss GUIs and show how components can be placed on them. We discuss the kinds of components that exist. We show how to lay out components on a JFrame (with layout manager BorderLayout), JPanel (with layout manager FlowLayout), and Box (with layout manager BoxLayout). After the lecture, listen to lectures on the CD ProgramLive in chapter 17 --that's the best way to learn the stuff. pdf    powerpoint


Lecture 19. Nov 02 (Thursday). Arrays of arrays, and Pascal's triangle
We look at two-dimensional arrays. We describe how they are created and stored, leading us to talk about "ragged" arrays, in which different rows can contain different numbers of elements. We look at Pascal's triangle and various algorithms that deal with two-dimensional arrays.    pdf    powerpoint    opticalillusions.pps (840KB)

Lab 09. Reading and writing files. We show you how to read lines from text files on your hard drive. Writing is just as easy; look at relevant parts of the text and lectures on the ProgramLive CD.   pdf    html   Lab09.java    test.txt

Lecture 18. Oct 31 (Tuesday). Developing loops: important algorithms
We discuss two ways to find a loop invariant from the pre- and post-conditions. We use them to develop several algorithms, including binary search, selection sort, and insertion sort.     pdf     powerpoint       Sorting.java


Lecture 17. Oct 26 (Thursday). Finding an invariant: important algorithms
We look at how to find an invariant from pictures that describe the pre- and post-conditions of an algorithm that will use a loop and use it to develop some interesting algorithms, including the dutch national flag problem and the partition algorithm of quicksort. We end up writing a first version of the sorting algorithm Quicksort. pdf    powerpoint    Sorting.java     

Lab 08. Practice with assertions and loops. We provide exercises, to do partly on paper and partly on the computer, to give you practice with loops and assertions.    pdf    word    Lab08.java

Lecture 16. Oct 24 (Tuesday). Arrays.
We begin talking about arrays.   pdf    powerpoint


Lecture 15. Oct 19 (Thursday). Class Vector. The while loop and the four loopy questions
We take a quick look at wrapper classes and review class Vector, showing the new feature of Java 1.5 to make taking things out of a Vector easier. We review the while loop and the four loopy questions. We develop a number of loops: roach explosion, calculating b**c, and calculating the remainder and quotient. IMPORTANT. The important point in this lecture is the development process, using the four loopy questions. This does not come accross in the slides, because they show the result and not the steps that got the result. pdf     powerpoint

Lab 07. Class Vector. An instance of class Vector can contain a list of objects, and the list can expand and shrink. In this lab, we study this class.    pdf    html    Lab07.java

Lecture 14. Oct 17 (Tuesday). The while loop and the four loop questions
We discuss the while loop and look at assertions. We also introduce the four loopy questions, used in developing or understanding a loop.   pdf    powerpoint


Lecture 13. Oct 12 (Thursday). Method calls and loops.
We discuss the "scope box" in the frame for a call. Then, we continue the study of loops. Again, we talk about ranges, and we bring in the notion of asssertions and invariants to help us develop loops and understand loops that others have written.   pdf   powerpoint    assignment on method calls (don't hand in)    KitchenTurtle.java (requires Turtle.java from A4)

Lab __. No formal labs this week because of FALL BREAK!

Lecture __. Oct 10 (Tuesday). FALL BREAK!


Lecture 12. Oct 05 (Thursday). Loops.
We start out showing you about programming assignment A4, which has to do with drawing using a "turtle". We demoed all the exciting things you will be doing in this assignment. We then began our discussion of the for loop, showing how it can be used to "process" a range of integers.    pdf   powerpoint

Lab 06. Recursions. You will write a number of recursive methods.    pdf    html    Rec.java

Lecture 11. Oct 03 (Tuesday). Recursion!
We develop a few more recursive procedure, including the mind boggling on to tile Elaine's kitchen. We also look carefully at how recursive calls are executed.   pdf   powerpoint  Silly quips on jobs   Demo.java: recursive methods from class       KitchenTurtle.java (requires Turtle.java from A4)


Lecture 10. Sept 28 (Thursday). Casting about
You know about casting from int to double and double to int, e.g. (int) 3.4. We now show you how to cast from one class-type to another and discuss why this is useful. This is the last lecture on classes.   pdf   powerpoint

Lab 05. Random numbers and wrapper classes . You will implement a little game that requires the use of random numbers. and you will learn about wrapper classes, especially class Integer.  pdf   html   GuessMyNumber.java

Lecture 09. Sept 26 (Tuesday). Recursion!
We introduce recursion: a method calling itself. This provides power and flexiblity that we haven't had yet, and you will (should) be amazed at how simple it will be to do neat things.   pdf   powerpoint


Lecture 08. Sept 21 (Thursday). Odds and ends on classes
We review some material about classes and make some points about overriding, method equals, and constructors in subclasses. We also finish method anglicize from last lecture and talk about stepwise refinement.    pdf   powerpoint

Lab 04. Writing functions. You will practice writing functions. These have to do with manipulating Strings, a topic that you will have to know for prelim 1. An important point should become clear: a value of String is an object (manilla folder), so a test s1 == s2  where s1 and s2 are Strings tests whether they are the same folder or not. Method sa.equals(s2) should be used to test whether two Strings have the same value.  pdf   html   Methods.java

Lecture 07. Sept 19 (Tuesday). Inside-out, super-this, and stepwise refinement
We illustrate the inside-out rule for referencing variables and methods that is in most programming languages. We show a problem and introduce this and super to solve them. (Another use of super and this, which you need to know for the prelim, will be shown on Thursday.) And we talk about stepwise refinement as a way to think about the development of methods from their specifications.    pdf   powerpoint    Anglicize.java


Lecture 06. Sept 14 (Thursday). Methods
We look more closely at how a method call is executed. We show the four steps involved in executing a method call. We introduce conditional statements and return statements. We also introduce local variables. We now have four kinds of variable: parameter, static variable, field, and local variable. You should know where and how each is declared and what its scope is.   pdf   powerpoint

Lab 03. Two topics: testing and static variables. You will practice creating and test class to test and help find bugs in a class that we give you. Also, we give you some things to do to make clear to you when methods can be made static.   pdf   html   ThreeDimPoint.java

Lecture 05. Sept 12 (Tuesday). Static variables; testing programs; preconditions
We introduce the idea of a static variable and discuss why we might want them. We talk about a "precondition" of a method, which is simply a constraint on its parameters that a call must satisfy. We spend most of the time talking about testing programs.   pdf   powerpoint   Chapter.java   ChapterTester.java


Lecture 04. Sept 07 (Thursday). Customizing a class (continued)
We discuss several things: (1) class Object, the superest class of them all, (2) function toString, which should be written in almost every class, (3) fields, and getter and setter methods for them, (4) constructors, and, if there is time, (5) static variables.    pdf   powerpoint    

Lab 02. Objects and classes. You will practice creating and manipulating JFrame objects using DrJava's interactions pane. Then, you will write your first class definition —a subclass of JFrame, and experiment with it.   pdf   html

Lecture 03. Sept 05 (Tuesday). Customizing a class
We introduce the class definition, which describes the format of all manila folders (object, instances) of a class and defines its methods. This is illustrated using a "subclass" of JFrame to customize it to our needs. We also show how to create a "specification" of the class using the javadoc facility.   pdf    powerpoint


Lecture 02. August 31 (Thursday).
We define what an object (manilla folder) is and demo the creation and manipulation of objects in DrJava. This material, in Sect. 1.3 of the text, is the basis for the next lecture, so study the material and practice using DrJava. Look at the self-study exercises in the text and do some of them. The more you practice, the easier it will seem.   pdf    ppt

Lab 01. Java expressions. This lab gave you practice with Java expressions and the assignment using the DrJava Interactions pane.   pdf   html

Lecture 01. August 29 (Tuesday). Java expressions
We discuss evaluating Java expressions, as discussed in Secs. 1.1 and 1.2 of the text. We cover types int, double, boolean, and String. We show how to cast between int and double. And we introduce the assignment statement. Lab 01 gives you practice with these features of Java. Lecture handout:   pdf    powerpoint


Lecture 00. August 24 (Thursday). Introduction
We discussed the differences among CS100J, CS100M, and CS100R. We looked at the course web page http://www.cs.cornell.edu/courses/cs100j/2006fa/, giving us a chance to tallk about academic integrity, grades, exams, labs, handouts, the course syllabus, DrJava, etc. We did start talking about Java expressions but did not get far. We will do this again, completely, in the next lecture. The best things you can do at the moment for this course is to download DrJava onto your computer —DrJava is the the programming environment we use, and it is free— and to become familiar with the CD that is at the back of the course textbook. Look on the course web page for information on these topics.