CS100J Spring 2005. Summary of lectures
Lecture 28. May 05 (Thursday). xxx. Conclusion
Lab 14. May 03. xxx. Work on assignment A7.
Lecture 27. May 03 (Tuesday). xxx. Applications. We look at java applications and applets and show how to create a jar file. Powerpoint.ppt Powerpoint.pdf
Lecture 26. Apr 28 (Thursday). xxx. Matlab.
We discussed Matlab functions. A large part of the lecture was devoted to showing
how to calculate with arrays. For this purpose, we showed three different ways
of approximating pi: by throwing darts, by Wallis's formula, and by Euler's
formula. Powerpoint.ppt Powerpoint.pdf
The links are to .m files that contain functions: Binary
search darts Euler
approx statistics
Lab 13. Apr 16. xxx. This lab was devoted to doing assignment A7 (Matlab).
Lecture 25. Apr 26 (Tuesday). We discussed
Matlab scripts. We showed how to write a function to do a binary search.
powerpoint.ppt powerpoint.pdf
example
of script
Lecture 24. Apr 21 (Thursday). Matlab. Class
canceled
Lab 12. Apr 19. Matlab. In this lab, you will begin using Matlab. rtf file pdf file
Lecture 23. Apr 19 (Tuesday). Matlab. We
showed how to use the command window in Matlab and showed demoed the creation
of arrays.
handout.html handout.pdf
Lecture 22. Apr 14 (Thursday). xxx. Exceptions. We discussed exception handling, which is the topic of chapter 10 of the text. The material won't be tested, but we hope you will scan the chapter and come away with the basic idea behind throwing and catching exceptions. powerpoint pdf file Demo.java Keyboard.java
Lab 11. Apr 12. xxx. This pencil-and-paper lab deals with developing array algorithms that use loops. doc file pdf file
Lecture 21. Apr 12 (Tuesday). Array algorithms. We develop more array algorithms, including the partition algorithm and two sorting algorithms. There is a quiz on Thursday, 14 April. You have to be able to develop several algorithms. See these slides: pdf file
Lecture 20. Apr 07 (Thursday). Array algorithms. We developed linear search, finding the min, binary search, and the dutch national flag algorithms. You are expected to be able to develop these algorithms for prelim 3, as presented in this class, the text, or the ProgramLive CD. There are no lecture notes; we used the blackboard.
Lab 10. Apr 05. Formatting in locales. A locale is a country together with a language. E.g. Canada-English and Canada-French. Different locales write numbers and currencies and percentages in different ways. We explore this issue in this lab. html file pdf file JLiveWindow.java MyJLiveWindow.java
Lecture 19. Apr 05 (Tuesday). GUIs. We show
you how to create a Graphical User Interface, or GUI. You won't be tested on
this material, but those who pursue this further will find the topic interesting
and fun. If you decide to create your own GUI for something, it is easier to
start with an existing one and modify it. The best way to learn more about GUIs
is to listen to Chapter 17 on the ProgramLive CD!! And look at the examples
there.
ppt file pdf
file ComponentExample.java MazeGUI.java ButtonDemo1.java AllCaps.java
Lecture 18. Mar 31 (Thursday). Two-dimensional arrays.
Lab 09. Mar 29. Reading files. We show you how to read a file. This material is covered well in Sec. 5.9 of the text, and the ProgramLive CD lectures on it are even better. html pdf Lab09.java test.txt
Lecture 17. Mar 29 (Tuesday). More on arrays. We talk a bit about the next assignments A5 and A6. We develop a few array algorithms. We talk about maintaining a table of values in an array. powerpoint pdf File Demo.java (contains the methods we wrote in class.)
Lecture 16. Mar 17 (Thursday). Arrays. We discuss out last Java feature, the array. Like the Vector and the String, an array can contain a list of elements, which are numbered 0, 2, 3, ... powerpoint pdf
Lab 08.
Mar 15. Abstract classes and methods; drawing shapes. We show
you what an abstract class and abstract method are and why you might want to
use them. We also introduce you to a hierarchy of classes for drawing shapes.
html pdf
DemoShapes.java Shape.java Parallelogram.java Rhombus.java Square.java
Lecture 15. Mar 015 (Tuesday). For-loops. We introduce the for-loop as an abbreviation for some while loops. powerpoint pdf
Lecture 14. Mar 10 (Thursday). Loops and assertions.
Lab 07.
Mar 08. Loops and assertions. This lab (1) gives you practice
in assigning to variables to truthify assertions and (2) asks you to develop
four while loops. rtf
pdf File
Lab07.java
Here are more exercises on loops: rtf
pdf answers
to the first 10: LoopExercises.java JUnit
tester for answers
Lecture 13. Mar 08 (Tuesday). Loops and assertions. We finish a discussion of assertions. Then, we talk about the development of a loop using a loop invariant to guide us. We introduce the four loopy questions we ask in order to develop or to understand a loop. After this lecture, study Secs 7.17.3. Also, it will help trmendously to do the self-review exercises in these sections. If you don't understand this material, don't simply do nothing; get help from Gries, a TA, or a consultant immediately. powerpoint pdf
Lecture 12. Mar 03 (Thursday). Loops and assertions. We begin our discussion of loops with an introduction to the while loop. In preparation for later work, we spend interactive time on assertions and truthifying them. powerpoint pdf
Lab 06. Mar 01. Class Vector. Class Vector maintains a list of Objects. Besides the lecture notes, you are responsible for the material in Sec. 5.3 (pp. 184--188) of the course text, which discusses class Vector. html pdf File Lab06.java
Lecture 11. Mar 01 (Tuesday). This lecture covers the notion of casting among types (just as you can do a cast (double) 5 and (int) 3.4). It discusses operator instanceof and shows you the proper way to write function equals. powerpoint pdf
Lecture 10. Feb 24 (Thursday). Review for this evenings prelim. Gries is out of town today. Two TAs will lead the class in a review for tonight's prelim. You can ask any questions you want.
Lab 05. Feb 22. Writing functions. You will write a number of functions that manipulate Strings. html pdf File Methods.java
Lecture 09. Feb 22 (Tuesday). Methods. The class is devoted to the development of an algorithm to anglicize integers. An important point arises: the need to define local variables in a comment near their declaration. We also saw a PLive lecture on Edgar Allen Poe's "The Raven", on top-down design. The two classes provided below contain the methods for anglicizing integers andfor testing those methods. We made some adjustments after the fact to make sure that blanks were properly inserted. powerpoint pdf Anglicize TestAnglicize
Lecture 08. Feb 17 (Thursday). Methods continued. We introduced the local variable. We looked at the syntax of the three kinds of method definition. We looked at the syntac of the three kinds of method call. We began discussing the development of method bodies using "stepwise refinement". And, we looked in more detail at the contents of the frame (or box) for a method call. powerpoint. pdf class Demo class TwoString
Lab 04. Feb 15. Strings and wrapper classes. This lab leads you through the use of class String and the wrapper classes like Integer. html pdf
Lecture 07. Feb 15 (Tuesday). Methods. We looked at the definition of procedures and calls on them. We learned how to execute method calls by hand. We introduced the if-statement, the if-else statement, the block, and the return statement in a procedure. The powerpoint slides were revised to include info on assignment A2 and to fix an error. These links are to the revised slides: powerpoint pdf
Lecture 06. Feb 10 (Thursday). We cover some miscellaneous point about classes and subclasses: Inheritance and overriding, constructors, use of super and this, and methods equals and toString. powerpoint slides pdf class Employee class Executive
Lab 03. Feb 08. Testing classes and using static variables. This lab gives you practice with the material in Lecture 05. html Class ThreeDimPoint.
Lecture 05. Feb 08 (Tuesday). Testing classes and
using static variables. power
point slides pdf Class
Chapter Class
ChapterTester
We talked about debugging. We showed how to use the JUnit
testing facility in DrJava to create and save test cases and to run them whenever
we want. We talked about static variables and fields. Finally, we discuss specifications
of methods a bit, indicating what a "precondition" is (see the last
ppt slide). In case you want the pictures shown just before the lecture started,
here they are, in a zip file.
Lecture 04. Feb 03 (Thursday). Customizing a class.
power point slides pdf
class
Chapter
We developed a class Chapter. The purpose of this lecture
was to (1) Show how to declare fields (we make them private so they can't be
referenced directly outside the class), (2) exhibit getter functions and setter
procedures, (3) illustrate a variable of class Chapter, and (4) introduce the
idea of a constructor. We also introduced class Object, which automatically
extends classes that don't explicitly extend another class. Topics to be covered
next time: function toString(), static components (fields and methods), and
the testing of programs.
Lab 02. Feb 01. JFrame objects and extending class JFrame. This lab got people familiar with class JFrame and the notion of extending a class. html pdf
Lecture 03. Feb 01 (Tuesday). Customizing a class.
power point slides pdf
class
SquareFrame
We developed a class SquareFrame that extended class JFrame.
This means that every folder or object of class SquareFrame contained all the
fields and methods that a JFrame folder did, plus the fields and methods declared
directly in class definition SquareFrame.
Lecture 02. Jan 27 (Thursday). Objects.
power point slides pdf
We introduced the notion of a class and objects of that class. An object is
just a manila folder, and a class is a file drawer that contains manila folders.
A manila folder may contain variables (fields) and methods. Methods are either
functions (which yield a value when called) or procedures (which do something
when called). We talked about importing a bunch of classes. And we looked at
class JFrame, which is in package javax.swing. We demoed all this in DrJava.
Lab 01. Jan 26. Java expressions. This lab got people familiar with DrJava and evaluating expressions in the interactions pane. html pdf
Lecture 01. Jan 25 (Tuesday). Java expressions.
power point slides pdf
The major part of this lecture was devoted to going over
Java expressions, as discussed in Secs. 1.1 and 1.2 of the text. By the next
lecture, you should have read these sections and looked at related activities
in the CD ProgramLive.