Click here for expected future lectures

Here are lecture notes and lab notes:


 

Lab 12. 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 24. 2 December (Tuesday). 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, or one can double-click on them to start t. Applets are started when an html web page contains the proper "applet tag". We show you how to make a Java program into an application and into an applet.    pdf    ppt


Lecture. 27 November (Thursday). Thanksgiving break

Lab. Thanksgiving break

Lecture. 25 November (Tuesday). No lecture.


Lecture 23. 20 November (Thursday). Listening to GUIs.
We show how to listen to mouse clicks on buttons, mouse clicks in on components, and keystrokes.
pdf   ppt   javaFilesUsedInClass (zip file) and other examples of gui-listeners: See Chapter 17 of the CD ProgramLive
.

Lab 11. Exception handling. This lab asks you to study and write code that uses exceptions, throw clauses, try-statements, etc. pdf   doc   Lab11.java

Lecture 22. 18 November (Tuesday). 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 used 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


Lecture 21. 13 November (Thursday). 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

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. 11 November (Thursday). 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. We develop insertion sort, selection sort, and the recursive quick sort. We give a historical perspective on programming.    pdf    powerpoint    Sorting.java
Put this file spin.gif intoyour favorite browser and take the left-brain-right-brain test. This website discusses whether this spinning dancer tells you anything about your brain: scienceline.org/2007/10/29/ask-hsu-spinning-girl-right-left-brain-hemispheres/


Lecture 19. 06 November (Tuesday). Finding an invariant: important algorithms.
We develop linear search, partition algorithm, and binary search.    pdf    powerpoint    Sorting.java

Lab 09. Abstract classes and methods. We introduce the notions of abstract classes and methods and state why they are useful. The example program you will play with gives you practice with them.    pdf   html  DemoShapes.java  Shape.java  Parallelogram.java  Rhombus.java  Square.java

Lecture 18. 04 November (Tuesday). More on arrays.
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 that have loops.     pdf    ppt    Sorting.java  


Lecture 17. 30 October (Thursday). Assignmen 6, and debugging.
We discuss assignment A6, Mozart's WuerfulSpiel. We then talk about deubgging a program. The powerpoint slides do not show everything we did because we concentrated on finding errors using DrJava. However, you can look at the lecture at http://www.videonote.net.  pdf    ppt

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. 18 March (Tuesday). 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 notation b[i] for accessing element i of array b.   pdf     ppt


Lecture 15. 23 October (Thursday). The while loop.
We introduce the while loop, 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. For-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. 21 October (Tuesday). More on loops.
We continue with the discussion of developing for-loops that process a range of integers, using postconditions and invariants.   pdf    ppt


Lecture 13. 16 October (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


Lecture 12. 09 (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. And we a talk about a new operator, instanceof. This is the last lecture on classes. pdf   ppt

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

Lecture 11. 07 October (Tuesday). Recursion!
We develop a few more recursive procedures, including Hilbert's space-filling curve. As we figure out how many recursive calls one function makes, we will have to discuss the binary number system. pdf   ppt  Silly quips on jobs. D.java (contains two recursive functions)   Work.txt  

Turtle.java    Demo.java. Load Turtle.java and Demo.java into DrJava. Compile. Create an instance d of class Demo. Then call d.doAHilbert --see its specification.


Lecture 10. 02 October (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    D.java (contains functions we wrote in class)

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. It will be used in a lot of our future work.   pdf    html    Lab05.java

Lecture 09. 30 September (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 Time.java


Lecture 08. 25 September (Thursday). Odds and ends on classes. Stepwise refinement
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    ppt   two classes to anglicize:   Ang   AngTester

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 s == t  where s and t are Strings tests whether they are the same folder or not. Method call s.equals(t) should be used to test whether two Strings have the same value.  pdf   html   Methods.java

Lecture 07. 23 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 will be shown on Thursday.) Finally, we talk about stepwise refinement as a way to think about the development of methods from their specifications and develop a few methods from their specifications.   pdf    powerpoint  Demo.java


Lecture 06. 18 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 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. We introduce conditional statements and return statements.   pdf   ppt

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. 16 September (Tuesday). The class hierarchy; static variables; more on testing.
We continue our discussion of 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.  pdf   ppt   Chapter.java   ChapterTester.java


Lecture 04. 11 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    Chapter.java    ChapterTester.java

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. 09 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. 04 September (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. 02 September (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. We introduce the variable, declaration, and assignment statement. Lab 01 gives you practice with these features of Java. Lecture handout: pdf    ppt


Lecture 00. 28 August (Thursday). Introduction to the course. Java expressions
We tell you what the course is about and what we hope you will learn. We show you some of the assignments you will be doing. We compare CS1110 to the Matlab course, CS1112. Then, we start on our first topic, Java expressions.:  ppt   pdf


 

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

 

Lab 12. 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. 10 Apr (Thursday). Two-dimensional arrays
After We look at two-dimensional arrays as rectangular arrays. We then show how Java implements two-dimensional arrays and explain how one can have ragged arrays —arrays where different rows can have different numbers of columns. pdf   powerpoint

 

 opticalIllusions.pps