Write java program to simulate a ecosystem

Assignment Help JAVA Programming
Reference no: EM131001981

Write a java program to simulate an ecosystem containing two types of creatures, bears andfish. The ecosystem consists of a river, which is modeled as a relatively large array. Each cell of array should contain an Animal object, which can be a Bear object, a Fish object, ornull. In each time step, based on a random process, each animal 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 a random empty (i.e., previously null) cell in the array. If a bear and a fish collide, however, then the fish dies (i.e., it disappears). Use actual object creation, via the new operator, to model the creation of new objects and provide a visualization of the array after each time step.

Reference no: EM131001981

Questions Cloud

Culate an exact numerical value for s : For death during the deferred period, can be purchased for a single premium of 2200. Calculate an exact numerical value for S.
What is k-nearest neighbor data mining algorithm : Natural language processing (NLP), a subfield of artificial intelligence and computational linguistics, is an important component of text mining. What is the definition of NLP? What are the five steps in the backpropagation learning algorithm?
Discuss the convergence of european nations : Discuss the convergence of European nations after 1945 and compare this phenomenon with the current trend of divergence that currently exists between Europe and the United States.
What is the cost of the guarantee to the manufacturer : Assuming that interest is a constant 5% and that reimbursement is made at the end of the year of failure, what is the cost of this guarantee to the manufacturer, as a percentage of the purchase price?
Write java program to simulate a ecosystem : Write a java program to simulate an ecosystem containing two types of creatures, bears andfish. The ecosystem consists of a river, which is modeled as a relatively large array. Each cell of array should contain an Animal object, which can be a Bea..
What is the new single premium : For a certain insurance contract, on (50), the death benefit for the first year. If the value of q50 is changed to 0.25, while all other value of qx are unchanged, what is the new single premium?
Find a formula for p assuming premiums are returned : Find a formula for P, assuming: (a) premiums are returned without interest; (b) premiums are returned with interest.
How human piety and sanctity are conceived and recognized : Symbols: their origin and meaning in different religious traditions. Authority over tradition: how it is established, and the role it plays in different religious traditions. Saintliness: how human piety and sanctity are conceived and recognized
Record the transactions-using t-accounts : Darlene Cook Company engaged in the following transactions during the month of July: July 1 Acquired land for $10,000. The company paid cash.

Reviews

Write a Review

JAVA Programming Questions & Answers

  Implement a shopping cart class with user interface

project will be to implement a shopping cart class with user interface (UI) that contains main() in Net Beans. The UI class will be used to perform user input/output and to invoke the appropriate methods of shopping cart class. When your program star..

  Application using arrays to manage personal financial record

design a Java application using arrays to manage personal financial records which include expenditures and incomes.

  Write a java program that inputs a string

Write a program that inputs a string similar to: 3 + 4 * 2 / ( 1 - 5 ) ^ 2 ^ 3. Your program should apply the Shunting-yard algorithm to this string to ultimately produce a mathematical result.

  Design a method in a stack implementation

Design a method in a Stack implementation that allows the user to insert a new member to the "bottom" of a stack.

  Creates an array named odds

Write code that creates an array named odds and stores all odd numbers between -6 and 38 into it using a loop. Make the array's size exactly large enough to store the numbers.

  Advantages and disadvantages of an arraylist

What are the advantages and disadvantages of an ArrayList? When should you use an ArrayList over a simple array

  Describe the swing applet life cycle

Describe the swing applet life cycle. Create a swing applet that displays the date and time in a JTextField with the JLabel "Today is" when the user clicks a JButton

  Accepts a string as its parameter and returns an integer

Write a method in java named secondHalfLetters that accepts a string as its parameter and returns an integer representing how many of letters in the string come from the second half of the alphabet

  Determine the output displayed when the button is clicked

Determine the output displayed when the button is clicked. Assume the five lines of the file Dates.txt contain the numbers 1492, 1776, 1812, 1929, and 1941 and the file is in the appropriate folder.

  Write specifications for method which advances date by one

Write specifications for the method which advances any given date by one day. Comprise a statement of purpose, pre- and post-conditions, and description of parameters.

  Design a java class to represent a 3-d geomtetric shape

Design and implement a Java class to represent a 3-D geomtetric shape of your choice. The class should contain a constructor, appropriate data fields and methods to return the volume of the shape, and the surface area of the shape and any other me..

  Sets a loop to find 10 random generated

Write a java code that 1) uploads a file 2) sets a loop to find 10 random generated words from the file and then search those words by a. IndexSequential Method b. indexBinary Method. then, report how much time both methods took.

Free Assignment Quote

Assured A++ Grade

Get guaranteed satisfaction & time on delivery in every assignment order you paid with us! We ensure premium quality solution document along with free turntin report!

All rights reserved! Copyrights ©2019-2020 ExpertsMind IT Educational Pvt Ltd