Hi again. I'm writing an interactive program to calculate the distance between two locations (in latitude and longitude coordinates) based on user input. I'm having trouble passing the parameters, and I keep getting this one compiler error message in BlueJ that I've never seen before and don't understand. I've indicated it's position in my code. I figure it's incorrect use of the parameters or I've just written complete garbage. Thanks in advance for any help or advice.
import java.util.*;
import java.lang.Math;
import java.lang.Double;
public class Distance3
{
public static void main (String[] args)
{
whatIsDistance();
}
public static void whatIsDistance()
{
//asks user for the name of the location and assigns to variable
Scanner console = new Scanner(System.in);
System.out.print("What is the first location? City, State, Country");
String location1 = console.next();
//asks user for coordinates and assigns to variable
System.out.print("What is the latitute? (DDMMSS)");
double lat1 = console.nextDouble();
System.out.print("What is the longitude? (DDDMSS)");
double long1 = console.nextDouble();
System.out.print("What is the Second location? City, State, Country");
String location2 = console.next();
System.out.print("What is the latitute? (DDDMMSS)");
double lat2 = console.nextDouble();
System.out.print("What is the latidude? (DDDMMSS)");
double long2 = console.nextDouble();
calcDistance(); //COMPILER ERROR: calcDistance(double,double,double,double) in Distance3 cannot be applied to ()" regarding calcDistance()
}
public static double calcDistance(double lat1, double lat2, double long1, double long2)
{
double Distance=Math.pow(Math.sin(lat2-lat1)/2,2 + Math.cos(lat1)*Math.cos(lat2)*Math.pow(Math.sin(Delta/2), 2));
Distance = Math.sqrt (Distance);
Distance = 2 * Math.sin(Distance);
return(6372.795 * Distance);
System.out.println("There are " + Distance + " kilometers between location1 and location2");
}
}
