CPSC 124 Introduction to Programming Spring 2019

CPSC 124 Schedule

Readings are to be done for the class period where they are listed. Warmups are due by midnight before the class for which they are listed.

Optional readings are more advanced or extra material for those who are curious or want to go beyond the basics - you are encouraged to check them out, but they will not be addressed in class.

Dates for things in light gray are for planning purposes and may shift slightly.

Reference:

 Assignments

Week 1: 1/22-1/25

Topics: course introduction; the mental landscape; basic building blocks

     

Wed Slides:      

Thu Reading:
  • Eck sections 2.6.1-2.6.2 (including the introduction to section 2.6)
  lab 1
Introduction to Linux and Java
due Thu 1/31

comments
 

Fri Reading:

Slides:

  • building blocks - the mental landscape, program structure, statements for working with values and variables (variable declarations, assignment statements, output)
warmup #1
(on Canvas, in the "Quizzes" section)
due Thu 11:59pm
 

Week 2: 1/28-2/1

Topics: basic building blocks; algorithms

   

Mon Reading:
  • Eck sections 2.3.1-2.3.3, 2.5.1-2.5.4, 2.5.6-2.5.7 (section 2.5.5 is optional) [reading guide]

Slides:

  • building blocks - statements for working with values and variables (variable declarations, assignment statements, output), expressions, built-in subroutines
warmup #2
(on Canvas, in the "Quizzes" section)
due Sun 11:59pm
 

Wed In Class: 5-minute syntax quiz on variable declarations, assignment statements, expressions, and output. Expect questions of the following types:
  • Declare a variable called length that will hold an integer.
  • Store the value 42 in the variable called size.
  • Write an expression to add 10 to the result of dividing 8 by 2. (and then possibly print the result or store it in a variable)
  • Print the message Hello world!. (or the value of a variable or expression)

Slides and Examples:

   

Thu Slides:

Reference:

  lab 2
First Programs
due Thu 2/7

comments
 

Fri Reading:

Slides and Examples:

warmup #3
(on Canvas, in the "Quizzes" section)
due Thu 11:59pm
 

Week 3: 2/4-2/8

Topics: conditionals; loops

   

Mon Reading:
  • review Eck sections 2.5.3-2.5.4
  • Eck sections 3.1.1, 3.1.3-3.1.4, 3.5 [reading guide]

Slides and Examples:

  • if statements
  • Calculator.java (if statements) - the version from class (with incorrect use of Scanner)
  • Calculator2.java (if statements) - with the correct usage of Scanner to read a single character, using the making a choice patterns to fill in the structure of the "evaluate expression" step, and one step towards filling in the at-most-one-of-many pattern with complete code
warmup #4
(on Canvas, in the "Quizzes" section)
due Sun 11:59pm
 

Wed In Class: 5-minute syntax quiz on if statements. Expect questions which ask you to translate pseudocode, such as:
  • if x is greater than 10,
      print "big!"
    otherwise
      print "small!"
    
  • if x is between 0 and 100,
      if x is less than or equal to 50 or greater than 75,
        print "A"
    otherwise if x is between 101 and 200,
      print "B"
    

(Note that in pseudocode like this, the indentation matters.)

Reading:

  • Eck section 3.6 (optional) - for section 3.6.3, read 2.3.4 first

Examples:

   

Thu   lab 3
Making Choices
due Thu 2/14

comments
 

Fri Reading:

Slides:

warmup #5
(on Canvas, in the "Quizzes" section)
due Thu 11:59pm
 

Week 4: 2/11-2/15

Topics: loops; arrays

   

Mon Slides and Examples:    

Wed Reading:

In Class: 5-minute syntax quiz on loops. Expect questions of the form:

  • Write a loop to repeat a task some number of times e.g.
    repeat 10 times
      System.out.println("*");
    
  • Write a loop to repeat a task as long as some condition is true e.g.
    target = 0;
    repeat as long as target does not equal 5
      target = (int)(Math.random()*10);
    

As indicated, you'll be provided with code for everything except the loop syntax itself (which will be expressed in pseudocode). You may need to declare loop variables. Both while loops and for loops are acceptable.

Slides and Examples:

