Menu

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

in c++• pls comment it so that i understand it
Class inheritance and polymorphism: Predator- Prey Simulation. Simulation: - In a world of 20 x 20 grid of cells, there lives
media%2F568%2F5684663a-65cb-48d7-8265-53Class 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 cel1. – 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 bugand ‘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 cel1. – 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 bugand ‘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 *