In this assignment you will ask the user to enter two


C Program Assignment

According to https://en.wikipedia.org/wiki/Great-circle_distance, the great circle distance based on two coordinates in nautical miles is given by:

d = r * Δσ where r is the radius of the earth and

Δσ = acos(sin(θ1) * sin(θ2) + cos(θ1)*cos(θ2) * cosΔλ)

The radius of the earth is a constant and its value in radians is r = 10800 / PI

Given 2 coordinates (Lat1, Long1, Lat2, and Long2) the formula can be re-written as:

Δσ = acos(sin(Lat1) * sin(Lat2) + cos(Lat1) * cos(Lat2) * cos(Long1 - Long2))

Because the coordinates on earth are given in degrees, you need to convert the degrees into radians by multiplying the degrees * PI / 180.

In this assignment, you will ask the user to enter two coordinates (Lat1, Long1, Lat2, Long2) and you will calculate the distance in nautical miles using the formula above. You will need to create a separate method call getDistance and pass the four coordinates as arguments and return the distance in nautical miles. Then you will display to the user the correspondent distance rounded to one decimal (i.e. 105.5 NM).

Solution Preview :

Prepared by a verified Expert
C/C++ Programming: In this assignment you will ask the user to enter two
Reference No:- TGS01602599

Now Priced at $35 (50% Discount)

Recommended (97%)

Rated (4.9/5)