User Tools

Site Tools


7._write_the_trees_in_a_file

The Java training online

Back to the table of contents

7. Write the trees in a file

Purpose: Write text in a file

Statement of the exercise:

  1. build a tool method accepting in arguments a list of SpatializedTrees and a fileName, to write a line in the file per tree in the list.
  2. each line contains the tree id, age, x, y, z, height, dbh, crownBaseHeight and crownRadius of the tree, all columns are separated by tabs.
  3. a header line starting with a # comment mark displays the column names
  4. in case of trouble, an error message is written in the terminal and the exception is thrown back to the caller.
  5. write the previous exercise tree list in a file called trees.txt

Helper and solution

Back to the table of contents

7._write_the_trees_in_a_file.txt ยท Last modified: 2021/12/13 09:28 by 127.0.0.1