User Tools

Site Tools


5._add_methods_in_the_tree

The Java training online

Back to the table of contents

5. Add methods in the tree

Purpose: Choose where methods should be added in an inheritance graph

Statement of the exercise:

  1. Add 2 methods in the tree, getCrownRadius() returning dbh / 5 and getCrownBaseHeight() returning 2 / 3 * height
  2. Adapt Tree.toString() to display the crownRadius and crownBaseHeight

Helper and solution

Back to the table of contents

5._add_methods_in_the_tree.txt ยท Last modified: 2021/12/13 09:28 by 127.0.0.1