Rabbits

Classic programmed-learning exercises, refreshed for modern Java and presented in the current MrStyner.com portfolio style.

Modern Java noteThis archive has been refreshed for Java 25 LTS. Core language concepts remain useful, while outdated setup instructions and browser-era Java are labeled or replaced. Java 26 is the current feature release; Java 25 is used here as the stable teaching baseline.

Answer:

It returns a 1. According to the math-like definition, this is not correct.

Rabbits

Say that a female rabbit is mature 2 months after birth. Assume that each mature female rabbit produces 1 baby female rabbit per month. If you start out with one baby female rabbit, how many female rabbits will you have in 10 months? Assume that there are enough male rabbits to ensure maximum production, and that no rabbits die.

Here is a chart:

N12345 678910
Females1          

The chart shows the number of rabbits at the end of the first month, at the end of the second month, and so on.

QUESTION 9:

How many female rabbits do you have at the end of the second month?