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 Seremban Sepang Nilai 28 Bangi 0 25 Beranang 12 Dengkil 12 Putrajaya 8.3 Sepang 25 Nilai Seremban 13 28 Beranang 12 0 35.4 43.2 35.1 13.2 23 Dengkil 12 35.4 0 19.6 30.3 21.1 Putrajaya 8.3 432 19.6 0 30.0 34.6 57.6 35.1 30.3 30.0 0 33.5 33.6 13 13.2 21.1 34.6 33.5 0 26.8 23 43 57.6 33.6 26.8 0 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 (1 SNS25) which indicates the size of table. The following N lines contains the data with N integer numbers.
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 Seremban Sepang Nilai 28 Bangi 0 25 Beranang 12 Dengkil 12 Putrajaya 8.3 Sepang 25 Nilai Seremban 13 28 Beranang 12 0 35.4 43.2 35.1 13.2 23 Dengkil 12 35.4 0 19.6 30.3 21.1 Putrajaya 8.3 432 19.6 0 30.0 34.6 57.6 35.1 30.3 30.0 0 33.5 33.6 13 13.2 21.1 34.6 33.5 0 26.8 23 43 57.6 33.6 26.8 0 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 (1 SNS25) which indicates the size of table. The following N lines contains the data with N integer numbers.
Database System Concepts
7th Edition
ISBN:9780078022159
Author:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Chapter1: Introduction
Section: Chapter Questions
Problem 1PE
Related questions
Question

Transcribed Image Text:Use 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.
Seremban
Beranang
Dengkil
Nilai
12
12
13
35.4
0
Bangi
0
Bangi
Beranang
12
Dengkil
12
Putrajaya 83
Sepang
25
Nilai
Seremban
13
0
35.4
43.2
35.1
13.2
23
Sample Input Output
19.6
30.3
21.1
Output
The output displays the shortest distance.
Sample Input
Putrajaya
8.3
43.2
7
e 12.0 12.0 8.3 25.0 13.0 28.0
12.0 e 35.4 43.2 35.1 13.2 23.0
12.0 35.4 e 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.00 33.5 33.6
13.0 13.2 21.1 34.6 33.5 @ 26.8
28.0 23.0 43.0 57.6 33.6 26.8 8
19.6
0
30.0
34.6
57.6
Sepang
25
35.1
30.3
8.3
30.0
0
33.5
33.6
13.2
21.1
34.6
33.5
0
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.
28
Input
The first line of input is a positive integer N (1 ≤N≤25) which indicates the size of table.
The following N lines contains the data with N integer numbers.
23
Sample Output
43
57.6
33.6
26.8
Expert Solution

This question has been solved!
Explore an expertly crafted, step-by-step solution for a thorough understanding of key concepts.
Step by step
Solved in 4 steps with 2 images

Knowledge Booster
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.Recommended textbooks for you

Database System Concepts
Computer Science
ISBN:
9780078022159
Author:
Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:
McGraw-Hill Education

Starting Out with Python (4th Edition)
Computer Science
ISBN:
9780134444321
Author:
Tony Gaddis
Publisher:
PEARSON

Digital Fundamentals (11th Edition)
Computer Science
ISBN:
9780132737968
Author:
Thomas L. Floyd
Publisher:
PEARSON

Database System Concepts
Computer Science
ISBN:
9780078022159
Author:
Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:
McGraw-Hill Education

Starting Out with Python (4th Edition)
Computer Science
ISBN:
9780134444321
Author:
Tony Gaddis
Publisher:
PEARSON

Digital Fundamentals (11th Edition)
Computer Science
ISBN:
9780132737968
Author:
Thomas L. Floyd
Publisher:
PEARSON

C How to Program (8th Edition)
Computer Science
ISBN:
9780133976892
Author:
Paul J. Deitel, Harvey Deitel
Publisher:
PEARSON

Database Systems: Design, Implementation, & Manag…
Computer Science
ISBN:
9781337627900
Author:
Carlos Coronel, Steven Morris
Publisher:
Cengage Learning

Programmable Logic Controllers
Computer Science
ISBN:
9780073373843
Author:
Frank D. Petruzella
Publisher:
McGraw-Hill Education