Great circle. Write a program GreatCircle that takes four double command-line argumentsx1, y1, x2, and y2(the latitude
Question:
Great circle. Write a program GreatCircle 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.toRadians() and Math.toDegrees() 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).
Fantastic news! We've Found the answer you've been seeking!
Step by Step Answer:
Related Book For
Introduction To Programming In Java An Interdisciplinary Approach
ISBN: 9780672337840
2nd Edition
Authors: Robert Sedgewick, Kevin Wayne
Question Posted: