1answer.
Ask question
Login Signup
Ask question
All categories
  • English
  • Mathematics
  • Social Studies
  • Business
  • History
  • Health
  • Geography
  • Biology
  • Physics
  • Chemistry
  • Computers and Technology
  • Arts
  • World Languages
  • Spanish
  • French
  • German
  • Advanced Placement (AP)
  • SAT
  • Medicine
  • Law
  • Engineering
posledela
3 years ago
5

Write a program to calculate the great circle distance between two points on the surface of a sphere. If p1(x1, y1) and p2(x2,y2

) are geographic latitude and longitude of two points, the great circle distance can be computed as
Computers and Technology
1 answer:
Tamiku [17]3 years ago
8 0

Answer:

import java.lang.*;

public class distance { public static double distance(double latitude1,

                                     double latitude2, double longitude1,

                                     double longitude2)

       {

      // Convert Latitude and Longitude to Radians

           longitude1 = Math.toRadians(longitude1);

           longitude2 = Math.toRadians(longitude2);

           latitude1 = Math.toRadians(latitude1);

           latitude2 = Math.toRadians(latitude2);

           

           double d_longitude = longitude2 - longitude1;

           double d_latitude = latitude2 - latitude1;

           double a = Math.pow(Math.sin(d_latitude / 2), 2)

                   + Math.cos(latitude1) * Math.cos(latitude2)

                   * Math.pow(Math.sin(d_longitude / 2),2);

           double val = 2 * Math.asin(Math.sqrt(a));

           // Radius of earth in kilometers is 6371

           double earth_radius = 6371;

           // Calculate and return the distance

           return(val * earth_radius);

       }

       // Main Method

       public static void main(String[] args)

       {

           double latitude1 = 67.32055555555556;

           double latitude2 = 83.31861111111111;

           double longitude1 = -1.7217899;

           double longitude2 = -1.6567799;

           System.out.println(distance(latitude1, latitude2,

                   longitude1, longitude2) + " K.M");

       }

   }

Explanation:

This program is implemented in Java programming language

The formula for the shortest distance between two points on the earth is:

Distance = 3963.0 * arccos[(sin(lat1) * sin(lat2)) + cos(lat1) * cos(lat2) * cos(long2 – long1)]

The latitude and longitude of the two points must be known

The latitude and longitude are converted into radians using built in methods in java.

Take value for the radius of the earth in Kilometers  6371;

Note that a seperate method has been created to calculate the distance

In the driver method (main), values for latitude and logitudes for both places have been hard-corded, then the method distance is called and passed those values

Note also that the distance has been calculated in Kilometers

You might be interested in
What does a blinking yelow light mean on a phillips sonicare toothbrush
babunello [35]

Answer:

it means that you need to charge it or change the batteries depending on what kind you have

3 0
2 years ago
Choose the term that best matches the definition.
Y_Kistochka [10]

Answer: it’s network protocol

Explanation:

4 0
2 years ago
If you were an architect planning on building a large scale Municipal complex what type of engineer would you identify as essent
Daniel [21]

Answer: civil engineer

Explanation:

Based on the information given, the type of engineer that would be identified as essential to the success of the project would be the civil engineer.

Civil engineers are the engineers that are in charge of the planning and overseeing building and infrastructure construction. They plan and monitor constructions involving bridges, road, houses, power plants etc.

3 0
3 years ago
Microsoft has developed a method for measuring a system's total costs and benefits, called ____, which is a framework to help IT
Korvikt [17]

Answer:

It is called B. REJ

Explanation:

REJ means Rapid Economic Justification. This is a methodology or framework to help IT professionals analyze IT investments. The main aim of this framework for business optimization

7 0
3 years ago
What kind of computer system you recommend?
In-s [12.5K]
Depends on your budget and usage.
If no/low budget and happy with speed of current computer - replace network card or get an USB network card to resolve no wifi signal issue.
If no problem with budget - get a brand new latest computer.

Remember, it’s your data in the computer that worth a lot,computer hardware doesn’t cost that much and can be easily replaced.
7 0
3 years ago
Other questions:
  • Which of the following is the largest disadvantage of hydropower?
    8·2 answers
  • HURRY!! Ill give brainily and 25 points. Describe how Scent is related to the culture and historical period when it was created.
    15·1 answer
  • With microprocessors, The integration of a whole _____ onto a single chip or on a few chips greatly reduced the cost of processi
    14·1 answer
  • Explain the nature of documents that can be suitable for merging
    7·1 answer
  • A desktop computer (named workstation22) can’t connect to the network. A network card was purchased without documentation or dri
    15·1 answer
  • A list is sorted in ascending order if it is empty or each item except the last one is less than or equal to its successor.
    14·1 answer
  • Jasmine wants electrical current to be able to pass through a certain switch on a circuit board that she is designing. What stat
    5·1 answer
  • Has replaced the need for landline telephones in many instance​
    10·1 answer
  • How does the computer help me with school work
    5·2 answers
  • What features should you present when demonstrating 2023 murano’s confident cornering?.
    11·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!