Java program simulates the battle between a cat and mice


Disciss the following:

Q: Write a Java program that simulates the battle between a cat and mice.

Cat Kills 1 mouse a day, and does not reproduce.

Mice have a chance to reproduce as long as required conditions are met. Reproduction only happens when mice are over 1, and 1 of each sex is present.

Simulation continues as long as mice population is greater than 1 and less than 10.

Simulation should generate following output depending on if the population of mice is greater than or equal to 10, or no mice left:

Mice RULE, Cats Drool Mice Population: ## (integer value)

Or

Cats RULE, Mice Drool Cat Weight (in mice): ##.## (double value, 2 decimal places)

Sample session (requires no user input):

Mice RULE, Cats Drool Mice Population: 11
Press any key to continue . . .

Cats RULE, Mice Drool Cat Weight (in mice): 2.03
Press any key to continue . . .

Mice RULE, Cats Drool Mice Population: 10
Press any key to continue . . .

Cats RULE, Mice Drool Cat Weight (in mice): 2.05
Press any key to continue . . .

Solution Preview :

Prepared by a verified Expert
JAVA Programming: Java program simulates the battle between a cat and mice
Reference No:- TGS01934686

Now Priced at $20 (50% Discount)

Recommended (94%)

Rated (4.6/5)