The Java training online
Try to work with the helping elements before looking at the solution…
Helping elements
SpatializedTree
→ the source code must be saved in a file named SpatializedTree.java
Tree
: SpatializedTree extends Tree
dbh
instance vaiable is inherited from the Tree
superclass, do not add it againprivate double x;
and private double y;
SpatializedTree
constructor takes 3 parameters: double dbh, double x, double y
dbh
is passed to the constructor of the superclass: super(dbh)
, then x
and y
are saved in the instance variables with code like: this.x = x;
x
and y
: setXY (double x, double y)
A possible solution