This course ended on May 11, 2009

CPSC 225: Intermediate Programming

   Department of Mathematics and Computer Science
   Hobart and William Smith Colleges

   Spring 2009.

   Instructor:  David J. Eck  (

   Course Handout:

   Monday, Wednesday, Friday, 9:05 to 10:00, Room Napier 202.
   Lab:  Tuesday, 11:55 to 1:20, Room Gulick 208.
   Office Hours:  MWF 10:10--11:05;  Tuesday 10:00--11:45.

Lab 1, January 20
Introduction to Eclipse
Lab 2, January 27
Lab 3, February 3
Recursive Fun
Lab 4, February 10
Recursion in MineSweeper
Lab 5, February 17
Doubly-linked List
Lab 6, February 24
Random Expressions
Lab 7, March 3
Genetic Programming
Lab 8, March 10
CVS / Debugging
Lab 9, March 24
Sets in the JCF
Lab 10, March 31
Arraylists and Files
Lab 11, April 7
A Web Server
Lab 12, April 14
Work on Final Projects
Lab 13, April 21
Working on a GUI
Lab 14, April 28
Complete Lab 13
Lab 15, May 5
Final Project Presentations

Week 15 and End of Term: May 5 and 11

On Monday, May 5, the last day of class, we will review for the final exam and you will fill out course evaluations. The final lab of the term is on Tuesday. Students will present their final projects, and then anyone who wants to go is invited out to lunch at Garcia's.

The final exam in Monday, May 11. Final projects must be handed in by the exam period.

The information sheet for the final exam is available.

Week 14: April 27 and 29; May 1

We will finish coverage of the Model/View/Controller pattern and its application in GUI components such as JList. We will look at some of the other techniques for writing better GUI programs, including some applied in the sample application in the last section of the book, Section 12.5. In lab this week, you can complete Lab 13, and you can work on your final project if you have time.

Week 13: April 20, 22, and 24

We will continue looking into some more advanced aspects of GUI programming, with topics from Section 12.3 and Section 12.4. In lab this week, you will add some features to a GUI program, mainly involving buttons, actions, menus and toolbars.

Week 12: April 13, 15, and 17

We will cover some topics from Chapter 12 this week. We'll start on Monday with Images and BufferedImages. On Wednesday, we'll look at resources and at Graphics2D. By Friday, we should be able to start on buttons and actions. This material is all from Sections 1 through 3 of Chapter 12, but we will not be covering those sections in their entirety.

The lab this week is simply to start work on your final projects.

Week 11: April 6, 8, and 10

We will spend the week covering some more topics from Chapter 11. We will also go back and cover some of the basics of threads, from Section 8.5.

On Monday, we will continue with the discussion of client/server networking. The reading for this is Section 11.4. On Wednesday, we will discuss threads, mainly Section 8.5.1. On Friday, we should go back and spend some more time on files. Note that we will not cover all of Chapter 11. Next week, we will start covering some topics from Chapter 12.

Week 10: March 31; April 1 and 3

There is a test on Friday of this week. An information sheet is available.

We will start Chapter 10 on Monday, but any new material that we cover on Monday or Wednesday will not be on the test.

Week 9: March 23, 25, and 27

In the week before break, we covered most of the material from Section 10.1 and did an overview of the interfaces and classes in the Java Collection Framework. This week, we will cover additional topics from Chapter 10, Sections 1 through 4. We should finish these sections on Monday of next week.

We will also start talking about final projects this week. You should be thinking about what you might like to do for your project and whether you would be interested in working with another student on the project.

Remember that there is a test coming up next week, on Friday, April 3.

Week 8: March 9 and 11

It's Spring Break, from March 13 through 22. There is no class on Friday of this week. Classes resume on March 23. Over the break, you should think about what you might like to do for the final project in this course.

We will begin Chapter 10 this week. The reading is Section 10.1, but we will actually start with an overview of the most important classes in the Java Collection Framework that are covered later in the chapter.

The lab this week is a little different, since it is about programming techniques rather than programming itself. In the lab, you will learn about CVS and about using the debugger in Eclipse. The work for this lab, as well as for the genetic programming project that you have been working on for the two previous labs, is due on the Wednesday after Spring break.

Week 7: March 2, 4, and 6

We will finish up linked data structures and recursion this week. We will finish up binary sort trees on Monday. On Wednesday and Friday, we will be looking at recursive parsing of expressions. The reading is Section 9.5. (If we have time, we might go back to look at a topic from chapter 9 that I skipped: postfix expressions.)

The lab for this week is a continuation of last week's lab. Last week, you make random expressions and tested how well they approximated some given test data. This week, you will try to search for good approximations using genetic programming techniques. Two files of sample output from my own implementation of this program are available: For first file, I let the genetic algorithm run for a large number of generations; every time a new best expression was found, I output the generation number, RMS error, and the expression. For the second file, I compared the random search algorithm to the genetic programming search: Each algorithm was allowed to run for 60 seconds, after which I printed out the best RMS error and expression. I did this repeatedly, and I kept track of the average best fitness for both algorithms.

In lab, I showed an old Genetic Algorithms demonstration applet that I wrote a while ago. The applet is fun to experiment with. It can be found at More instructions and information are on that page. (Mac users, note that the menus for the applet appear at the end of the Mac menu bar, and only when the "World" window is active.) Alternatively, you can download an executable jar file of the application.

Week 6: February 23, 25, and 27

We continue with our study of linked data structures. This week, we will be looking at tree structures. The reading for the week is Section 9.4. We will look at expression trees, binary trees, and binary sort trees. Processing tree structures often requires recursion, so recursion will also be a major topic again this week.

For the lab, you will be generating and using random expression trees. Next week's lab will be a continuation of this where we apply genetic programming to expression trees. For this application, we will use expressions that involve the variable "x". This is not covered in Section 9.4 but will be covered in class. It is also covered Exercise 9.6 and its solution.

Week 5: February 16, 18, and 20

There will be a test this week, on Friday, February 20. An information sheet is available.

We will work on Section 9.3 this week, which covers abstract data types, stacks, and queues. This departs from the syllabus on the course handout. I have decided to leave out "enums," at least for the time being.

The lab this week will use doubly linked lists.

Week 4: February 9, 11, and 13

This week, we begin a study of linked data structures that will take a couple of weeks to complete. We'll start with a look at linked lists. The reading is Section 9.2. In the lab for the week, we'll still be working on recursion.

Note that the first test of the term is coming up on Friday of next week, February 20.

Week 3: February 2, 4, and 6

The reading for the week is Section 9.1, which covers recursion. One of the examples is QuickSort, a recursive algorithm for sorting an array that has an average-case run time of Θ(n*log(n)).

Week 2: January 26, 28, and 30

The reading for the week is Section 8.6, which is an introduction to the analysis of algorithms. Part of the lab is a demonstration of the fact that two algorithms that accomplish the same task can have very different run times, which indicates that it can be worthwhile to analyze the running time of the algorithms that we write and to search for more efficient algorithms.

Last week, we talked about exceptions, and the second part of the lab involves writing a lab that uses exceptions and the try..catch statement.

We will also spend a bit of time this week looking at Scanners as a more standard way of reading input from the user.

Week 1: January 19, 21, and 23

The first week will be an introduction the course. We will review some of the basic ideas of program design, such as top-down design, bottom-up design, pseudocode, and modularity. We will briefly cover some basic features of Java that you might not have paid much attention to in CS 124, namely the switch statement (Section 8.2.10), JavaDoc (Section 4.5.4), and (in more detail) exceptions (Section 8.3). The lab will introduce Eclipse, the programming environment that you will be using for all of the programs that you write in this class, and it will give you a chance to get back into the programming groove. I will ask you to read -- and pay attention to -- a style guide for programming in Java.