// Tree.java // Author: Kiri Wagstaff // Date: July 24, 2001 public class Tree { double height; // in meters public Tree() { height = 0; } public Tree(double height) { // We need to use "this" to determine which "height" // we're referring to. this.height = height; } // Sad. The tree gets cut down. public void cutDown() { height = 0; } // If you water the tree, it grows twice as tall! public void water() { height *= 2; } public String toString() { // This prints out only two decimal places return "Tree: " + (int)(height*100)/100.0 + " meters"; } }