CPSC 124: Introduction to Programming
Department of Mathematics and Computer Science Hobart and William Smith Colleges Spring 2021. Instructor: David J. Eck (firstname.lastname@example.org) Syllabus: http://math.hws.edu/eck/courses/cpsc124_f21.html Monday, Wednesday, Friday, 9:50–10:50 AM Coxe 7. Lab: Tuesday, 10:10–11:40 AM Rosenberg 009.
|Lab Instruction Sheets|
|Lab 1, August 24
Introduction to Java
|Lab 2, August 31
|Lab 3, September 7
while and if
|Lab 4, September 14
|Lab 5, September 21
|Lab 6, September 28
Arrays (and Eclipse)
|Lab 7, October 5
|Lab 8, October 19||Lab 9, October 26|
|Quiz and Test Answers|
|Quiz #1, August 30||Quiz #2, September 6||Quiz #3, September 13|
|Test #1, September 24||Quiz #4, October 4|
Some Sample Programs and Lab Solutions
- AdditionQuiz.java, from class on September 8
- two solutions to the Lab 3 Baseball exercise: Baseball.java and BaseballBasic.java
- a solution to the Lab 4 LoopyArt exercise: LoopyArtComplete.java
- Primes10000.java, from class on September 27
- PrimesWithSubroutines.java, a revision of Primes10000, from class on October 4
- CrapsProbability.java, which simulates playing many Craps games, from class on October 6
- a solution to the Lab 6 hangman game: HangmanComplete.java
Some Useful Links
- Introduction to Programming Using Java, the textbook for the course.
- PDF version of the textbook, good for reading on-screen.
- A Style Guide for Java Programming.
- Some information about Linux.
- If you want to use Java on your own computer:
- Some basic instructions.
- Download Site for OpenJDK, where you can download installers for OpenJDK, for Mac OS or for Windows. Installing an OpenJDK will allow you to compile and run Java programs on the command line on your own computer. OpenJDK 16 is recommended for this course. OpenJDK 11 will also work.
- Download site for JavaFX, which we will use later in the course for GUI programming. To use JavaFX on your own computer, you will need an "SDK" appropriate for your system, probably "JavaFX Windows x64 SDK" for Windows or "JavaFX Mac OS X SDK" for Mac. Unless you are using an older version of Java, you should get the Latest Release (Version number 16).
- Download Site for Eclipse, an integrated development environment for Java programming. We will use Eclipse later in the course. The correct package for this course is "Eclipse IDE for Java Developers." (The "Installer" is NOT recommended.) You need the appropriate version for your operating system.
Eighth Week: October 13 and 15
We still have to finish up a bit of Chapter 4. The last three sections of that chapter have information on a lot of topics, and you are not responsible for all of them. You are responsible for the material in the following subsections: 4.6.1, 4.6,2, 4.6.3, 4.6.5, 4.7.1, 4.7.2, 4.8.1, 4.8.3, and 4.8.4. We have already covered a lot of that material.
We will then move on to Chapter 5, which introduces object-oriented programming. You should read Section 5.1, which covers central ideas about objects and their relationship to classes. We might start Section 5.2 on Friday.
There is no lab this week. The work from last week's lab is due next week.
You can expect another quiz next Monday.
Seventh Week: October 4, 6, and 8
There is a quiz at the start of class on Monday of this week.
We are working on Chapter 4, which covers writing subroutines and using them to construct more complex programs. The new reading for the week is Section 4.3, and Section 4.4. Sections 4.2 through 4.4 cover all the basic aspects of writing subroutines, including parameters and return values. Global and local variables are also covered. We will also be discussing how to use subroutines to build complex programs, which covers some of the material from Section 4.6.
Next week is Fall Break. There is no class on Monday and no lab on Tuesday. And there will not be a quiz next week.
Sixth Week: September 27 and 29; October 1
The reading for the week is Section 3.8, Section 4.1, and Section 4.2. Section 3.8 introduces arrays. The lab on Tuesday will be about arrays but, just as important, will introduce the Eclipse IDE (Integrated Development Environment). We will them move on to Chapter 4, which is about writing your own subroutines.
There is no lab work due this week. The work from Labs 5 and 6 will all be due on October 7. And there is no quiz on Monday. However, you can expect another quiz next Monday, October 7.
Fifth Week: September 20, 22, and 24
There is a test this week, on Friday. Click here for a study guide. A copy of the study guide will be handed out in class on Monday.
The reading for the week is Section 3.6
and Section 3.7. In fact, we already
switch statement from Section 3.6 on Friday. Section 3.7 covers
exceptions and the
try..catch statement. Note that none of this material is covered on the test.
We will spend some time on Wednesday reviewing for the test and looking at some sample problems from past tests. It is possible that we will start Section 3.8, if there is time.
Fourth Week: September 13, 15, and 17
We will continue looking at control structures this week. Most important are the for loop and the form of the if statement that uses else if. The break statement, which can be used to exit a loop early, is also important. We will discuss the do..while statement and the switch statement, but they are less important. I will expect you to be able to read and understand code that uses do..while and switch, but I will not require you to use them in code that you write yourself.
The reading for the week is Sections 2 through 5 in Chapter 3. From Section 3.2, the main take-away is the idea of algorithm. (You might want to look at Section 3.9, which talks about JavaFX. The material in that section has been covered in labs, and we won't be spending more time on it in class.)
There is a quiz on Monday this week, and a test coming up at the end of next week, on Friday, September 24.
Third Week: September 6, 8, and 10
The reading for the week is Section 3.1 and Section 2.5. We will start the week on Monday with Section 3.1, which introduces two of Java's control structures: the while loop and the if statement. We will look at a number of examples, and you will start using these control structures in the lab on Tuesday. We will continue with examples on Wednesday, but we will start concentrating on how to go about developing a program to carry out a given task.
Section 2.5 is full of detail about expressions in Java. It covers many different "operators" such as %, >=, &&, ++, and +=. We will cover some of the most important ones in class, but you should read that section for yourself and use it as a reference when needed. (Section 2.6 contains information about using Java. We will not cover it, and it is not required reading. It could be useful to you if you are trying to use Java on your own computer.)
Once again, there is quiz at the start of class on Monday.
Second Week: August 30; September 1 and 3
The reading for the week is Section 2.3 and Section 2.4. You can skip Subsections 2.3.4, Subsection 2.3.5, and Subsection 2.4.4. We will not cover the material in any of those sections. You can also skip Subsection 2.4.6 for now, but we will cover it eventually.
The main topic is using pre-defined subroutines. We will look at some of the subroutines defined in class Math, in class System, and in objects of type String. These are all standard, built-in parts of Java. We will also see how to use input subroutines from TextIO, a class that is not a standard part of Java. Many of the subroutines that we will look at are "functions." That is, they return, or compute, a value. The lab on Tuesday will also introduce subroutines from the GraphicsContext class, which are used to draw shapes on the screen.
There is a quiz on Monday, at the beginning of class, covering Sections 1.1, 1.3, and 2.1.
First Week: August 23, 25, and 27
Welcome to the course!
You should begin reading the textbook, which is available on-line at http://math.hws.edu/javanotes. Because the first lab is on Tuesday, we will move very quickly into the most basic aspects of Java programming, which are covered in Section 2.1 and Section 2.2. Some of the same information that you need will be provided in the lab, and the work for the lab is not due until next week, but it would be useful to start reading Chapter 2.
Aside from starting in on Java programming, during the first week of the semester, we will go over some of the introductory material from Chapter 1 of the textbook. 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 are Section 1.1 and Section 1.3. Those two section give a brief overview of how computers and Java actually work. Sections 1.4, 1.5, and 1.6 give short overviews of many of the topics that we will cover in the rest of the semester. It is recommended that you read them to orient yourself in the course, but they are not required reading.
The required reading for the first week also includes the course syllabus!