Click here to see future expected lectures and labs.

Lecture 23. 15 Nov (Thursday). xxx.
We discuss.

Lab 11. Timing execution. We show you how to time execution of a method call and ask you to compare times for various searching and sorting methods.   pdf    doc    Sorting.java    TestArrays.java

Lecture 22. 13 Nov (Tuesday). Listening to GUIs.
After presenting Quicksort, we show how to listen to mouse clicks on buttons, mouse clicks in on components, and keystrokes.
pdf   powerpoint   javaFilesUsedInClass (zip file) and other examples of gui-listeners: See Chapter 17 of the CD ProgramLive.


Lecture 21. 8 Nov (Thursday). Placing components in GUIs.
We look at placing components in GUIs. The important points we want you to remember is how a BorderLayout manager is ued to place components in a JFrame, a FlowLayout manager in a JPanel, and a BoxLayout manager in a Box (and what this all means!).After the lecture, listen to lectures on the CD ProgramLive in chapter 17 --that's the best way to learn the stuff. pdf    powerpoint   zip file containing demos

Lab 10. Exercises with loops. This lab asks you to develop loops from specifications and given invariants, giving you practice with our methdology for developing loops.   pdf   doc

Lecture 20. 6 Nov (Tuesday). Finding an invariant: important algorithms.
We continue look at how to combine diagrams for pre- and post-conditions of an algorithm into an invariant for a loop and use it to develop some interesting algorithms.    pdf    powerpoint    Sorting.java  


Lecture 19. 1 Nov (Thursday). Developing important algorithms
After an interlude with Steve Shuster, Director of IT Security at Cornell, we look at how to combine diagrams for pre- and post-conditions of an algorithm into an invariant for a loop and use it to develop some interesting algorithms, including the dutch national flag problem and the partition algorithm of quicksort.    pdf    powerpoint    Sorting.java  

Lab 09. Formating in Locales. A "locale" is a country and language. Different countries and languages have different ways of writing numbers, percentages, and currencies. This lab shows how JavJava class Locale makes it easy to use the formats of many countries.    pdf   html   JLiveWindow.java   MyJLiveWindow.java

Lecture 18. 30 Oct (Tuesday). More on arrays.
We develop a few algorithms that manipulate arrays —copying an array, testing whether two arrays are equal, implementing a tale of values in an array, and so on.   pdf    powerpoint


Lecture 17. 25 Oct (Thursday). Arrays.
We introduce arrays. An array, like Vector, is an object that can contain a list of things. A variable of type int[] contains the name of an object that contains a list of ints. A variable of type JFrame[] contains the name of an object that contans a list of JFrame objects. Type array is built into Java; there is a nice notatioin b[i] for accessing element i of array b.   pdf     powerpoint

Lab 08. Reading files. We show you how to read a file that is on your harddrive. Reading a keyboard and writing as file is just as easy.   pdf    html    Lab08.java    test.txt

Lecture 16. 23 Oct (Tuesday). Exceptions.
An "Exception" is an event like division by 0, or a subscript out of range. Java has a nice facility for handling and recovering from Exceptions.   pdf    powerpoint


Lecture 15. 18 Oct (Thursday). The while loop.
We introduce the while loop, talk relate it to the for-loop, talk about the four loopy questions for understanding a while loop, and develop some while loops.   pdf    powerpoint

Lab 07. Loops and assertions. This lab deals with some paper-and-pencil exercises on ranges, assertions, and for-loops. It also asks you to write four functions whose bodies contain for-loops.   pdf    rtf    Lab07.java

Lecture 14. 16 Oct (Tuesday). More on loops.
We continue with the discussion of developing for-loops that process a range of integers, using postconditions and invariants, We end with a short introduction to while loops.   pdf    powerpoint


 

Lecture 13. 11 Oct (Thursday). Turtles and loops
We discuss briefly how to draw on a panel of a JFrame using a "Turtle" —you will do this in assignment A5. We then begin a discussion of loops, starting with a for-loop to process a range of integers.. pdf   ppt

9 Oct (Tuesday). Fall break!


