Question: You are given a two-dimensional array of values that specify the height of a terrain at different points in a square. Write a Java program

You are given a two-dimensional array of values that specify the height of a terrain at different points in a square. Write a Java program with the following tasks:

A method to read the heights of all the points of a terrain and store them into the two-dimensional array. You can assume that the heights are integer values

. Constructor of the class

A method to find the lowest point of the terrain.

A method to find the highest point of the terrain.

A method to print out a flood map, showing which of the points in the terrain would be flooded if the water level was a given value. In the flood map, print a * for each flooded point and a for each point that is not flooded. Here is a sample map for a 5 by 5 square:

* * - * -

* - - * *

* * * * *

- - * - *

* * - - -

Test your implemented class using a 4 by 4 squared terrain. Note: Your main class should work for squared terrains with any size.

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!