Question: please use eclipse application to write the code about the following requirements: Generate a distance matrix, where the from city is the row address plus

please use eclipse application to write the code about the following requirements:

Generate a distance matrix, where the from city is the row address plus one. (from city 1 = 1 + row 0) And the to city is the column address plus 1 (to city 2 = 1 + column 1). Distances are integers that range from 0 to 100. Make a matrix for 4 cities.

Example:

From city 1 to city 2 is 27.

From 1 to 3 is 36.

1 to 4 is 18

2 to 1 is 59

2 to 3 is 17

2 to 4 is 86

3 to 1 is 97

3 to 2 is 18

3 to 4 is 58

4 to 1 is 89

4 to 2 is 76

4 to 3 is 85

Going back to a city from itself is not allowed, so the distances for those points dont matter. For this example, those distances have been recorded at 42.

The matrix would look like this:

To city 1 2 3 4

From city 1: 42 27 36 18

From city 2: 59 42 17 86

From city 3: 97 18 42 58

From city 4: 89 76 85 42

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!