Question: Write a program that simulates the growth of **parasite population in an animal** over time. Each parasite organism **reproduces itself** at **some time interval**. Animals

Write a program that simulates the growth of **parasite population in an animal** over time. Each parasite organism **reproduces itself** at **some time interval**. Animals may **undergo drug treatment** to inhibit the reproduction process, and clear the parasites from their body. However, some of the parasite are **resistant to drugs** and **may survive**.

Details

- Identify objects that simulation uses from the above description

- Identify objects' properties and responsibilities

- Define C++ class for every object listing all possible members (data and functional)

- All data members must have **private** access

- Provide for each private data member a public method that allows access its value

- Naming convention: You can name your data member as you wish, however any methods that provide access to the field have to be named as follows: *get*

- E.g. Private field *speed* should have a public access method called *getSpeed()*.

- Bonus points

- use proper coding style (see below)

### Parasite Class

- Create **Parasite** class declaration in [main.cpp](main.cpp) file

- Include into the class definition all parasite properties

- a reproduction rate as `double` type field `reproductionRate`

- a drug resistance as `double` type field `resistance`

- Provide to encapsulated fields access functional members: `getReproductionRate` and `getResistance`

- Add functional members corresponding to parasite responsibilities

- For *reproducibility*, add method `reproduce` that, when is called, increases the reproduction rate by 10%

- For *survival*, add method `survive` that, when is called, increases the parasite resistance by 5%

- Both above methods have no parameters and do not return any value

### Animal Class

- Write a **Animal** class declaration in [main.cpp](main.cpp) file

- Similarly to **Parasite** class, include into the class definition all animal properties

- an immunity rate as `double` type field `immunity`

- a number of parasites in the animal as `unsigned int` type field `parasites`

- Use the initialized list to set the values of this field to `1000`

- Provide to encapsulated fields access functional members: `getImmunity` and `getParasiteNumber`

- Add functional members corresponding to parasite responsibilities

- For *taking drug*, add method `takeDrug` that returns nothing, and, when is called, increases the immunity of the animal by 7% and reduces the parasite population by `100`

## Test

Press **Run** button to execute and test your program.

- Or run `make test` command in the command line to verify the correctness of your program.

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!