This course ended
on May 14, 2013

CPSC 124: Introduction to Programming

   Department of Mathematics and Computer Science
   Hobart and William Smith Colleges

   Spring 2013.

   Instructor:  David J. Eck  (

   Course Handout:

   Monday, Wednesday, Friday, 12:20--1:15 PM
       Room Eaton 111.

   Lab: Thursday, 1:30--2:55 PM
       Room Gulick 208.

Lab Worksheets
Lab 1, January 24
Intro to Linux and Java
Lab 2, January 31
User Input (and some Graphics)
Lab 3, February 7
Loops and Branches
Lab 4, February 14
More Control
Lab 5, February 21
Files, Exceptions, Applets
Lab 6, February 20
Eclipse and Subroutines
Lab 7, March 7
Turtle Subroutines
Lab 8, March 14
Vigenère Cipher
Lab 9, March 28
Objects and ArrayLists
Lab 10, April 4
Subclasses (and Events)
Lab 11, April 11
Mouse Events
Lab 12, April 18
GUI Hangman
Lab 13, April 24
Arrays and Video Poker
Lab 14, May 2
Poker Solitaire with Two-dimensional Array

Quizzes and Tests, with Answers
Quiz 1, January 28 Quiz 2, February 4 Quiz 3, February 13 Quiz 4, February 20
First Test, Feb. 25 Quiz 5, March 8 Quiz 6, March 29 Second Test, April 10
Quiz 7, April 19 Quiz 8, April 29

Some Useful Links

First Week: January 23 and 25

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 some of the introductory material in Chapter 1 fairly quickly. Although we will not cover all of Chapter 1 in class, you should definitely read the entire chapter.

In the lab this week, you will compile and run your first Java programs, and you will be introduced to the Linux operating system. We only have one class meeting before the lab, so the lab is largely tutorial in nature. A copy will be handed out on the first day of class, and you should read it before coming to lab on Thursday.

The required reading for the first week also includes the course handout.

Second Week: January 28 and 30; February 1

This week, we begin Chapter 2 and our serious discussion of programming in Java. The reading for the week in Sections 2.1 through 2.4. The reading covers variables declarations, assignment statements, come built-in subroutines and functions, and command-line input/output.

There are a few topics that you are not responsible for, including enums, Scanner, file I/O, and hexadecimal numbers. We might talk about file I/O next week if there is time.

Third Week: February 4, 6, and 8

The reading for the week is Section 2.5, Section 3.1, and Section 3.2. We will finish up Chapter 2 by looking at some of the details of expressions and operators, from Section 2.5. However, there is a lot of detail there, and we won't cover everything in class. You should read the section carefully and use it as a reference when you need it. We then move on to Chapter 3, which is about control structures. We start with the while statement and basic if statement. Section 3.2 introduces some basic ideas about how to develop algorithms.

Fourth Week: February 11, 13, and 15

We will continue talking about control structures this week. The main ideas that we will cover are for loops, using else if with if statements, and using a break statement to end a loop. The reading is Chapter 3, Section 3, Section 4, and Section 5.

Fifth Week: February 18, 20, and 22

You should finish reading Chapter 3. There are a number of topics in that chapter that you are not responsible for, such as the do..while statement, switch statement, continue statement, and any material on enums. However, that shouldn't stop you from reading about them! The main new topic for the week will be exceptions and the try..catch statement. As an example, we will look at how TextIO uses exceptions when you use it to read from a file. The idea of using files with TextIO is from Section 2.4.5, so you will want to go back and read that section if you have not already done so.

Remember that there is a test coming up next Monday, February 25. An information sheet about the test is available.

Sixth Week: February 25 and 27; March 1

Posted late... After the test on Monday, we have moved on to Chapter 4. The reading is Sections 1 and 2 in that chapter. We are starting a major new topic: subroutines.

Seventh Week: March 4, 6, and 8

We will continue with Chapter 4. The reading for the week is Sections 4.3, 4.4, and 4.5. We will be covering subroutines, parameters, the return statement, and member variables.

Eighth Week: March 11, 13, and 15

We finish Chapter 4 this week, with some last words about subroutines and member variables. The reading is Section 4.6 and Section 4.7 (but we will not do anything with the "Mosaic" example that takes up much of Section 4.6). I hope to begin Section 5.1 by the end of the week. Note that at this point in the course, I will mostly abandon the term "subroutine" and start using the near-synonym "method" instead.

Next week is Spring Break. Have fun -- and come back on March 25 ready to learn all about objects and object-oriented programming!

Ninth Week: March 25, 27, and 29

We continue the study of objects and object-oriented programming. The reading for the week is Chapter 5, Section 2 and Section 3. We will discuss constructors, some of Java's standard classes, and the general idea of object-oriented analysis and design. One of the classes that we will discuss, ArrayLists, is not covered in the textbook until Section 7.3.3 An ArrayList can store a list of objects. You will use an ArrayList in lab on Thursday.

Tenth Week: April 1, 3, and 5

You should read Chapter 5, sections 5.4, 5.5, and 5.6. This continues the study of object-oriented programming and introduces subclasses, inheritance, and the special variables this and super.

There is a test coming up next week, on Wednesday, April 10. It will cover Chapter 4 and Chapter 5 through Section 5.6.

Eleventh Week: April 8, 10, and 12

There is a test on Wednesday, April 10. An information sheet is available.

Aside from the test, we will cover a few remaining topics from Chapter 5 We have not yet covered any of Section 6 (on this and super), so we will have to do that. There are also a few topics from Section 7 and a few topics that we skipped over from earlier in the chapter. You should read through Section 5.7, but there are only a few things in that section that you really need to know -- interfaces and nested classes.

Twelfth Week: April 15, 17, and 19

After finishing up the last topics that we will cover from Chapter 5, we move on to Chapter 6, which covers basic GUI programming. You will find that significant parts of this chapter have already been covered in lab.

You can start by reading Section 6.1, Section 6.6 through 6.6.2, and Section 6.7 through 6.7.1. This reading introduces basic ideas about components, layout, and events. You will need this material for the lab on Thursday. After that, you will want to go back to read Sections 6.3 through 6.5 as well as the rest of Sections 6.6, 6.7, and 6.8, even though we won't cover everything from those sections.

Thirteenth Week: April 22, 24, and 26

We will start the week with some additional material on GUI programming. You will want to read Section 6.2, on mouse events. You could also read more about standard components in Section 6.6. However, we will quickly move on to start our study of arrays, and you should read Section 7.1 and Section 7.2. We should have some time at the very end of the course to do a little more with GUI programming.

Fourteenth Week: April 29; May 1 and 3

In the last full week of the semester, we will continue to talk about arrays. The reading is Sections 7.3.1 on partially full arrays; 7.5.1 and 7.5.2 on multidimensional arrays; and 7.4 on searching and sorting. We should also spend a little time looking at a few more aspects of GUI programing, such as menus and dialogs.

Fifteenth Week and Final Exam: May 6 and 14

Monday, May 6 is the last day of classes. We will do a few problems to review for the final exam. The exam takes place in our regular classroom at 1:30 PM on Tuesday, May 14. Here is the information sheet.

Here are my office hours for the end of the semester (you might be able to find me in my office at other times too):

       Monday, May 6:    1:30 to 3:00
       Tuesday, May 7:   1:30 to 3:00
       Thursday, May 9:  2:45 to 4:00
       Friday, May 10:   1:00 to 4:30
       Monday, May 13:  11:00 to 3:00
       Tuesday, May 14: 12:00 to 1:15