This course ended May 6, 2017.

CPSC 124: Introduction to Programming

   Department of Mathematics and Computer Science
   Hobart and William Smith Colleges

   Spring 2017.

   Instructor:  David J. Eck  (


   Monday, Wednesday, Friday, 10:10–11:05 AM
       Room Gulick 206A.

   Lab: Thursday, 11:55–1:20 PM
       Room Rosenberg 009.

Lab Worksheets
Lab 1, January 19
Intro to Linux and Java
Lab 2, January 28
Using Subroutines
Lab 3, February 2
Lab 4, February 9
More Control
Lab 5, February 16
Lab 6, February 23
Eclipse / Subroutines
Lab 7, March 2
Vigenère Cipher
Lab 8, March 9
Using Objects and Events
Lab 9, March 23
Designing Classes
Lab 10, March 30
GUI Tutorial
Lab 11, April 6
Lab 12, April 13
GUI Hangman, Part 1
Labs 13 and 14, April 20 and 28:  GUI Hangman, continued

Quizzes and Tests, with Answers
Quiz 1, Jan. 27 Quiz 2, Feb. 3 Quiz 3, Feb. 13 Test 1, Feb. 20
Quiz 4, March 1 Quiz 5, March 24 Quiz 6, March 31 Test 2, April 5
Quiz 7, April 24  

Some Useful Links

End of Semester: May 1 and 6

The final exam for this course is scheduled for 7:00 PM on Saturday, May 6, in our usual classroom. A study guide was handed out in class last Friday, along with a set of sample exam questions from previous semesters. See also the study guides for the first test, and for the second test.

On Monday, May 1, we will be reviewing for the test.

Fourteenth Week: April 24, 26, and 28

In the last full week of the term, we will continue with Chapter 7. The parameterized class ArrayList<T> was introduced at the end of last week, and we will pick up with that on Monday. This will include talking about "wrapper" clases such as Integer and Double. We also have to talk about searching and sorting and about more details of multi-dimensional arrays.

You should read the rest of Chapter 7.

Thirteenth Week: April 17, 19, and 21

I will finish talking about GUI programming on Monday or Wednesday. You should read as much of Chapter 6 as you can stand, but the most important thing is the general ideas: how components, layout, and events work together to implement a GUI program. The ideas of state machines and event-driven programs are fundamental.

We will then move on to Chapter 7, on Arrays and ArrayLists, which will occupy us for the rest of the semester. We have already been using arrays, since Section 3.8, but there is substantial new material. You should read Section 7.1 and Section 7.2 this week.

Twelfth Week: April 10, 12, and 14

We will spend Monday finishing Section 5.5 for real (by covering abstract classes). We will also cover the basics of Java interfaces. This rest of Chapter 5 will be left mostly as reading for now, although we will probably pick up a few more topics from it when they are needed. We will spend the rest of the week talking about GUI programming (Chapter 6).

There is no lab due this week. Lab 11 is due next week. You will start Lab 12 this week and continue it in next week's lab; it will be due th following week.

Eleventh Week: April 3, 5, and 7

There is a test on Wednesday, April 5. A study guide is available. Also available is a selection of sample questions from an old test.

Aside from the test, we will finish Section 5.5, and we will do Section 5.6, which covers this and super (most of which has already come up informally. We might also have time to start Section 5.7.

Tenth Week: March 27, 29, and 31

We are still working on fundamental ideas about classes in Sections 5.1 through 5.4. We will move on to Section 5.5 by the end of the week. Section 5.5 covers subclasses, class hierarchy, inheritance, and polymorphism, which are core ideas in true object-oriented programming.

There will be a quiz on Friday on Sections 5.1 through 5.4. There is a test coming up next week on Wednesday, April 5, which will cover Chapter 4 and Chapter 5 through Subsection 5.5.2.

Ninth Week: March 20, 22, and 24

We will continue with Chapter 5, covering Sections 5.2 through 5.4. The emphasis for the week is on designing and writing classes. We will also look at a few of Java's built-in classes, including Object and Scanner. Although we haven't used it yet, Scanner is introduced in the textbook in Section 2.4.6.

You can expect a quiz in class on Friday on Sections 5.1 and 5.2.

Eighth Week: March 6, 8, and 10

The reading for the week is Section 4.7 and Section 5.1.

You should read Section 4.7 carefully, but I will cover it pretty quickly in class. It covers scope, the final modifier, the reasons for using named constants, and the possibility of including an initial value for a variable in the declaration of that variable.

Section 5.1 introduces objects and object-oriented programming. In fact, you have been using objects from the beginning of the course, but this is the first time you are being asked to actually understand what is going on when you use them. Section 5.1 is one of the most of the important in the book. It contains essential information about objects that you need to understand fully if you are going to use objects effectively.

Next week is Spring Break. Enjoy!

Seventh Week: February 27; March 1 and 3

The reading for the week is Chapter 4, Sections 4.3 through 4.6. We continue to study subroutines, including parameters and return values. By the end of the week, we will be talking more about the broader view, including Java "packages", APIs (Application Programming Interfaces), and program development in general.

There is a quiz on Wednesday of this week, on Wednesday.

Sixth Week: February 20, 22, and 24

After the test on Monday, we will move quickly on to Chapter 4, which covers subroutines. The reading for the week is Sections 4.1 and 4.2. Also, since I never had a chance to talk about the switch statement, we might look at it briefly; however, you will not be expected to use switch statements in the code that you write.

The lab this week will introduce the Eclipse IDE (Integrated Development Environment). You are required to use it for this lab, and I encourage you to use it for all of your programs for the rest of the semester. The lab will ask you to write a few simple subroutines.

Fifth Week: February 13, 15, and 17

There is a test next Monday, February 20. A study guide will be handed out in class on Wednesday.

The main topic for the week is arrays, Section 3.8. (We will not cover multidimensional arrays, Subsection 3.8.5, until later in the course.) If there is time, we will look more briefly at Section 3.6 and Section 3.7, which cover two additional control structures (switch and try..catch).

Fourth Week: February 6, 8, and 10

We continue with Chapter 3. The reading for the week is Sections 3.3, 3.4, and 3.5. The primary topics are for loops, multi-way if statements, and the break statement. We will cover do..while loops more briefly. You should be able to read and understand do..while statements, but you will not be forced to use them on a quiz or test.

The first exercise on the lab for the week is mainly about for loops. The second and final exercise is a longer, more complex program than you have written up to this point. It will require more thinking and planning, and it would be a good idea to start thinking about it in advance of the lab.

Third Week: January 30; February 1 and 3

The reading for the week is Section 2.5, Section 3.1, and Section 3.2. Section 2.5 covers the details of expressions, including arithmetic, relational, and logical operators, as well as type-casting, precedence rules, and type-compatibility rules for assignment statements. I will not cover this section in detail in class, but you should read it all. Section 3.1 introduces the basic looping an branching control structures, the while statement and the if statement. Section 3.2 talks about some techniques for developing programs. Next week, we will cover more details of control structures, but the information in Sections 3.1 and 3.2 is fundamental.

In the lab this week, you will write several programs that use if and while statements.

Second Week: January 23, 25, and 27

The reading for the week is Sections 1 through 4 of Chapter 2. We will cover the basic programming "statements": variable declarations, assignment statements, and subroutine call statements. There is a lot of material here: variables, data types, and literals; expressions that involve arithmetic operations and functions; the built-in functions in the Math class; output subroutines in System.out, input functions from the non-standard TextIO class; and operations on strings.

First Week: January 17 and 19

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. We will cover only a part of Chapter 1 in class, but it is a good idea to read the entire chapter to get a preview of most of the topics that will be covered during the rest of the semester. However, you should not expect to fully understand everything in Chapter 1 at this time. The most important sections for now are Section 1 and Section 3. Sections 4, 5, and 6 give short overviews of many of the topics that we will cover in the rest of the semester, but they are not required reading at this time.

We will move very quickly into Chapter 2, which covers the most basic elements of Java programming. In fact, in the first lab, on Thursday, you will write your first simple Java programs. The lab web page will have enough information to get you started.

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