On the next page there are 4 gridbased maps each with 5 smal

On the next page, there are 4 grid-based maps each with 5 small towns shown as red squares. We would like to write a program that determines the \"optimal\" grid location to build a hospital so that it lies at a distance that minimizes the travel from each town. That is... the furthest distance that a town resident has to travel in order to reach the hospital is kept to a minimum. The answer is shown as a green circle for each of the 4 maps. Write a class cased HospitalBuilderProgram that computes the green circle location for each map. The program must read in a 3-dimensional array of town locations as shown below: The array has 4 maps. Each map has 5 towns. Each town has an (x, y) coordinate that matches the 4 maps shown earlier. Your program must loop through these towns and compute the answer to the problem. The easiest way is to compute the distance to each town from every one of the 20 times 20 grid locations and keep the best one as the answer. The distance between points (x_1, y_1) and (x_2, y_2) can be computed as d = Squareroot (x_2 - x_1)^2 + (y_2 - y_1)^2. The program should print out the (x, y) answer for each of the 4 maps.

Solution

The question is not clearly visible, i can\'t see the array data at all. More information required.

 On the next page, there are 4 grid-based maps each with 5 small towns shown as red squares. We would like to write a program that determines the \

Get Help Now

Submit a Take Down Notice

Tutor
Tutor: Dr Jack
Most rated tutor on our site