Lecture 12. 4 Oct (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   ppt     Work.txt

Lab 06. Recursion. You will write at least 5 recursive functions.   pdf    html   Rec.java

Lecture 11. 2 Oct (Tuesday). Recursion!
We develop a few more recursive procedure, including Hilbert's space-filling curve. We also look carefully at how recursive calls are executed.   pdf   powerpoint  Silly quips on jobs   Demo.java: recursive methods from class.


Lecture 10. 27 Sept (Thursday). 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

Lab 05. 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    Lab05.java

Lecture 09. 25 Sept (Tuesday). Wrapper classes and stepwise refinement!
Each primitive type has an associated "wrapper class". An object of the wrapper class contains one value of the primitive type. We show you why this is useful. We also spend more time developing an algorithm, showing you "top-down programmng" and "stepwise refinement".   pdf   ppt


Lecture 08. 20 September (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   two classes to anglicize:   Ang   Anglicize

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. 18 September (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 it. (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. 13 September (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 a 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. 11 September (Tuesday). The class hierarchy; static variables; more on testing.
We talk about the class hierarchy and show you the superest class of them all: Object. We discuss function toString. We introduce static variables. We end with a second discussion of testing.  pdf   powerpoint   Chapter.java   ChapterTester.java


Lecture 04. 06 September (Thursday). Customizing a class (continued) and testing
(1) We discuss fields and getter and setter methods for them. (2) We introduce the constructors, whose purpose is to initialize (some) fields of a newly created object. (3) We show you how to test the methods in a class using a JUnit tester.   pdf   ppt

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. 04 September (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.  And we talk about null.   pdf   ppt


Lecture 02. 30 August (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    powerpoint

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

Lecture 01. 28 Aug (Tuesday). Java expressions, variables, declarations, and assignments
We continue discussing expressions in Java (Secs. 1.1 and 1.2) of the text. We show how to cast between int and double. And we introduce the variable, declaration, and assignment statement. Lab 01 gives you practice with these features of Java. Lecture handout:   pdf


Lecture 00. 23 August (Thursday). Introduction and Java expressions
We introduce you to the course. We spend some time discussing evaluating Java expressions, as discussed in Secs. 1.1 and 1.2 of the text. We cover types int, double, boolean, and String. pdf

 

 

 

 

 

 

Below is a list of the expected topics of future lectures and labs.

All the links may not work, and they are to old versions of material. So don't use them.


Lecture 28. 03 May (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 27. 01 May (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 26. 26 Apr (Thursday).

Lab 12. Free Lab. To be defined later.

Lecture 25. 24 Apr (Tuesday).


 

Lecture 24. 19 Apr (Thursday). Exceptions.

Lab 12.

Lecture 23. 17 Apr (Tuesday).


Lecture 22. 12 Apr (Thursday). Applications and Applets.
A stand-alone Java program --one that can be executed outside of DrJava-- is either an "application" or an "applet". An application can be executed from a command line in a "terminal" or "DOS" window. 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 20. 05 Apr (Thursday). Placing components in a GUI

 

Lecture 19. 03 Apr (Tuesday). Sorting. Arrays of arrays. Pascal's triangle.
We first introduce 2-3 sorting algorithms. We then turn to a discussion of two-dimensional arrays and describe how they are created and stored, leading us to talk about "ragged" arrays, in which different rows can contain different numbers of elements.   pdf    powerpoint  


Lecture 18. 29 Mar (Thursday). Develop loops: important algorithms.
We develop more algorithms that manipulate arrays.     pdf     powerpoint       Sorting.java

Lab 09. Formating in Locales loops. A "locale" is a country and language. Different countries and languages have different ways of writing numbers, percentages, and currencies. This lab shows how JavJava class Locale makes it easy to use the formats of many countries.    pdf   html   JLiveWindow.java   MyJLiveWindow.java

Lecture 17. 27 Mar (Tuesday). Finding an invariant: important algorithms.
We look at how to combine diagrams for pre- and post-conditions of an algorithm into an invariant for a loop and use it to develop some interesting algorithms, including the dutch national flag problem and the partition algorithm of quicksort.    pdf    powerpoint    Sorting.java  


 

Lab 09. Formating in Locales loops. A "locale" is a country and language. Different countries and languages have different ways of writing numbers, percentages, and currencies. This lab shows how JavJava class Locale makes it easy to use the formats of many countries.    pdf   html   JLiveWindow.java   MyJLiveWindow.java