warmup #6
(on Canvas, in the "Quizzes" section)
due Tue 11:59pm
 

Thu   lab 4
Repetition
due Thu 2/21

comments
 

Fri Reading:

Slides and Examples:

warmup #7
(on Canvas, in the "Quizzes" section)
due Thu 11:59pm
 

Week 5: 2/18-2/22

Topics: arrays

   

Mon Reading:
  • Eck sections 4.8.1, 7.1.3 [reading guide]
  • (optional) Eck section 7.1.1

Slides and Examples:

   

Wed Reading:

In Class: 5-minute syntax quiz on arrays. Expect questions of the following types:

  • Declare an array of integers called numbers, and set it up with 10 compartments.
  • Print the number of slots in the array numbers.
  • Store the value 42 in the third slot of the array numbers.
  • Print out (initialize, add 5 to, etc) the values in each slot of the array numbers.

Slides and Examples:

warmup #8
(on Canvas, in the "Quizzes" section)
due Tue 11:59pm
 

Thu   lab 5
Arrays
due Thu 2/28

comments
 

Fri Slides and Examples:  

Week 6: 2/25-3/1

Topics: subroutines

   

Mon Reading: Slides and Examples: warmup #9
(on Canvas, in the "Quizzes" section)
due Sun 11:59pm
project 1
Minesweeper
muddiest points due Tue 2/26 11:59pm

Wed Reading:

Slides:

  project 1
Minesweeper
pseudocode due Fri 3/1

pseudocode handout

Thu   work on project

Fri Reading: Slides and Examples: warmup #10
(on Canvas, in the "Quizzes" section)
due Thu 11:59pm
  project 1
Minesweeper
program due Fri 3/15

comments

Week 7: 3/4-3/8

Topics: subroutines

   

Mon Reading:

In Class: 5-minute syntax quiz on subroutines and subroutines with parameters. Expect questions of the following types:

  • Write the header (comments and body not needed) for a subroutine to print the maximum of two integers: it should take two integers as parameters and print the larger of the two.
  • Write statement(s) to print the larger of 10 and the value stored in the variable x. Use your "print maximum" subroutine.

Slides and Examples:

warmup #11
(on Canvas, in the "Quizzes" section)
due Sun 11:59pm
 

Wed
exam 1 in class
   

Thu   lab 6
Subroutines and Functions
due Thu 3/14

comments

Fri Slides and Examples:

Week 8: 3/11-3/15

Topics: subroutines; odds and ends; exceptions; using objects

 

Mon In Class: 5-minute syntax quiz on functions and return statements. Expect questions of the following types:
  • Write a complete definition (header and body) for a function which computes the maximum of two integers: it should take two integers as parameters and return the larger of the two.
  • Write statement(s) to print the larger of 10 and the value stored in the variable x. Use your "compute maximum" function.
Examples:
 

Wed Reading:

Slides and Examples:

warmup #12
(on Canvas, in the "Quizzes" section)
due Tue 11:59pm

Thu   lab 7
Programming With Subroutines
due Thu 3/28

Fri Reading:
  • Shiffman, Learning Processing, pages 121-123 (objects.pdf in the "Files" section on Canvas) [reading guide]
  • Eck section 1.5 [reading guide]
warmup #13
(on Canvas, in the "Quizzes" section)
due Thu 11:59pm
 

Spring Break: 3/16-3/24


Week 9: 3/25-3/29

Topics: using objects, creating classes

   

Mon Reading:

Slides and Examples:

   

Wed In Class: 5-minute syntax quiz on using objects. Expect questions of the following type:
  • Write Java statement(s) to create a Deck of cards, shuffle it, deal a card, and print the suit and value of the dealt card.

You may be asked to work with the Card, Deck, and Hand classes, or with a new class. You will be provided with the javadoc API of any classes you are to use (including Card, Deck, Hand).

Slides and Examples:

 

Thu   lab 8
Using Objects
due Thu 4/4

comments
 

Fri Reading:

Slides and Examples:

warmup #14
(on Canvas, in the "Quizzes" section)
due Thu 11:59pm
 

Week 10: 4/1-4/5

Topics: creating classes; program design with classes

   

Mon Slides and Examples:    

