Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Using Java language This problem simulates the percolation of fire in a tree farm starting with the first row on fire. If the tree farm

Using Java languageimage text in transcribedimage text in transcribed

This problem simulates the percolation of fire in a tree farm starting with the first row on fire. If the tree farm is very dense, percolation will cause most of the trees to burn. If the tree farm is sparse, a smaller percentage of trees will catch and the fire will die out The main method constructs a square 2D array of user specified capacity and density, displays the initial configuration (using some character for tree), ignites the first row, runs the burn algorithm and then displays the final configuration (using some character for burned tree). Report the initial actual percent of trees and after the burn report the percent of trees burned in the fire. Report whether the fire burns out inside the forest or burns through, endangering housing areas. The wind pushes the fire down. Ifa tree is on fire, neighbors on down left, straight down, and down right will also catch. To simplify code, you need only check these three neighbors. The fire does not spread sideways or backwards. In the picture below, the tree (T), once on fire, would burn any trees in the shaded area. Use error-checking loops to ensure valid data. 'A valid capacity is 10 to 30 trees per side A valid tree density is 0.20 to 0.80 Submit screen shots of files from two runs: A 20x20 forest with density 0.45 that burns out A 20x20 forest with density 0.45 that burns through Notes: 1. Random number can be generated using the Random class discussed in Chapter 3 2. The burn algorithm should be encoded as a main method, passed the 2D array. 3. The display algorithm should be encoded as a main method, passed the 2D array. 4. No helper classes need to be written; all code will be done in the application class containing the main method. This problem simulates the percolation of fire in a tree farm starting with the first row on fire. If the tree farm is very dense, percolation will cause most of the trees to burn. If the tree farm is sparse, a smaller percentage of trees will catch and the fire will die out The main method constructs a square 2D array of user specified capacity and density, displays the initial configuration (using some character for tree), ignites the first row, runs the burn algorithm and then displays the final configuration (using some character for burned tree). Report the initial actual percent of trees and after the burn report the percent of trees burned in the fire. Report whether the fire burns out inside the forest or burns through, endangering housing areas. The wind pushes the fire down. Ifa tree is on fire, neighbors on down left, straight down, and down right will also catch. To simplify code, you need only check these three neighbors. The fire does not spread sideways or backwards. In the picture below, the tree (T), once on fire, would burn any trees in the shaded area. Use error-checking loops to ensure valid data. 'A valid capacity is 10 to 30 trees per side A valid tree density is 0.20 to 0.80 Submit screen shots of files from two runs: A 20x20 forest with density 0.45 that burns out A 20x20 forest with density 0.45 that burns through Notes: 1. Random number can be generated using the Random class discussed in Chapter 3 2. The burn algorithm should be encoded as a main method, passed the 2D array. 3. The display algorithm should be encoded as a main method, passed the 2D array. 4. No helper classes need to be written; all code will be done in the application class containing the main method

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

Advances In Databases And Information Systems 22nd European Conference Adbis 2018 Budapest Hungary September 2 5 2018 Proceedings Lncs 11019

Authors: Andras Benczur ,Bernhard Thalheim ,Tomas Horvath

1st Edition

3319983970, 978-3319983974

More Books

Students also viewed these Databases questions

Question

4. What actions should Bouleau & Huntley take now?

Answered: 1 week ago