Ch. 7 Lecture Notes - Designing classes according
to object-oriented principles such as cohesion and coupling.
Demo Programs
- Ch7DemoSwap - swapping variables with a Pair class since Java only
passes by value
- Ch7DemoStaticStuff - illustrates
use of static methods, a static field, scope of variables and properties, & passing
by value
- Ch7DemoFish - a warm-up version of Marine Biology
- tutorial on methods
- great tutorial on instance & static methods with several exercises by Ms. Hartsook - http://techcenter.davidson.k12.nc.us/methods.htm
- MultipleClasses - multiple classes in one source file
Worksheets
- Ch. 7 Worksheet #1 - designing a class but not implementing it
- Ch. 7 Packet #1 - sample AP-style multiple choice questions (see
Mr. Minich for this handout)
- Ch. 7 Packet #2 - sample AP-style multiple choice questions (see
Mr. Minich for this handout)
Programming Assignments
- Ch7Proj1 - implementing a Fish move
method & default constructor that provides unique id numbers
- Ch7Proj2 - two Fish objects that cannot move to the same location
- Ch7Proj3 - two Fish objects in a bounded environment
- Ch7Proj4 - dying fish
- Ch7Proj5 - SlowFish