Create a data type Location that represents a location on Earth using latitudes and longitudes. Include a method distance To() that computes distances using the great-circle distance (see Exercise 1.2.33).
Exercise 1.2.33
Great circle. Write a program Great Circle that takes four double command-line arguments—x1, y1, x2, and y2—(the latitude and longitude, in degrees, of two points on the earth) and prints the great-circle distance between them. The great-circle distance (in nautical miles) is given by the following equation:
Note that this equation uses degrees, whereas Java’s trigonometric functions use radians. Use Math.to Radians() and Math.to Degrees() to convert between the two. Use your program to compute the great-circle distance between Paris (48.87° N and 2.33° W) and San Francisco (37.8° N and 122.4° W).
Already registered? Login
Not Account? Sign up
Enter your email address to reset your password
Back to Login? Click here