Wed In Class: 5-minute syntax quiz on writing classes as a blueprint for objects. Expect questions of the following type:
  • Write a complete class called Coin to represent a coin that can be tossed. Your class should have:

    • an instance variable holding the coin's current state (true for heads, false for tails)
    • a constructor which initializes the coin's state to heads
    • a constructor which takes the coin's initial state as a parameter and initializes the instance variable accordingly
    • a getter which returns the coin's state (true for heads, false for tails)
    • a method toss which tosses the coin, setting the state to a new random value

Slides and Examples:

  project 2
Billiards
muddiest points due Sun 4/7 11:59pm

Thu   lab 9
Writing Classes
due Thu 4/11

comments

Fri Reading:

Slides:

warmup #15
(on Canvas, in the "Quizzes" section)
due Thu 11:59pm

Week 11: 4/8-4/12

Topics: program design with classes; partially full arrays, dynamic arrays, array lists

 

project 2
Billiards
class/program design due Thu 4/11
Mon Reading:

Slides:

 

Wed Reading:

Slides and Examples:

warmup #16
(on Canvas, in the "Quizzes" section)
due Tue 11:59pm

Thu Materials:   work on project project 2
Billiards
program due 4/22

Fri Reading:

Slides and Examples:

warmup #17
(on Canvas, in the "Quizzes" section)
due Thu 11:59pm
 

Week 12: 4/15-4/19

Topics: partially full arrays, dynamic arrays, array lists; inheritance

   

Mon Slides and Examples:    

Wed
exam 2 in class
   

Thu   lab 10
Variable-Sized Collections
due Thu 4/25

Fri Reading:

Slides and Examples:

warmup #18
(on Canvas, in the "Quizzes" section)
due Thu 11:59pm

Week 13: 4/22-4/26

Topics: inheritance, polymorphism, abstract classes, interfaces

 

Mon Slides and Examples:   project 3
Snake Den
muddiest points due Thu 4/25 11:59pm

Wed Reading:

In Class: 5-minute syntax quiz on inheritance. Expect questions of the following types:

  • Write a complete class GraphicalCoin which is a subclass of Coin (see the example questions for the 4/2 syntax quiz for a description of Coin). Your class should have:

    • an instance variable holding the coin's current state (true for heads, false for tails)
    • instance variables holding the position where the coin is to be drawn
    • a constructor which takes the coin's initial state and position as parameters and initializes the instance variables accordingly
    • a constructor which takes the position of the coin as a parameter, initializes the position accordingly, and initializes the coin's state to heads
    • a getter which returns the coin's state (true for heads, false for tails)
    • a paint method which draws the coin's current state (heads or tails)
    • a method toss which tosses the coin, setting the state to a new random value, and then paints the coin with its new state

    Write only the code needed to achieve this functionality: make use of inheritance to reuse as much code as possible.

  • Write Java statement(s) to create a GraphicalCoin object in the position (100,200), flip it, paint it on the screen, and print the current state.

Slides and Examples:

warmup #19
(on Canvas, in the "Quizzes" section)
due Tue 11:59pm

Thu   lab 11
Inheritance
due Thu 5/2

comments

Fri Reading:

Slides and Examples:

warmup #20
(on Canvas, in the "Quizzes" section)
due Thu 11:59pm
project 3
Snake Den
class/program design due Mon 4/29

Week 14: 4/29-5/3

Topics: interfaces; GUI programming

 

Mon Materials:

Slides and Examples:

  project 3
Snake Den
program due 5/13 11:30am

Wed Reading:
  • Eck sections 1.6, 6.1-6.2, 6.3.1-6.3.2, 6.4.1-6.4.2, 6.5.2-6.5.3, 6.6.1 [reading guide]

Slides and Examples:

 

Thu   Introduction to GUIs
due at the end of lab

Fri Slides and Examples:  

Week 15: 5/6

Topics: wrapup

   

Mon -- meet in Rosenberg 009 --    

Reading Period: 5/7-4/9


Tue    

Wed    

Thu    

Final Exams: 5/10-5/13


Fri  

Sat    

Sun  

Mon
final exam
Mon 5/13 8:30-11:30am
end-of-semester deadline
no work accepted after 5/13 11:30am

Valid HTML 4.01!