CS 117: Writing your own classes (trees)

This assignment is to be done individually without your teammate. You can talk to other people in the class (including your teammate), me (Dave), the prefector, and lab assistants for ideas and to gain assistance. You can help each other debug programs, if you wish. The code that you write should be your own, however, and you shouldn't hand a printout of your program to others. See the course syllabus for more details or just ask me if I can clarify.

Let's make some foliage in a similar fashion to cars. Using the ideas from the Car class, start from scratch and create a Tree class that allows you to control the height of a tree. Use the Car class as an example. Don't get too fancy with your drawing--a brown rectangle plus a green circle make a lovely tree at this stage. Add a class called Landscape that serves the same purpose as Road on the last assignment: Landscape should draw a landscape with several trees of different sizes, all created as separate instances of a single Tree class.

Hand in your Tree.java and Landscape.java by Wednesday at 11:59 PM.


Written by Jeff Ondich, Dave Musicant, Amy Csizmar Dalal.