Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Write a Java program to simulate an ecosystem containing two types of creatures, bears and fish . The ecosystem consists of a river, which is

Write a Java program to simulate an ecosystem containing two types of creatures, bears and fish . The ecosystem consists of a river, which is modeled as a relatively large array (i.e. 500 cells). Each cell of the array should contain an Animal object, which can be a bear, a fish, or null . Initialize the array to randomly contain these three types. In each time step, based on a random process, each bear/fish either attempts to move into an adjacent array cell or stay where it is. If two animals of the same type are about to collide in the same cell, then they stay where they are, but they create a new instance of that type of animal, which is placed in an empty (i.e. previously null ) cell in the array. If a bear and a fish collide, then the fish dies (i.e., it disappears). Provide summary information on the array after each time step (time step number and how many bears, fish, and null ). Run the simulation until the ecosystem contains all bears.

Re-write your river of bears and fish, using the new DoublyLinkedList class (instead of an array).

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Databases Illuminated

Authors: Catherine M. Ricardo, Susan D. Urban, Karen C. Davis

4th Edition

1284231585, 978-1284231588

More Books

Students also viewed these Databases questions

Question

Explain the market segmentation.

Answered: 1 week ago

Question

Mention the bases on which consumer market can be segmented.

Answered: 1 week ago

Question

=+6 Who is the peer of the IA ?

Answered: 1 week ago

Question

=+herself to in terms of equity with regard to this assignment?

Answered: 1 week ago