Suppose every species in the world has a peculiar birthing pattern. After a female is born, a male is born, then a female, and so on. Give the definition of a method, called get Female Population, that you could add to the definition of the class Species First Try in Listing 5.3 to return the number of females in the population. Also, give the definition of a method called get Male Population that similarly returns the number of males in the population. If the population is an odd number, you have one species member left over after pairing males and females. Assume that species member is a female. For example, if the population is 7, there are 3 males and 4 females. But if the population is 8, there are 4 males and 4 females. (Hint: The definitions are very short.)
Already registered? Login
Not Account? Sign up
Enter your email address to reset your password
Back to Login? Click here