In class we saw how to compose objects to create a BoxCar class. Now we’re going to create another composite shape: Tree.
Rx: <25 min Av: 25-50 min Sd: 50-75 min DNF: 75+ min
Tree class with:
top & a Rectangle for the trunkx, y, width, & heightx, y, width, height, topColor, trunkColortopColor & trunkColorsetBounds method that:
x, y, width, & heightx, y and extends to width & heightpaint method that takes a Graphics parameter and calls the draw methods of the 2 fieldssetBounds to verify that it works correctly for any size tree.