Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Create a flow chart with the below shapes for the follow Java program. / / Header file import java.util.Scanner; / / Defining the class class

Create a flow chart with the below shapes for the follow Java program.
//Header file
import java.util.Scanner;
//Defining the class
class Main {
//Defining the main()
public static void main(String[] args){
//Creating Scanner object
Scanner sc=new Scanner(System.in);
//Getting input from the user
System.out.print("Enter the number of cities:");
int n=sc.nextInt();
//Getting the coordinates from user
System.out.print("Enter the coordinates of the cities:");
double[][] coord=new double[n][2];
for(int i=0;isum){
tot_min=sum;
ind_min=i;
}
}
System.out.println("The central city is at("+coord[ind_min][0]+","+coord[ind_min][1]+")");
System.out.println("The total distance to all other cities is "+tot_min);
}
//Defining the distance_tot method
public static double distance_tot(double[][]cities,int i){
double sum=0;
for(int j=0;j
image text in transcribed

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image_2

Step: 3

blur-text-image_3

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Database Design Query Formulation And Administration Using Oracle And PostgreSQL

Authors: Michael Mannino

8th Edition

1948426951, 978-1948426954

More Books

Students also viewed these Databases questions