Example Programs
done in class
-
illustrating object scope rules and closure (12/03)
-
illustrating nesting of function calls (11/26)
factorial recursive calls illustrated (11/26)
comparing recursive factorial with iterative (11/26)
Recursive fibonacci vs. iterative (11/26)
-
Java Quickstart session 2 (11/25)
1a) FirstProg.java
1b) Thing.java
2a) OOGrader.java
2b) Student.java
-
frisbee game: passing objects around (11/21)
-
converting deck to an object: deck.deal(n) (11/14)
-
converting the deck to an object (11/12)
-
dealing a hand from the deck, laying a
card on the table (11/07)
-
making a card deck and shuffling it (11/05)
card game: deck, hands, dealing, putting on the table (11/05)
-
object constructor functions (10/31)
-
explicitly creating an object with function fields (10/29)
installing a function in an object (this keyword) (10/29)
-
function as argument in, another way (10/24)
function as argument in (10/24)
functions are values (10/24)
small stuff: indexOf, typeof (10/24)
-
Returning collection of variables (early objects) (10/22)
-
Generating arrays of data: Random Strings (10/10)
Returning entire arrays (10/10)
-
nested arrays: triangular output (10/08)
-
Coordinated Arrays: course grades (10/03)
Generating arrays of data: Random Numbers (10/03)
-
Arrays forward and backward (10/01)
-
Scope oops (how global variables cause problems) (9/24)
Locals hide globals (illustrating scope rules) (9/24)
-
Awesome Name Combiner (input/output via HTML text fields (9/19)
data validation another way (compact boolean functions) (9/19)
-
data validation with functions (9/17)
data validation with functions (do-while loop) (9/17)
-
bones of assignment 2 (9/12)
-
validate user input data (9/10)
-
even, odd (if-then-else in loop) (9/5)
speed violations (if-then-else cascade) (9/5)
-
counters (for loop, loop index) (9/3)
-
summing pairs (while loop, user controlled ) (9/3)
-
product of a sequence (while loops, for loops are equivalent) (9/3)
-
assignment, simple expressions, evaluation (8/27)
-
user input, safe number prompt (8/27)
-
first program (auto run way 1) (8/22)
first program (auto run way 2) (8/22)
-
first program (button full documented) (8/20)
first program (button template) (8/20)
another first program (same button, different program) (8/20)