Question: IN JAVA Problem Description The following table shows the distance in km) between two towns. For example, distance between Bangi and Putrajaya is 8.3 km,

IN JAVA
Problem Description The following table shows the distance in km) between two towns. For example, distance between Bangi and Putrajaya is 8.3 km, and it is the shortest distance between two towns. Bangi Beranang Dengkil Putrajaya Seremban Sepang Nilai Bangi 12 8.3 25 13 28 0 12 Beranang 12 23 0 35.4 43.2 35.1 13.2 Dengkil 12 35.4 0 19.6 30.3 43 21.1 Putrajaya 8.3 43.2 19.6 0 30.0 34.6 57.6 33.6 Sepang 25 35.1 30.3 30.0 0 33.5 26.8 Nilai 13 13.2 21.1 34.6 33.5 0 0 Seremban 28 23 43 57.6 33.6 26.8 The above table information can be stored using array with size 7x7 since it involves 7 towns. Write a program to determine the nearest two towns of ANY given size of table. Input The first line of input is a positive integer N(1SNS25) which indicates the size of table. The following N lines contains the data with N integer numbers. Output The output displays the shortest distance. Sample Output 8.3 Sample Input Output Sample Input 7 0 12.0 12.0 8.3 25.0 13.0 28.0 12.00 35.4 43.2 35.1 13.2 23.0 12.0 35.4 O 19.6 30.3 21.1 43.0 8.3 43.2 19.6 0 30.0 34.6 57.6 25.0 35.1 30.3 30.0 0 33.5 33.6 13.0 13.2 21.1 34.6 33.5 0 26.8 28.0 23.0 43.0 57.6 33.6 26.80
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
