Implement A Class Roachpopulationthat Simulates The Growth Of A Roach Population
Implement a class RoachPopulationthat simulates the growth of a roach population. The constructor takes the size of the initial roach population. The breed mutator method simulates a period in which the roaches breed, which increases their population by a multiplicative factor chosen randomly and in the range [1.5, 2.5]. The spray mutator method simulates spraying with insecticide, which reduces the population by a percentage chosen randomly and in the range [5, 25] (i.e., the number of roaches is reduced by somewhere between 5%-25%). Implement an accessor method to return the current number of roaches. A program called RoachSimulation simulates a population that starts out with n roaches, where n is chosen randomly in the range [25,100]. An iteration of the simulation is made up of the tree steps: breed, spray, and display the size of the roach population. Before starting any of the simulation iterations be sure to display the initial number of roaches in the population. The entire simulation consists of completing 10 iterations (or until the roach population has reached 0).