6._write_a_method_to_create_a_list_of_trees
The Java training online
6. Write a method to create a list of trees
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
andy
(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
isage / 2
- their
dbh
isage
- 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
6._write_a_method_to_create_a_list_of_trees.txt ยท Last modified: 2021/12/13 09:28 by 127.0.0.1