In-class Examples
CS 302, Summer 2001
Date
Example
8/8
New, improved
Point
class
Point3D
class
8/7
Collection class:
method prototypes
example
using a collection
Try It Yourself
: overloading (
solution
)
8/3
An
example
of defining and throwing exceptions
8/1
Try It Yourself
: console I/O (
solution
)
Try It Yourself
: exceptions (
solution
)
Selected Java syntax
(updated to include try-catch)
7/30
Try It Yourself
: arrays (
solution
)
7/26
Concentration
The
Deck
class
Selected Java syntax
(updated to include arrays)
7/24
The
Card
class
7/19
Try It Yourself
: using a book collection (
solution
)
7/18
Try It Yourself
: characters and strings (
solution
)
Try It Yourself
: parameter passing (
solution
)
7/16
Nested loops
examples from class
Code
for Bingo! (the song)
7/12
21-500 Game
7/11
Revised
Die
class - updates in
red
Comparing loops
Try It Yourself
: loops (
solution
)
Selected Java syntax
(updated to include loops)
7/10
Quiz 3, Question 5
solution
7/9
Message sending
example (
solution
)
Try It Yourself
: ifs (
solution
)
Motivating example
for
switch
Java syntax for selection statements
7/5
Magic8Ball
class and some
code
to test it
Triple Roll
7/3
Example
for illustrating parameter passing, local variables, and return values.
7/2
Try It Yourself
: Defining Classes (
solution
)
Die
class
Code for
testing the Point class
6/28
Point
class
6/26
Try It Yourself
: Arithmetic Expressions (
solution
)
BMI Calculator
6/25
The
complete program
for the ice cream cone making example.
6/21
The
complete program
for the text formatting example.
Back to
CS 302 Home Page