CPSC 124: Introduction to Programming
Department of Mathematics and Computer Science Hobart and William Smith Colleges Spring 2021. Instructor: David J. Eck (email@example.com) 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|
|Quiz and Test Answers|
|Quiz #1, August 30||Quiz #2, September 6||Quiz #3, September 13|
Some Sample Programs and Lab Solutions
- AdditionQuiz.java, from class on September 8
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.
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!