Question: Given a set of cities, the central city is the city that has the shortest total distance to all other cities. Write a program that
Given a set of cities, the central city is the city that has the shortest total distance to all other cities. Write a program that prompts the user to enter the number of the cities and the locations of the cities (coordinates), and finds the central city and its total distance to all other cities.
Enter the number of cities: 5 -Enter Enter the coordinates of the cities: 2.5 5 5.1 3 1 9 5.4 54 5.5 2.1 -Enter The central city is at (2.5, 5.0) The total distance to all other cities is 60.81
Step by Step Solution
3.50 Rating (153 Votes )
There are 3 Steps involved in it
Program Plan 1 Create a class CentralCityDistance 2 Read number of cities from the console 3 Read th... View full answer
Get step-by-step solutions from verified subject matter experts
