import java.lang.*; public class Kangaroo { static final int MALE = 0; static final int FEMALE = 1; static final double [] FERTILITY = {0, 0.25, 0.5, 0.65, 0.75, 0.9, 0.95, 0.95, 0.95, 0.9, 0.6, 0.4, 0.2, 0}; static final double [] MORTALITY = {0.45, 0.4, 0.3, 0.3, 0.25, 0.25, 0.25, 0.4, 0.5, 0.6, 0.7, 0.8, 0.9, 1.0}; private int _age = 0; final int gender = (Math.random () < 0.5) ? MALE : FEMALE; public Kangaroo () { } public int getAge () { return this._age; } public void age () { this._age++; } public Kangaroo breed () { if ((this._age < FERTILITY.length) && (Math.random () < FERTILITY [this._age])) { return new Kangaroo (); } return null; } public boolean survive () { if ((this._age < MORTALITY.length) && (Math.random () >= MORTALITY [this._age])) { return true; } return false; } }