CPSC 124: Introduction to Programming

       Department of Mathematics and Computer Science
       Hobart and William Smith Colleges

       Fall 2017.

       Instructor:  David J. Eck  (eck@hws.edu)

       Syllabus:  http://math.hws.edu/eck/courses/cpsc124_f17.html

       Monday, Wednesday, Friday, 10:10–11:05 AM
           Room Gulick 2000 (formerly room number 206A).

       Lab: Thursday, 1:30–2:55 PM
           Room Rosenberg 009.
       
       Office hours in Lansing 313 (but also check the computer lab, Lansing 310):
           MWF, 11:15–12:10
           WF,  2:00–3:00
       (I am also often available at other times.)


Lab Worksheets
Lab 1, August 31
Intro to Linux and Java
Lab 2, September 7
Using Subroutines
Lab 3, September 14
Control
Lab 4, September 21
More Control
Lab 5, September 28
Arrays
Lab 6, October 5
Eclipse (and subroutines)
Lab 7, October 12
Subroutines
Lab 8, October 19
Objects and Events
Lab 9, October 26
Classes

Quizzes and Tests, with Answers
Quiz 1, Sept. 8 Quiz 2, Sept. 15 Quiz 3, Sept. 22 Test 1, Sept. 29


Some Useful Links


First Week: August 28 and 30; September 2

Welcome to the course!

You should begin reading the textbook, which is available on-line at http://math.hws.edu/javanotes. 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. Section 2 is not particularly relevant to this course, but contains some interesting information about the way computers work.

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!


Second Week: September 4, 6, and 8

The reading for the week is Chapter 2, Section 2.3, Section 2.4, and Section 2.5. (There are a few topics in those sections that we will not cover, at least for the time being, including 2.3.4 on Enums, 2.4.4 on Files, and 2.4.6 on Scanner. We also won't be using the output functions from TextIO.)

In Section 2.3, we will be covering some mathematical functions and subroutines for use with strings. In 2.4, we will encounter TextIO.java, which can be used for getting input from the user on the command line. TextIO is not a standard part of Java. I have written it to make text input more convenient. (The more standard alternative to TextIO is the Scanner class.) And in 2.5, we will see some details of mathematical expressions.

The first quiz for this course will be this Friday, September 8, at the beginning of class.


Third Week: September 11, 13, and 15

We are moving on to Chapter 3 this week. The reading includes sections 3.1, 3.2, and 3.3. Chapter 3 covers control structures, starting with basic if statements and while loops in Section 3.1. Section 3.2 is an introduction to how to think about developing correct algorithms for solving problems. It introduces the ideas of algorithm and pseudocode. Section 3.3 covers more details of while loops and do..while loops, inclulding the break and continue statements.

There will be another quiz this week, on Friday, September 15. You can expect some questions that ask you to write Java code segments.


Fourth Week: September 18, 20, and 22

We will dive into for loops, Section 3.4, on Monday. From there, we will jump to arrays, Section 3.8, a kind of data structure that is often used with for loops. And on Friday, we will return to Section 3.5, to talk about the if..else if..else construction.

We have covered the do..while statement briefly. You should know what this statement means, but you will not be required to use it on quizzes or tests. Similarly, you will not be required to use any switch statements, even if we do cover it in class next week. You are, however, definitely responsible for using all forms the if statement, while loops, for loops, and the break statement.

You can expect another quiz this Friday, September 22. It will cover through Section 3.4 (that is, for loops but not arrays). The first test will be the following week, on Friday, September 29.


Fifth Week: September 25, 27, and 29

There is a test on Friday, September 29. A study guide will be handed out in class on Monday.

We will spend part of the week reviewing for the test and, in particular, doing more examples with if..else if and with arrays. In any remaining time, we will move on to new material.

The reading for the week is Section 3.6 and Section 3.7, but these sections will not be on the test. Section 3.6 covers switch statements. You should be familiar with them, but you will not be asked about them on quizzes or tests. Section 3.7 covers the idea of exceptions as well as catching and throwing exceptions, including the try..catch statement. Exceptions are an important topic, and eventually, you will need to understand try..catch. We will cover them more thoroughly when we need them.

In class on September 21, I demonstrated changing an "AdditionProblem" program into an "ArithmeticProblem" program, which is part of what you need to do for L Lab 4. Here is a link to that example ArithmeticProblem.java. (There is also a copy in /classes/cs124

Here is a link to the Solutions for the sample test


Sixth Week: October 2, 4, and 6

We will be starting Chapter 4 this week. The main topic is writing and using your own subroutines. (And remember that "method" is another name for "subroutine" in Java.) The reading for the week is Sections 4.1 to 4.4.

This week's lab is primarily about Eclipse, the IDE (Integrated Development Environment) for Java. There will be one short new exercise on writing subroutines. The due date for the work from last week's lab has been moved to next Friday. The work from both Lab 5 and Lab 6 will be due at 3:00 PM on Friday, October 13.

Sample answers from last week's test are available. There is no quiz this week. The next quiz will probably be the Friday after Spring break.


Seventh Week: October 11 and 13

There is no class on Monday this week, because of Fall break.

After the break, we will continue with Chapter 4. The reading is Section 4.5 and Section 4.6. After looking at the basics of how subroutines are written and used, we move on to the bigger question of overall program design. We will discuss top-down and bottom-up design, software toolboxes and APIs, Java packages, and preconditions and postconditions as ways of reasoning about the behavior of programs.

Remember that your work from Labs 5 and 6 is due on Friday this week (at 3:00 PM) instead of on the usual Thursday.

There is no quiz this week. The next quiz will be next Monday, October 16, The next quiz will be next Wednesday, October 18, covering Sections 4.1 to 4.6.


Eighth Week: October 16, 18, and 20

We are at the mid point of the semester, and it's time to move on to object-oriented programming. You have been using objects since the beginning of the semester, but now it's time to learn more about classes, objects, and the relationship between them. We will spend part of the class on Monday on Section 4.7 and then move on to Chapter 5. We will spend most of the rest of the week on Section 5.1, which covers some basic ideas about creating, using, and understanding objects.