The Capsis training online

Back to the table of contents

Solution: 12. Mortality

Try to work with the helping elements before looking at the solution…

Helping elements

    double survivalProba = 0.98;
    double proba = random.nextDouble (); // [0,1[
    return proba <= survivalProba; // returns true in 98% of the cases

A possible solution

A possible survival method Calling the method in the tree growth loop After 10 years, new trees appear, after 5 more years, mortality is visible

Back to the table of contents