Purpose: Write a method returning a list, write a loop, use a random number generator.
Statement of the exercise:
the method takes 3 arguments: the expected number of trees, and the size of the rectangle for the trees coordinates x
and y
(in meters)
the ids
of the trees are unique, between 1 and number of trees
their age
is randomly chosen between 1 and 25
their height
is age / 2
their dbh
is age
the tree positions must be randomly chosen in the given rectangle
add code in the main method of exercise 1 to build a list of 10 trees and add a loop to display the result of their toString() method
Helper and solution