![]() |
CISC 124: Introduction to Computing Science II(Fall 2002)Slides and Examples[Home] [Schedule
& Readings] [Exams & Grading]
[Assignments] [Slides
& Examples]
|
I will be using this area to post the slides & example code I use for my lectures.
The slides are posted in PDF format: a full-size version fo viewing online and one compressed to four slides to a page for printing. I believe any public labs you may be using will have PDF readers. If you don't have a PDF reader on your home machine, you can install a free one from Packman or directly from Adobe.
Along with each set of slides will be the source code for most of the
example programs I use in my lectures. Please feel free to download,
run, and experiment with
these. I've made every effort to debug my examples thoroughly,
but if you find a bug please tell me.
I try to have my slides finished and posted a day before I actually
use them, but that's not always possible. If you don't see the topic
you're looking for yet,
remember to refresh your screen before you give up; you may be looking
at an old version. Topics are listed in reverse chronological order,
so the most recent is first. The dates for each topic are only guesses
when I post them ahead of time; it's often difficult to predict exactly
how long a set of slides will take.
Cloning Examples
I made 4 different versions of the examples to illustrate different
ways of copying and/or aliasing.
Version 1: aliasing
Time.java
Appointment.java
Datebook.java
Version 2: shallow copy
Time.java
Appointment.java
Datebook.java
Version 3: deep copy
Time.java
Appointment.java
Datebook.java
Version 4: deep copy using clone() and
Cloneable:
Time.java
Appointment.java
Datebook.java
Package Examples
UsesStacks.java:
simple test program that uses the Stacks package
The Stacks package
consists of the following 4 files. They must be put in a folder called
"Stacks", as explained in the lecture:
Stacks.java
ArrayStack.java
LinkedStack.java
StackException.java
I/O Examples
OutputStreamDemo.java
PrintWriterDemo.java
FileClassTest.java
BufferedReaderDemo1.java
BufferedReaderDemo2.java
Employee.java:
new version with binary I/O added
Company.java
Collections Examples
HashSetDemo.java
TreeSetDemo.java
SetAliasing.java
LunchTesterSetSolution.java
HashMapDemo.java
MapIteratorDemo.java
Graphics Examples
PaintDemo1.java
PaintDemo2.java
PaintDemo3.java
PaintDemo4.java
PaintDemo5.java
PaintDemo6.java
Button Action Examples
This series of programs are different
stages or versions of the demos done in class:
ButtonAction1.java
ButtonAction2.java
ButtonAction3.java
ButtonAction4.java
ButtonAction5.java
ButtonAction6.java
Layout Examples
These three are approximations to the demos I will
do in class.
BorderDemo.java
FlowDemo.java
GridDemo.java
The panel demonstration -- we looked at pieces of
this on the slides
PanelDemo.java
Examples For Swing, Part 1
My "baby swing" examples.
The first few represent stages in the demo I did in class. The rest
are from the slides.
BabySwing1.java
BabySwing2.java
BabySwing3.java
BabySwing4.java
BabySwing5.java
BabySwing6.java
BabySwing7.java
BabySwing8.java
BabySwing9.java
Savitch's simple window listener
class: WindowDestroyer.java
Iterator Examples:
yet another version
of stacks, using iterators:
Stack.java
ArrayStack.java
LinkedStack.java
IteratorDemo.java
(uses the stack iterators)
Matrix.java
Practice problem reference: doubly-linked
list code from CISC 121.
IntDLList.java
(doubly-linked list class)
IntDLLNode.java
(nodes for doubly-linked lists)
Inheritance Examples:
Employee.java:
basic class describing plain employees
Salesperson.java:
subclass of Employee for salespeople who receive commissions
Executive.java:
subclass of Employee for executives who receive bonuses
Unionized.java:
subclass of Employee for unionized workers who get overtime pay
PayrollDemo.java:
demo program for all of the above classes
Stacks, version 1:
Stack.java:
interface
ArrayStack.java:
array implementation
LinkedStack.java:
linked list implementation
StackDemo.java:
test/demo program
Employee, version 2:
New version of the
inheritance example, with equals and compareTo added:
Employee.java
Salesperson.java
Executive.java
Unionized.java
TestEquals.java:
short test program, just testing equals and compareTo
Abstract Class Example:
The first assignment from
last fall's CISC 124 is a good example of a program using an abstract class.
Follow links from that term's assignment
page to assignment 1 and its solution.
Set 9 Examples:
updated version of
Employee.java:
I added a toString to make some of the demos easier to write
Generic Stacks:
Stack.java:
interface
ArrayStack.java,
LinkedStack.java:
two implementations
StackDemo.java:
demo program
ShuffleClass.java:
generic "shuffle" method
SeqSearch.java:
generic sequential search method
GenericSort.java:
a generic selection sort plus demos of API sorting with and without Comparators
NameComparator.java,
WageComparator.java:
two Comparators for use with Employee objects
VectorDemo.java:
a simple demonstration of Vectors
Set 10 Examples:
Another version of
Stack example, this time adding exceptions:
Stack.java
ArrayStack.java
LinkedStack.java
StackDemo1.java,
StackDemo2.java:
two different demo programs with different exception-handling strategies
Versions of the demo I did
in class:
NumExcept1.java
NumExcept2.java
NumExcept3.java
NumExcept4.java
Other examples from the
slides:
CatchLevels.java
FileInputExample.java
MultCatch.java
This page created by Margaret Lamb, Queen's University, Kingston, Ontario. Last modified .