33 lines
719 B
Java
33 lines
719 B
Java
public class Tree {
|
|
private String typeOfTree;
|
|
private double height;
|
|
private double width;
|
|
|
|
public Tree(String newTypeOfTree, double newHeight, double newWidth) {
|
|
typeOfTree = newTypeOfTree;
|
|
height = newHeight;
|
|
width = newWidth;
|
|
}
|
|
|
|
public String getTypeOfTree() {
|
|
return typeOfTree;
|
|
}
|
|
|
|
public double getHeight() {
|
|
return height;
|
|
}
|
|
|
|
public double getWidth() {
|
|
return width;
|
|
}
|
|
|
|
public void grow(double heightAdd, double widthAdd) {
|
|
height += heightAdd;
|
|
width += widthAdd;
|
|
}
|
|
|
|
public String toString() {
|
|
return "Type of Tree: " + typeOfTree + " Height: " + height + " Width: " + width;
|
|
}
|
|
}
|