Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Please use JAVA. .. Write a program that computes the spherical distance between two points on the surface of the Earth, given their latitudes and

Please use JAVA...

image text in transcribed

Write a program that computes the spherical distance between two points on the surface of the Earth, given their latitudes and longitudes. This is a useful operation because it tells you how far apart two cities are if you multiply the distance by the radius of the Earth, which is roughly 6372.795 km. Let 01, 11, and Q2, A2 be the latitude and longitude of two points, respectively. AA, the longitudinal difference, and Ao, the angular difference/distance in radians, can be determined as follows from the spherical law of cosines 10 = arcos(sin 01 sin 02 + cos 01 Cos 02 COSAA) For example, consider the latitude and longitude of two major cities: Nashville, TN: N 367.2'. W 8640.2 Los Angeles, CA: N 3356.4', W 11824.0' You must convert these coordinates to radians before you can use them effectively in the formula. After conversion, the coordinates become Nashville: 01 = 36.12 = 0.6304 rad, 11 = -86.67 = -1.5127 rad Los Angeles: 02 = 33.94 = 0.5924 rad, A2 = -118.40 = -2.0665 rad Using these values in the angular distance equation, you get rao = 6372.795 x 0.45306 = 2887 259 km Thus, the distance between these cities is about 2887 km, or 1794 miles. (Note: To solve this problem, you will need to use the Math.acos method, which returns an arccosine angle in radians.)

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

Step: 3

blur-text-image

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

Building Database Driven Catalogs

Authors: Sherif Danish

1st Edition

0070153078, 978-0070153073

More Books

Students also viewed these Databases questions