Call us 24/7: + 1(925)399 0085

Get your paper done by an expert

No matter what kind of academic paper you need, it is simple and secure to hire an essay writer for a price you can afford at StudyAcer. Save more time for yourself.

WhatsApp + 1(925)399 0085
$ 10
free
  • bibliography
  • title page
  • revisions
per page
19 k happy customers
4.7 out of 5 satisfaction rate
27 writers active

Make a java package program work. Prey/ Predator project from absolutte Java 5the editon chapter 8 programming project 4.

Make a java package program work. Prey/ Predator project from absolutte Java 5the editon chapter 8 programming project 4.

4.    The goal for this programming project is to create a simple 2D predator–prey
simulation. In this simulation, the prey is ants, and the predators are doodlebugs.
These critters live in a world composed of a 20 20 grid of cells. Only one critter
may occupy a cell at a time. The grid is enclosed, so a critter is not allowed to move
off the edges of the grid. Time is simulated in time steps. Each critter performs
some action every time step.
   The ants behave according to the following model:
    •    Move. Every time step, randomly try to move up, down, left, or right. If the
cell in the selected direction is occupied or would move the ant off the grid,
then the ant stays in the current cell.
    •    Breed. If an ant survives for three time steps, then at the end of the third time
step (i.e., after moving), the ant will breed. This is simulated by creating a new
ant in an adjacent (up, down, left, or right) cell that is empty. If there is no
empty cell available, no breeding occurs. Once an offspring is produced, the
ant cannot produce an offspring until three more time steps have elapsed.
   The doodlebugs behave according to the following model:
    •    Move. Every time step, if there is an adjacent cell (up, down, left, or right)
occupied by an ant, then the doodlebug will move to that cell and eat the ant.
Otherwise, the doodlebug moves according to the same rules as the ant. Note
that a doodlebug cannot eat other doodlebugs.
    •    Breed. If a doodlebug survives for eight time steps, then at the end of the time
step, it will spawn off a new doodlebug in the same manner as the ant.
    •    Starve. If a doodlebug has not eaten an ant within the last three time steps,
then at the end of the third time step, it will starve and die. The doodlebug
should then be removed from the grid of cells.
   During one turn, all the doodlebugs should move before the ants.
   Write a program to implement this simulation and draw the world using ASCII
characters of “o” for an ant and “X” for a doodlebug. Create a class named
Organism  that encapsulates basic data common to both ants and doodlebugs.
   This class should have an overridden method named  move  that is defined in the
derived classes of Ant  and  Doodlebug . You may need additional data structures to
keep track of which critters have moved.
   Initialize the world with 5 doodlebugs and 100 ants. After each time step, prompt
the user to press Enter to move to the next time step. You should see a cyclical pattern between the population of predators and prey, although random perturbations
may lead to the elimination of one or both species.

Mock, Walter Savitch Kenrick (2012-03-20). Absolute Java (5th Edition) (Page 519). Pearson HE, Inc.. Kindle Edition.

 

Our guarantees

Study Acers provides students with tutoring and help them save time, and excel in their courses. Students LOVE us!No matter what kind of essay paper you need, it is simple and secure to hire an essay writer for a price you can afford at StudyAcers. Save more time for yourself. Delivering a high-quality product at a reasonable price is not enough anymore.
That’s why we have developed 5 beneficial guarantees that will make your experience with our service enjoyable, easy, and safe.

Money-back guarantee

You have to be 100% sure of the quality of your product to give a money-back guarantee. This describes us perfectly. Make sure that this guarantee is totally transparent.

Read more

Zero-plagiarism guarantee

Each paper is composed from scratch, according to your instructions. It is then checked by our plagiarism-detection software. There is no gap where plagiarism could squeeze in.

Read more

Free-revision policy

Thanks to our free revisions, there is no way for you to be unsatisfied. We will work on your paper until you are completely happy with the result.

Read more

Privacy policy

Your email is safe, as we store it according to international data protection rules. Your bank details are secure, as we use only reliable payment systems.

Read more

Fair-cooperation guarantee

By sending us your money, you buy the service we provide. Check out our terms and conditions if you prefer business talks to be laid out in official language.

Read more

Our Homework Writing Disciplines

With a highly diverse team in almost all academic fields including: