Menu

[Solved]Class Inheritance Polymorphism Predator Prey Simulation Simulation World 20 X 20 Grid Cell Q37238720

in c++• pls comment so that i understand it
Class inheritance and polymorphism: Predator- Prey Simulation. Simulation: - In a world of 20 x 20 grid of cells, there livesmedia%2F3a6%2F3a68e2a1-04da-413d-a90a-91Class inheritance and polymorphism: Predator- Prey Simulation. Simulation: – In a world of 20 x 20 grid of cells, there lives two kinds of animals: ant and buçg – Each ant/bug takes on cell. – Bugs eat ants for food – Time is simulated in time steps. – Each animal performs some action every time step – During one time step, all bugs should move before the ants do – Initially, the grid has 5 bugs and 100 ants. – Print the grid after each step. Use x’ to represent bug and ‘o’ to represent ant. – Prompt user to press Enter to move to the next step. To exit: ctrl c Requirement: Create a base class: Animal. – Derive a class: Ant, as the prey. – Derive a class: Bug, as the predator We were unable to transcribe this imageShow transcribed image text Class inheritance and polymorphism: Predator- Prey Simulation. Simulation: – In a world of 20 x 20 grid of cells, there lives two kinds of animals: ant and buçg – Each ant/bug takes on cell. – Bugs eat ants for food – Time is simulated in time steps. – Each animal performs some action every time step – During one time step, all bugs should move before the ants do – Initially, the grid has 5 bugs and 100 ants. – Print the grid after each step. Use x’ to represent bug and ‘o’ to represent ant. – Prompt user to press Enter to move to the next step. To exit: ctrl c Requirement: Create a base class: Animal. – Derive a class: Ant, as the prey. – Derive a class: Bug, as the predator

Expert Answer


Answer to Class inheritance and polymorphism: Predator- Prey Simulation. Simulation: – In a world of 20 x 20 grid of cells, there … . . .

OR


Leave a Reply

Your email address will not be published. Required fields are marked *