|This course ended|
on May 6, 2021
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_s21.html Monday, Wednesday, Friday, 9:50–10:50 AM Second Floor of the Barn. Lab: Tuesday, 11:50–1:20 PM To meet remotely on Zoom.
Some Test/Quiz Solutions and Examples from Class
First test: sample answers
March 1 example: AdditionQuizWithArrays.java
March 3 example: BingoCard.java
Quiz 4: sample answers
Second test: sample answers
April 9 example: ArithmeticQuizWithClassHierarchy.java
Quiz 6: sample answers
April 16 example: NervousSquares.java and NervousSquares2.java
Quiz 7: sample answers
April 28 sorting app: xSortLab
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.
- 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 15 is recommended for this course.
- 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 15).
- Download Site for Eclipse, an integrated development environment for Java programming. The correct package for this course is "Eclipse IDE for Java Developers."
Final Exam: May 6
The final exam for this course is at 7:00 PM on Thursday, May 6. A study guide is available:
Fourteenth Week: April 26, 28, and 30
We end the semester by returning to the topic of arrays. The reading is Sections 7.1.1. 7.2, 7.4, and 7.5. (We have previously covered most of the material in Section 7.3, on ArrayList, but you might want to review it.) We will look at searching and sorting algorithms, with a basic discussion of their run-time efficiency. We will finish with a more in-depth look at two-dimensional arrays.
The final assignment is due by midnight on Friday, April 30 and will not be accepted late.
Thirteenth Week: April 19, 21, and 23
We continue looking at some features of GUI programming in JavaFX that have not been previously covered in labs. You should read as much of Chapter 6 as you have time for, but the required material is covered in class. By Friday, we move on to Chapter 7.
Twelfth Week: April 12, 14, and 16
We will finish up Chapter 5 this week by covering some topics from Sections 5.7 and 5.8. We will not cover everything in those sections, and most of it is not terribly important for the purposes of this course. We will then move on to Chapter 6, which covers the basics of GUI programming in JavaFX. We have already covered significant parts of the material in Chapter 6 in labs, but there is still a lot of new material there. We will certainly not cover all of it.
Lab 9 is a GUI tutorial that introduces some of the basic concepts of GUI programming: components, containers, layout, events, and event handling. It will be due by midnight on Monday, April 19, and will not be accepted late. The last two labs of the semester will be devoted to work on a final project.
Eleventh Week: April 5, 7, and 9
This week, we will continue working on object-oriented programming. We still have to finish Sections 5.3 and 5.4. We will then move on to the new reading for the week, which is Sections 5.5 and 5.6. Section 5.5 covers some of the essential core concepts of true object-oriented programming: subclasses, inheritance, and polymorphism. Section 5.6 is a short section about two special variables, this and super. We might actually talk about this before doing Section 5.5. It will take some time to get through all of this material, and we will almost certainly need to continue it next week.
Tenth Week: March 29 and 31; April 2
There is a test on Wednesday. Please see the study guide.
We will spend class on Monday reviewing for the test. On Friday, we will move on to Sections 5.3 and 5.4. The topic is object-oriented programming and how to design classes.
There will be a new lab on Tuesday, but instead of the following Monday, it will be due on Monday, April 12. The last day for turning in Lab 7 with a penalty for being late has been extended to midnight on Monday, April 5.
Ninth Week: March 22, 24, and 26
The reading for the week is Sections 5.1 and 5.2. These sections cover the core ideas about classes and objects, and they are fundamental to Java programming.
The first part of Lab 7 is due by midnight on Monday and will not be accepted late. Remember that for this part, you only need to have made some progress on the full program, which is not due until next week. Please remember that if you are working with someone on this lab, both of your names must be at the top of the program.
There will be a test next week, on Wednesday, March 31. A study guide will be available by Friday.
Eighth Week: March 15, 17, and 19
We will spend a little more time on lambda expressions, Section 4.5, but the only thing that you really need to know about them is what they represent and how to pass them as parameters to methods that someone else has written.
We will also spend some time on Monday looking at the Minesweeper program that you will implement for Lab 7.
After that, we will move on to Sections 4.6 and 4.7, and 4.8. I hope to cover at least part of Section 4.8 on Friday, but we will probably have to continue it next Monday.
Lab 6 is due by midnight on Monday (but can be turned in late until noon on Saturday, with a 10% penality).
Seventh Week: March 8, 10, and 12
We continue with Chapter 4. The reading for the week is Sections 4.3, 4.4, and 4.5. However, we will not cover all the details of Section 4.5. Sections 4.3 and 4.4 cover details of parameters and return values in subroutines. Section 4.5 covers a relatively recent addition to Java: lambda expressions. A lambda expression is essentially a subroutine treated as a kind of data.
In this week's lab, you will write some subroutines using turtle graphics.
Sixth Week: March 1, 3, and 5
Sample answers for the first test are available.
We started Section 3.8 last week, but we still have some work to do on it on Monday. For Wednesday and Friday, we begin Chapter 4, which covers subroutines. The reading is Section 4.1 and Section 4.2.
There will be a quiz on Friday, probably given in-person in class.
This week's lab is a fairly short program that uses an array of strings. The work from this lab is combined with the work from Lab 5, and the programs from both labs are due next Monday, March 8, with a late due date of noon on Saturday, March 13.
Fifth Week: February 22, 24, and 26
There is a test on Friday, February 26, which will be given through Canvas during the regular class time. Instead of coming to class on Friday, you should log on an take that test.
Please read the study guide for the test!!
Aside from the test, we will cover Section 3.7 (exceptions) and start Section 3.8 (arrays). We have already covered as much of Section 3.6 as we will do. Note that none of this material is on the test.
For this week's lab, you will be working on a program to produce random computer "art".
Fourth Week: February 15, 17, and 19
We continue our study of control structures. We will look at one new control structure, the for loop, as well as enhancements to the while loop and if statement. (We will also encounter the do..while loop, but it is not really important for this course.) Of course we will continue to emphasize algorithm design. The reading is Chapter 3, sections 3.3, 3.4, and 3.5. We might start 3.6 by the end of the week, but note that there are parts of that section that we will not cover.
The lab for this week asks you to write two programs, using for loops and other control structures.
Third Week: February 8, 10, and 12
As it turns out, we have already finished with Chapter 2, and gotten a start on Chapter 3. The reading for the week is Sections 3.1 and 3.2. Section 3.1 introduces while loops and basic if statements. Section 3.2 talks in general terms about developing an algorithm for solving a given problem.
The lab this week asks you to write three programs that use while loops and if statements.
Second Week: February 1, 3, and 5
The reading for the week is Sections 2.3 and 2.4, which mostly cover built-in subroutines. In section 2.3, you are NOT responsible for subsections 2.3.4 and 2.3.5. We will probably cover at least parts of 2.5 as well, but that section is mostly a more technical reference, and you should not concentrate on the details. Section 2.6 will never be assigned as reading (but of course, it's worth looking at it in any case).
Appointment times for office hours are available in the Canvas calendar. I will also have drop-in office hours on Zoom from 2:30 to 4:00 on Wednesday. All office hours are on Zoom, using the link that can be found on the Canvas web page for this course.
The final deadline for turning in work for Lab 1 is midnight on Thursday!
First Week: January 25, 27, and 29
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!
You will need to set up the Eclipse programming environment for use in this course. While this could be done during the first lab on Tuesday, it would be good to get started earlier. You can follow these instructions for Eclipse setup.
Finally, it would be a good idea to read the lab instructions before the lab on Tuesday.