CS1 assignments in Java
| -UncategorizedI’ve developed a Java library for my CS1 course
that SIGCSE members may be interested in using
for assignments. It includes:– An implementation of Karel the Robot that is
more full-featured than most. We use it to get
students started in using objects, extending
classes, stepwise refinement, practise
with control structures, and to help understand
polymorphism.– A set of simplified input and output classes. One
novel feature are methods such as intIsAvailable().
Such methods allow students to write robust code with
error checking.– A number of user interfaces, each accompanied by a
Java interface. Students write a class to implement
the interface and pass an instance to the UI. The
result is a complete and satisfying program.
- A combination lock: students write a class to determine when
the lock is locked or unlocked. It only unlocks if the correct
combination is passed as parameters. Students practice instance
variables and parameters.- An AM/FM radio: Students write a “tuner” class. It remembers the
current frequency, tunes up or down, seeks up or down, and has
presets. Students practice with instance variables, looping,
parameters.- A equation grapher: Students write a class implementing an eval
function. The provided user interface displays the corresponding
graph. Three different Java interfaces allow practice with only
parameters, parameters and instance variables (for the coefficients)
or parameters and arrays (arbitrary degree polynomials).- An image transformation program: Students write a class to
transform an image stored as a 2D array of integers. The provided user
interface reads the image from a file and calls the appropriate
transformation methods in the student class. Transformations can
include rotating, scaling, brighten, flip, mirror, etc. I believe a
similar assignment was included in the SIGCSE 2003 Nifty Assignments
panel.- A marks “spreadsheet”: gives students practise with both 1D and 2D
arrays. The 1D arrays store student and assignment names. The 2D array
stores the marks.The library is available for download at
http://www.cs.uwaterloo.ca/~bwbecker/robots
Click on the Software link to see demos and download the
library. It requires Java 1.3.1 or greater.If you end up using it in one of your courses, I’d appreciate
hearing about it!Byron
E-Mail from Byron Weber Becker