Code Examples and Reading Assignments

This page documents what we do in class. It contains Java programs that we will discuss in class, reading assignments from our textbook, simple homework exercises that you can work on for practice and exam preparation (not for credit), and links to other sources of information.

The reading assignments and practice problems are listed by the date on which they were assigned. The sample program files are listed by the date on which they were used. You can click on either a .java link and see the source code, or click on a .html link (when available) and see an applet running. When you are viewing the source code, you can use your browser's "File -> Save As..." menu item to save a copy of the file on your computer. It is a good idea for you to "play" with these example programs; compile them, run them, make simple changes to them and compile and run them again.

  • Wdnesday, December 9.
    • Remember that the final is on Monday, December 14, at 1:00.
    • For next semester, it would be a good idea for you to have a Java reference book where you can look up the Java definitions of ideas like inheritance, polymorphism, overriding, interfaces, files, and exceptions (which you will learn in C++). Here is a good choice.
  • Monday, December 7.
    • For Wednesday, read Chapter 12, Sections 12.1-12.3.2 (pages 387-399).
    • Here is an example that shows how a "public interface" can have two different "private implementations". Each Hat class below implements the same public interface, but they have very diferent private implementations of that public interface.
  • Wdnesday, December 2.
  • Monday, November 30.
    • See the homework page for your ninth homework assignment.
    • For Wednesday, read Chapter 11, Sections 11.1-11.5 (pages 343-366).
    • Here is a collection of Power Point slides, prepared by the authors of the textbook, for the chapters about sound.
    • If you want to create your own .wav files from some mp3 files, a good tool for examining, converting, and editing sound files is the free program Wavosaur (Wavosaur is simpler than Audacity).
  • Monday, November 23.
    • For next Monday, read Sections 8.3-8.4 (pages 271-285), Section 9.4 (pages 304-306), and Sections 10.1-10.4 (pages 312-325).
    • Here are some example sound programs.
    • Here is a zip file containing three 30 second music (wav) files. These are a bit more interesting to work with than the examples from the textbook.
    • If you want to create your own .wav files from some mp3 files, a good tool for converting and editing sound files is the free, open source program Audacity.
  • Wednesday, November 18.
    • The second exam is today.
    • For Monday, read Sections 8.1-8.2 (pages 252-271).
  • Monday, November 16.
  • Wednesday, November 11.
  • Monday, November 9.
    • The second exam will be on Wednesday, November 18, one week later than what is stated in the syllabus (because I was scheduled for jury duty this week).
    • For Wednesday, read Sections 7.3 and 7.4.
    • Here are some example programs from Chapter 7.
    • Here are two examples "bitmapped vs. vector" graphics. You can view the "ps" and "eps" files using InfranView, which is in the C:\cs123\tools\ folder. These are "PostScript" files.
    • Here is an interesting news article on what research in "image processing" can lead to ("image processing" is the term used for the science of manipulating pixels in a picture).
  • Wednesday, November 4.
  • Monday, November 2.
    • I have added the jGRASP Java developement environment to the cs123.zip file. I added this developement environment because jGRASP's debugger is much better than DrJava's debugger (you can read a brief explanation of DrJava's debugger in Section 11.2.6 (pages 352-356) of our textbook). Here is what you need to do to start using jGRASP and its debugger.
      1. Download the cs123.zip file onto your desktop, unzip it onto your desktop, and open the resulting cs123 folder.
      2. Copy the sub-folder called jGRASP to your C:\cs123\ folder.
      3. Copy the file called jGRASP.exe to your C:\cs123\ folder (you double click on this file to start jGRASP).
      4. Copy the file called jGRASP Tutorials.pdf to your C:\cs123\ folder.
      5. Read the jGRASP documentation about its debugger (this documentation is also part of the jGRASP Tutorials.pdf file).
      6. If you want to use jGRASP with the Java classes from our textbook, you need to tell jGRASP where to find those classes (just as we did with DrJava). Use the jGRASP "Settings -> PATH/CLASSPATH -> Workspace" menu item and then in the resulting window click on the "CLASSPATH" tab. Then click on the "New" button. Click the "Browse" button next to the "Path or JAR File" textbox. Navigate to the C:\cs123\ folder and select the bookClasses folder (but don't open that folder) and then click the "Choose" button. Then click on the "OK" buttons of the succesive windows.
  • Wednesday, October 28.
  • Monday, October 26.
  • Wednesday, October 21.
  • Monday, October 19.
  • Wednesday, October 14.
  • Monday, October 12.
  • Wednesday, October 7.
    • Today was the first midterm exam.
    • For Monday, read Sections 5.1 - 5.2.1 (pages 131-149).
  • Monday, October 5.
  • Wednesday, September 28.
    • Remember that the first midterm exam for this course is next Wednesday, October 7. The exam will be over the first four chapters of the textbook. Be sure to review the practice problems that are assigned below for each chapter.
    • Here is a collection of Power Point slides prepared by the authors of the textbook. These can be used as a way to review the first four chapters of the textbook for the exam.
    • Here are some example Java programs.
  • Wednesday, September 28.
  • Wednesday, September 23.
  • Monday, September 21.
    • For Wednesday, read Chapter 4, Sections 4.3.4 - 4.3.7 (pages 109-119).
  • Wednesday, September 16.
    • See the homework page for your third homework assignment.
    • For Monday, read Sections 4.3.1 - 4.3.3 (pages 91-109).
    • I added some tools for working with pictures and pixels to the cs123.zip file, so you should download the zip file again and copy the new tools into your C:\cs123\ folder.
  • Monday, September 14.
  • Wednesday, September 9.
    • See the homework page for your second programming assignment.
    • For next Monday, read Chapter 3, Sections 3.6 - 3.7 (pages 59-71).
    • Do the following practice problems from the end of Chapter 3 (pages 72-73): Problems 3.1, 3.2, 3.5, 3.7, 3.8, 3.9, 3.11.
    • Here is an example Java program that demonstrates the difference between primitive variables and object variables (also called "reference variables").
  • Wednesday, September 2.
  • Monday, August 31.


Return to the CS 123 home page.


compliments and criticisms