Labs
Materials for labs designed by Peter and the current group of TAs/CAs for Spring 2009. We also use many of the labs designed by Joanne for earlier offerings of the course, but you won't find those here.
Week 4: Pong
This is a new lab and we have no clue how well it will work. Please let us know if you had fun or if you were completely overwhelmed!
- Lab Handout: week-04.txt
- Starter Code: Pong.java
- Standard Library: StdDraw.java StdRandom.java StdOut.java
If you were curious about the versions of Pong I showed in class, here they are for your retro-gaming pleasure. :-)
- Peter's Pong: FinalPong.java
- Shane's Pong: ShanePong.java
Week 5: Hangman
This lab is based on Joanne's lab with the same name, however we are using a different code base (starter code, libraries). Apparently we underestimated the complexity of the code a little, so the version below has been simplified a bit to make it easier to get started. Make sure you read all of the code before you start to modify it!
- Lab Handout: week-05.txt
- Starter Code: Hangman.java
- Standard Library: StdOut.java StdIn.java StdFile.java
Note that StdFile is not described in the book, read the
embedded documentation! StdFile is pretty much StdIn
except you can use the open() method to read from a
file instead; don't forget to call close() when you're
done with a file and before opening a new one.
Week 6: Colorize
We used Joanne's lab on generating random HTML, but we replaced all the file business with standard input and standard output as is the custom on Unix. Here is a solution in the form of several "snapshots" I took while writing it; I recommend you read these in sequence to see how I "grew" the program step by step.
Notice that I followed a "bottom up" strategy here: I built the pieces with minimal test code first and then assembled them into the actual program. I could also have gone "top down" instead, writing the main program first and then adding more and more transformations; in fact, that's what I recommended in the lab section I attended.
Week 11: Fun with Tables
This is a new lab and we have no clue how well it will work. Please let us know if you had fun or if you were completely overwhelmed!
- Lab Handout: week-11.txt
- Starter Code: TableStarter.java
- Data Files: one.txt two.txt three.txt four.txt five.txt
- Standard Library: StdIn.java StdOut.java