Note: this code does not contain a lot of internal
documentation to allow focusing on the basic logic. Submitted labs and
other assignments may have other requirements.
Ch. 2
Ch. 3
- Pyramid10.java: volume of pyramid
10 meters high
- PyramidVolume.java: volume of
pyramid with arbitrary height
- Average0.java: attempt at
computing average population over three cities. Note this version has
errors.
- TravelTime.java: illustrating
using an assignment to update a variable. This also has a simple test
illustrating using an if statement.
- TravelGUI.java: the same program
but rewritten to use dialogs
Ch. 4: Control Statements
- Guess.java: illustrates writing a
loop with complex exit conditions.
- WaitingForGodot.java:
illustrates using flags to terminate a loop. Also illustrates
using JOptionPane with strings.
Ch. 5: Libraries
Ch. 6: Object-Oriented Programming
Ch. 7
Ch. 9
- NameList.java: illustrates
reading, printing, and processing an array of strings.
- array.zip: zip file containing
IntelliJ project for this code (plus Roster)
- PrintArgs.java: prints
command-line arguments to system output. This illustrates why the
parameter to main is an array of strings as well as how to
process those strings.
- Roster.java: Roster
class implemented using an array of strings. In addition to using an
array, this illustrates searching an array for a target value. It also
contains commented-out code using a for-each
loop. See RosterDriver.java
for code exercising the array.
Ch. 10
- Roster.java: version of
Roster class based on ArrayList rather than simple
arrays. Compare to the array-based
version. This code also illustrates using for-each loops and
using Character to convert characters to upper and lower case.
Note that the Roster interface did not change as a result of
changing how the data is
stored. RosterDriver.java
exercises your code; this is basically the same as the
previous version with a call
to convertNamesToProperCase (code designed just to illustrate
updating an array list and to use Character).