This course ended December 15, 2009.

CPSC 124: Introduction to Programming

   Department of Mathematics and Computer Science
   Hobart and William Smith Colleges

   Fall 2009.

   Instructor:  David J. Eck  (

   Monday, Wednesday, Friday, 3:00 PM -- 3:55 PM
       Napier 101

   Lab: Tuesday, 11:55 AM -- 1:20 PM
       Library Multimedia Lab

   Course Handout:

Lab Worksheets
Lab 1, September 3
Intro to Linux and Java
Lab 2, September 10
User Input (And Some Graphics)
Lab 3, September 17
Lab 4, September 24
Some Loops and Some Animation
Lab 5, October 1
Lab 6, October 8
Subroutines (and some Eclipse)
Lab 7, October 15
Lab 8, October 22
Objects and Events
Lab 9, October 29
Dice (Writing Classes and Using Arrays)
Lab 10, November 5
Designing Classes
Lab 11, November 12
Components and Layout
Lab 12, November 19
A Simple Network Program
Lab 13, November 23
Keyboard and Mouse
Lab 14, December 3
Work on final projects
Lab 15, December 10
Partially Full Arrays

Quizzes and Tests
Quiz 1, Sept. 14 Quiz 2, Sept. 21 Quiz 3, Sept. 28
Test 1, Oct. 5 Quiz 4, Oct. 19 Quiz 5, Oct. 26
Quiz 6, Nov. 2 Test 2, Nov. 9 Quiz 7, Dec. 7

Some Useful Links

Fifteenth Week and End of Term: December 7, 9, and 11

This is the last week of classes for the semester. There is a quiz on Monday. For the rest of Monday and Wednesday, we will work on aspects of arrays (Chapter 7) that we haven't covered yet. This will include partially full arrays, arrays of objects, searching, and sorting.

For the lab this week, there is a short exercise on partially full arrays that you will finish in the lab period. You can use any extra time in the lab period to work on your final project.

For Friday, you should have your final project substantially complete, so that you can give a demonstration to the class. You can continue to polish your project, if you want, until the final exam.

The final exam will take place next week, on Tuesday, December 15. An information sheet is available.

Fourteenth Week: November 30; December 2 and 4

We will continue with topics from Chapter 6 this week. You can read the rest of the chapter, although we will not be able to cover everything in class. However on Monday, we'll take a break to cover ArrayLists from Sections 7.3.3 and 7.3.4. (Several of you will need to use ArrayLists in your final projects.)

For the lab this week, you will work on your final projects. There is no quiz this week, but we will have one final quiz next Monday, December 7.

This is a link to a web page showing applet versions of several examples that we looked at this week,,, and

Thirteenth Week: November 23

This week, we have class only on Monday, because of Thanksgiving break. For that class, we will meet in the computer lab for a lab on basic event handling. There will be nothing to hand in for this lab -- you will be given credit for being in class and working on the lab. Remember that Lab 12 will be due on the Thursday after Thanksgiving break.

Happy Thanksgiving!

Twelfth Week: November 16, 18, and 20

On Monday, we will cover a few remaining topics from Chapter 5 (this, super, and the basic idea of nested classes).

Starting on Wednesday, we will be working on Chapter 6. A lot of the material in Chapter 6 will already be familiar to you from lab, and we will cover most of the remaining material from that chapter over the course of the next five or six classes. We will start with a general overview of GUI programming and move on quickly to events. For this week, you should read Sections 6.1, 6.4, and 6.5. The material in Section 6.3 should already be familiar to you. As for Section 6.2, we will skip that section on HTML and applets, at least for now.

Eleventh Week: November 9, 11, and 13

After the test on Monday, we will cover topics from Sections 5.5, 5.6, and 5.7. We will not cover everything in these sections, and some of the topics that we do cover will be only lightly covered. The material in Section 5.5 on subclasses and polymorphism is especially important. You will also need to be familiar with interfaces, the special variable this, and the idea that classes can be nested. Less important, but still on the agenda are abstract classes, the special variable super, and possibly anonymous nested classes. We will not cover static import or anything about enums.

Tenth Week: November 2, 4, and 6

Reminder: There is a test coming up next Monday, November 9. An information sheet is available.

We return to Chapter 5 this week to continue the study of objects and classes. We will cover Sections 5.3 and 5.4, and we should begin 5.5 on Friday. (However, the material from Section 5.5 will not be on the test on Monday.). The topic of the week is object-oriented programming. We will discuss how classes are designed and how they are used. We will look at some of Java's standard classes as examples, and we will design some classes from scratch. By the end of the week, we should start talking about class hierarchies, inheritance, polymorphism, and abstract classes.

I will hand out a new and more complete programming style guide in class this week.

Ninth Week: October 26, 28, and 30

We will be taking a short detour from the original schedule of topics for this course this week. We will look at the basics of arrays. This material is needed for this week's lab and project. Since arrays are just a special type of object, this material fits in well at this point in the course. You should find that working with strings and with the grid in a mosaic has prepared you for array processing.

The reading for this week can be found in Chapter 7, Sections 7.1, 7.2.1, 7.5.1, and 7.5.2. At the end of the semester, we will return to Chapter 7 to cover some more advanced features of arrays and array processing.

Reminder: There is a test coming up on Monday, November 9!

Eighth Week: October 19, 21, and 23

We will be wrapping up Chapter 4 this week and moving on to Chapter 5. The reading is Sections 4.7, 5.1, and 5.2. Chapter 5 introduces objects and object-oriented programming. In the lab this week, you will create and use some objects -- including some objects that represent events in a GUI program.

It is likely that after we do Sections 5.1 and 5.2, we will take a small detour in the course to cover the basics of arrays from Chapter 7.

Seventh Week: October 14 and 16

There is no class on Monday, because of Fall break. On Wednesday, we will continue with Chapter 4. After finishing up the basic information from the first four sections of that chapter, we will cover Sections 4.5 and 4.6. The Mosaic from Section 4.6 will be used in lab on Thursday. You should familiarize with the API for that class.

Sixth Week: October 5, 7, and 9

Starting this week, we turn to the second major portion of the term: Programming in the Large. So far, you have only done the type of small scale programming that is done within a subroutine. In Chapter 4, you will learn how to write your own subroutines an how to construct a large, complex program as a collection of simpler subroutines. In Chapter 5, we turn to objects, which represent an even higher level of organization.

The reading for the week is to start Chapter 4. We should finish through Section 4.4 by next Wednesday, but we won't be covering this material in exactly the same order as in the textbook. In this week's lab, you will start writing subroutines. You'll also be introduced to the Eclipse development environment.

A solution sheet for Monday's test is available.

Since there is no class next Monday, there will be no quiz next week.

Fifth Week: September 28 and 30; October 2

We will complete Chapter 3 this week. You should read Sections 3.6 and 3.7. However, note that the switch statement, which is covered in Section 3.6, is not very important, and you will not be tested on it. You can also read Section 3.8, although the material in that section has already been mostly covered in lab and we will not be spending any more time on it in class.

With this week, we finish up the first major part of the course, "programming in the small." Chapter 2 covered the most basic components of programs, such as variables, assignment statements, and input/output subroutines. Chapter 3 showed how to use control statements to combine the basic operations and implement complex algorithms. Starting next week, we will turn to the larger scale structure of programs, implemented using subroutines and classes.

The lab for this week will let you exercise your knowledge of control structures by drawing random abstract works of "art." The exercises from the Lab 4 are due on Thursday, as usual. The longer Math Quiz project from Lab 3 is due on Friday.

There is a test coming up next Monday, October 5. An information sheet about the test is available and will be handed out in class on Wednesday.

Fourth Week: September 21, 23, and 25

We will continue working on control structures and algorithm development this week. We will cover a new, important type of loop, the for loop, and we will go over the details of while loops and if statements. The reading for the week is Sections 3.3, 3.4, and 3.5.

Next Monday, we will have a quiz, as usual, which will cover Sections 3.3, 3.4, and 3.5. The following Monday, October 5, is the date of our first test.

Third Week: September 14, 16, and 18

The main event of the week is that we will start working with control structures that will let you write programs with loops and branches. Before we get to that, we will finish up Chapter 2.

The reading for the week is Sections 2.5, 3.1, and 3.2.

Starting this week, there will be a quiz at the beginning of class almost every week, when there is not a test. Quizzes cover material from the preceding week or so.

Second Week: September 7, 9, and 11

By the end of this week, we will finish Chapter 2, Sections 1 through 4. You should also start looking at the Chapter 2 exercises. It's a good idea to work on some of the exercises. But whether or not you work on a given exercise, you should at least read my solution.

In this week's lab, you will work with TextIO and with some of Java's basic drawing commands.

We will have our first quiz next Monday, September 14.

First Week: August 31; September 2 and 4

Welcome to the course. You should begin reading the textbook, which is available on-line at During the first week of the term, we will go over the introductory material in Chapter 1 fairly quickly, and we will start Chapter 2.

In the lab this week, you will compile and run your first Java programs, and you will be introduced to the Linux operating system.