CPSC 124 Introduction to Programming Spring 2009

# CPSC 124 Syllabus

AssignmentsImportant Dates

### Week 1: 1/19-1/23

Topics: course introduction; the mental landscape

Mon Reading: The Joy of Programming (read sometime soon, when you have a chance - it's short)

Class Preparation: If you have an account on the department Linux machines, make sure you remember your password and can log in. If not, let me know by class time on Wednesday.

Thu   Lab 1: Introduction to Linux and Java
due Thu 1/29

Fri Class Preparation: Think of a card game you are familiar with. (Something not too complicated - only one deck of cards, and something you can play a good portion of in 5 minutes.) Write down directions for playing the game. Write the directions as if you were telling players what to do (e.g. "player 1, take a card from the deck"), not just as a list of rules. Bring your writeup to class. (Don't identify the game - just give the directions.)

### Week 2: 1/26-1/30

Topics: names and things: Java programs, variables, types, strings, I/O, expressions

Wed In Class:

Thu   Lab 2: Names and Things
due Thu 2/5

Fri Class Preparation: For each of the following tasks, (a) determine what input is needed (e.g. the trip planner will need the miles traveled and the car's miles per gallon, among other things) and (b) write an algorithm for performing the computation and displaying the results. An algorithm is a list of directions that a program would follow, but is written in more English-like language. Your algorithms may include only the following phrases:
print ...
get ... as input
... is calculated as ...
where ... can be filled in as appropriate.
1. A trip planner computes the number of tanks of gas, the total price of the gas, and the cost per passenger for a car trip.

2. A vending machine change dispenser computes the number of quarters, dimes, and nickels you get back in change after making a purchase.

In Class:

### Week 3: 2/2-2/6

Topics: control: conditionals and loops

Wed

Thu   Lab 3: Control
due Thu 2/12

Fri Class Preparation: For each of the following tasks, write an algorithm for a program that carries out the task. Your algorithms may include only the following phrases:
print ...
get ... as input
... is calculated as ...
set ... to ...
repeat ... until ...
if ... then ... [else if ... then ...]* [else ...]
where ... can be filled in as appropriate. [] indicates that part can be left out, and * indicates that you can repeat that part as many times as you want.
1. Determine how many times you'd need to fold a piece of paper so that it is so thick it reaches from here to the sun. (Ignore physical limitations on the folding!) To be flexible, the paper thickness and the distance to the sun should be entered by the user.

2. Roll a die 100 times and count how many times each value 1-6 is rolled.

In Class:

### Week 4: 2/9-2/13

Topics: more loops and branches, stepwise refinement, arrays

Mon In Class:

Wed In Class: syntax quiz on basic program structure, variable declarations, assignment statements, expressions, input and output, if statements, for/while loops

Thu Lab Preparation: read about Paint Lab 4: More Control, and Paint
due Thu 2/19

In Class: No RAT, but do the reading as if there will be one!

### Week 5: 2/16-2/20

Topics: arrays and exceptions

Mon In Class:

Wed In Class:

Thu   Lab 5: Arrays
due Thu 2/26
(partial solutions)

In Class: syntax quiz on arrays and constants
(no RAT, but do the reading as if there will be one!)

### Week 6: 2/23-2/27

Topics: subroutines

Wed Class Preparation: Write a program to print out the words to all of the verses of the 99 Bottles of Beer song, without having separate System.out.println statements for every line of every verse.

Thu     Project 1: Minesweeper
pseudocode meeting due Thu 3/5

Fri In Class: exam #1   exam #1
Fri 2/27

### Week 7: 3/2-3/6

Topics: subroutines

Mon In Class:

Wed In Class:

Thu Examples: Lab 6: Subroutines and Functions
(any) three exercises due Thu 3/12
Project 1: Minesweeper
due Thu 3/12

Fri In Class:

### Week 8: 3/9-3/12

Topics: subroutines and program development

Mon In Class:

Wed In Class: syntax quiz on subroutines and functions, including declarations, calls, and the semantics of parameters and return statements

Thu   Lab 6: Subroutines and Functions
remainder due Thu 3/26

Lab 7: Programming with Subroutines and Functions
due Thu 3/26

### Week 9: 3/23-3/27

Topics: more about declarations; objects and classes

In Class: no RAT, but do the reading as if there will be one!

Thu   Lab 8: Using Objects
due Thu 4/2

Fri Class Preparation: Consider a bank which offers savings accounts, checking accounts, and car loans. What information does the bank need to keep track of for each of these things? What kind of transactions can a bank customer perform involving these things? Are there any operations the bank itself needs to be able to do? Bring your written answers to class.

In Class:

### Week 10: 3/30-4/3

Topics: objects and classes

Mon In Class:

Wed In Class:

Thu   Lab 9: Pong
due Thu 4/9

Fri In Class: syntax quiz on classes and objects, including writing classes (with instance variables, constructors, getters/setters, and other methods), creating objects, and invoking methods on objects

### Week 11: 4/6-4/10

Topics: arrays of objects, partially full arrays, dynamic arrays

In Class: no RAT, but do the reading as if there will be one!

Wed In Class: exam #2   exam #2
Wed 4/8

Thu     Project 2: Breakout
design meeting due Thu 4/16

In Class: no RAT, but do the reading as if there will be one!

### Week 12: 4/13-4/17

Topics: ArrayList, APIs; inheritance, polymorphism, abstract classes, and interfaces

Mon In Class:

Thu   Lab 10: Partially-Full and Dynamic Arrays
due Thu 4/23
Project 2: Breakout
due Thu 4/23

Fri Class Preparation: Banks often offer many different types of accounts: standard checking and savings, dividend checking (checking accounts that pay interest), certificates of deposit, savings clubs, IRA savings accounts, ...
• Choose at least three different types of accounts (look up what a given type of account is if you aren't sure) and, for each, identify properties of that account type (what information is relevant) and actions that can be performed (e.g. deposit, withdraw).
• Compare the account types. What properties/actions are common to at least two types of accounts? What actions are common, but are carried out differently for different accounts? (e.g. withdrawing on one type might first check a minimum balance, while withdrawal on another doesn't) What properties/actions are unique to one type of account?

In Class:

### Week 13: 4/20-4/24

Topics: inheritance, polymorphism, abstract classes, and interfaces

Mon In Class:

Wed In Class:

Thu   Lab 11: Rabbit Hunt
due Thu 4/30

Fri In Class: syntax quiz on inheritance, including writing a subclass, implementing an interface, and using this and super

### Week 14: 4/27-5/1

Topics: GUI programming

In Class: no RAT, but do the reading anyway!

Notes:

Examples:

In Class: no RAT, but do the reading anyway!

Thu     Project 3: Tic-Tac-Toe
due Sun 5/10 at 2pm

Fri In Class:

### Week 15: 5/4-5/5

Topics: wrapup

Mon In Class: meet in the lab to work on project 3

Tue

Wed

Thu

Fri

Sat