Lecture 28. May 04 (Thursday). Matlab. Conclusion.
Lab 14. Free to work on the Matlab Assignment.Lecture 27. May 02 (Tuesday). Matlab. We concentrated on the Matlab paradigm of using elementwise array operations. We developed four functions for approximating pi, the ratio of the circumference of a circle to its diameter. One method involved throwing darts at a dart board. pdf file ppt file
Lecture 26. April 27 (Thursday). Matlab. More on Matlab. Lecture canceled. Gries is out of town, giving a keynote address at a software engineering workshop.
Lab 13. Timing execution. We show you how to time execution of a method call. We use this to compare the times for linear search and binary search, for insertion sort and selection sort, and for selection sort and quick sort. html file pdf file Sorting.java TestArrays.javaLecture 25. April 25 (Tuesday). Matlab. More on Matlab.
Lecture 24. April 20 (Thursday). Applications and applets. We introduce you to the two kinds of stand-alone Java programs: applications and applets. This will allow you to cread Java programs that you can execute even when there is no IDE like Java around. Along the way, you'll see what an html web page looks like. pdf file powerpoint
Lab 12. Matlab. This lab will introduce you to the basics of MatLab. pdf file rtf fileLecture 23. April 18 (Tuesday). Matlab. The programming language Matlab has the array or matrix as a fundamental concept; it has many operations that work on arrays of all sizes. The language also makes it easy to draw graphs and histograms and the like. It is not object oriented. This 8-page handout (a pdf file) summarizes what you need to know about Matlab and serves as a substitute for a text; we don't ask you to buy a textbook
Lecture 22. April 13 (Thursday). Quicksort; Exception handling. We summarize the basic quicksort algorithm and then show how to make it more efficient, with respect to both time and space. Then we turn our attention to the handling of exceptions —like divide by 0 or an IO error. The latter material is best learned by using the ProgramLive CD, Chapter 10. pdf file powerpoint file
Lab 11. Developing loops. This lab is a pencil-and-paper one. We give you a bunch of loops to develop from invariants, all having to do with the algorithms that you are supposed to know. pdf file doc fileLecture 21. April 11 (Tuesday). 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)
Lecture 20. April 06 (Thursday). GUIs. We discuss the placement of components like buttons and text fields in a GUI. This includes components (like JPanel) that can contain other components. We discuss a few layout managers. If you are interested in learning more about GUIs, look at the CD ProgramLive, chapter 17. It introduces you to various aspects of GUIs in a way that is impossible in a book. pdf file ppt file Demo.java (the class with which we demoed the whole lecture)
Lab 10. Formatting in Locales. We discuss Java classes for formatting currencies, percentages, and numbers in the many different styles used around the world. pdf file html file JLiveWindow.java MyJLiveWindow.javaLecture 19. April 04 (Tuesday). Ragged arrays. We show how arrays are implemented in Java. This leads to the concept of a "ragged array", an array in which the rows can have different lengths. We illustrate the use of a ragged array to contain the first n rows of Pascal's triangle, which is enmeshed in combinatorics, the number of ways to choose r elements from a set of size n, and the binomial theorem. The program to be downloaded contains several algorithms that concern Pascal's triangle. pdf html Pascal.java JLiveWindow for fun, the "only in" powerpoint slides
Lecture 18. March 30 (Thursday). Searching and sorting. Continuation of lecture from 28 March. There are no handouts for this lecture. We will do binary search and insertion sort and selection sort and perhaps the partition algorithm.
Lab 09. Reading (and writing) files. Reading and writing files is done through classes in package java.io. We introduce you to reading and processing files of characters. pdf file html file Lab09.java test.txtLecture 17. March 28 (Tuesday). Searching and sorting. We develop algorithms for manipulating arrays. The emphasis is ont the DEVELOPMENT, and you will be expected to be able to develop all these algorithms from their specifications. There are some really neat ones, especially binary search, selection sort and quick sor. The java file gives the algorithms, but don't try to memorize the code! Instead, practice developing the algorithms from their specifications. pdf powerpoint Demo.java TestDemo.java
Lecture 16. March 16 (Thursday). More on arrays. We develop some algorithms that manipulate arrays, we describe our horizontal notation for describing properties of an array, we show how to implement a table of values in an array. Look also at the last part of these slides to see an eigth grade test from 1895! pdf file powerpoint
Lab 08. Exercises on loops. In this lab, you will do some exercises on developing loops using the four lopy questions. pdf file rtf file Lab08.javaLecture 15. March 14 (Tuesday). Arrays. We start our discussion of arrays. An array is an object that can hold a list of objects or values of a primitive type. pdf powerpoint
Lecture 14. March 09 (Thursday). More on loops. We develop more loops, using the four loopy questions. pdf file html file
Lab 07. Class Vector . This lab introduces you to class Vector, an object of which maintains a list of elements (each is an object). pdf file html file Lab07.javaLecture 13. March 07 (Tuesday). Java 1.4 vs Java 1.5. Understanding and developing loops. We begin with a few points about the new Java 1.5 that we are using and the older 1.4, which some students may still have on their computers. We discuss important differences rwith regard to class Vector, which is discussed in this week's lab. We then discuss four loopy questions that are used in developing loops. powerpoint pdf
Lecture 12. March 02 (Thursday). Execution of method calls, while loops, assertions. We discuss once more the execution of method calls, drawing frames for them. Here is an "assignment" (not to be handed in; we'll post the solution later). We also introduce while loops and talk about assertions. ppt file pdf file
Lab 06. Writing recursive methods. This lab gives you practice with writing recursive methods. pdf file html file Rec.java SolutionLecture 11. February 28 (Tuesday). The for-loop. We introduce the for-loop and develop several loops We also introduce you to class Graphics and drawing in a panel on a JFrame, in preparation for assignment A4. powerpoint pdf Demo.java
Lecture 10. February 23 (Thursday). Recursion. We discuss writing "recursive" methods —methods that call themselves. This concept alllows to write function for removing blanks from a String, for counting how many vowels are in a String, for testing whether a String is a palindrome, etc. It also allows such neat programs as HIlbert's space-filling curve. ppt file pdf file class with recursive methods
Lab 05. Writing methods; wrapper classes . This lab introduces you to the wrapper classes Integer, Double, etc. and asks you to use them to write a program plays a little game. You will learn a bit about random number generation. pdf file html file GuessMyNumber.javaLecture 09. February 21 (Tuesday). Casting about. You know how to cast from double to int. We now talk about casting from a subclass to a superclass and back and show why it is useful. We talk about the class hierarchy. And we finally explain all about method equals. powerpoint pdf Here is a Java class with the method to switch the possessive stuff around
Lecture 08. February 16 (Thursday). Class odds-and-ends. We talk about a few more things dealing with classes —for example, we explain how to write a constructor in a subclass. There will be some review, to help you begin preparing for next week's prelim. If there enough time, we do some more "top-down" programming, or "stepwise refinement", as it is called, to give you more practice with it. pdf file ppt file
Lab 04. Writing methods. This lab gives you practice with writing methods that deal with Strings. pdf file html file Methods.javaLecture 07. February 14 (Tuesday). A bit on classes, and stepwise refinement. In this lecture, we talk about the inside-out rule used in most programming language to determine what items can be referenced, and we describe the use of this and super. Then, we talk about the development of methods. powerpoint pdf Anglicize.java
Lecture 06. February 09 (Thursday). Methods. This first lecture on methods, gives precise information on the three kinds of methods in Java. We introduce the if-statement and the local variable, and we give a "model" of execution of a method call that should help you understand better what happens when a method is called. powerpoint pdf
Lab 03. Testing. Static components. This lab gives you practice on the material taught in lecture 05.You will actually test a program and find mistakes in it, and you will see how static components work. pdf file html file file ThreeDimPoint.javaLecture 05. February 07 (Tuesday). Testing and static variables. We begin by introducing the notion of a "precondition". We then introduce the idea of a "static" component. A static component declared in a class does NOT go in every instance of the class. Instead, ONE copy of it goes in the file drawer. We end with a discussion of how to test a program to get some assurance that it is correct, and we show how the JUnit feature of DrJava can help here. powerpoint pdf Chapter.java (used in class).
Lecture 04. February 02 (Thursday). More on classes. We talked about class Object. We discussed method toString, which we put in almost every class we write. We showed how to declare variables in a class --these are called "fields". And we introduced the constructor as a method that initializes (some of) the fields of a newly created object. We stressed the need to memorize what it means to evaluate a "new" expression. ppt file pdf file
Lab 02. Objects and classes. In this lab, you will write your first Java program. A class definition that is a subclass of JFrame. And you will write a few methods in it. pdf file html fileLecture 03. January 31 (Tuesday). First class definition
In this lecture, you will see your first Java program: a very simple class definition. You will also see your first method definitions. We will define both a function and a procedure. This material is discussed in Section 1.4 of the text. Please study it. powerpoint slides pdf file
Lecture 02. January 26 (Thursday). Objects
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. pdf file
ppt file
Lecture 01. January 24 (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. powerpoint slides pdf file