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
Which of the following describes a source file? A. It contains the information to be copied. B. It's where copied information is
jeyben [28]
I'd say it's A because source file originally means "a file that contains original data," which I believe A has the closest meaning to it.
8 0
3 years ago
Read 2 more answers
What is the function of HTML?
Igoryamba

Answer:

option A is correct answer of this question

hope it helps

4 0
3 years ago
Read 2 more answers
This algorithm requires you to find the perimeter of 12 different squares.
k0ka [10]

Answer:

BEGIN

SET count = 1

WHILE count <= 12 THEN

     INPUT length

     perimeter = length * length

     PRINT perimeter

END WHILE

END

Explanation:

You can also set count to 0 and in while loop use count < 12 to loop just 12 times just as above

4 0
3 years ago
1. provides a list of at least five SSIDs and the
taurus [48]

One of the most important ways to provide wireless security is through:

  • The use of encryption.

<h3>What is Wireless Security?</h3>

This refers to the network authentication and use of encryption to secure a network from unauthorized access or compromise of the network by an external agent.

With this in mind, we can see that SSID is a WiFi network name and it makes use of WPA2 security encryption to protect the wireless network through wireless encryption protocol.

Please note that your question is incomplete so I gave you a general overview to help you get a better understanding of the concept.

Read more about wireless security here:
brainly.com/question/14449935

8 0
2 years ago
All of the 802. 11 standards for wireless networking support which type of communication path sharing technology?.
Tom [10]

Answer:

CSMA/CA. It stands for Carrier Sense Multiple Access/Collision Avoidance.

6 0
3 years ago
Other questions:
  • A type of specialty processor devoted exclusively to protecting your privacy.
    9·2 answers
  • Consider the following declaration.int[] beta = new int[3];int j;Which of the following input statements correctly input values
    11·1 answer
  • Are Most job applications are online
    9·1 answer
  • How do you begin typing a table cell
    8·1 answer
  • When would it be beneficial to make a copy of a document
    10·1 answer
  • Bob gets an e-mail addressed from his bank, asking for his user ID and password. He then notices that the e-mail has poor gramma
    6·1 answer
  • Consider this C Program C++ Program Java Program or C# Program. It reads integers from the
    8·1 answer
  • As part of its commitment to sustainability, a company is looking for a way to track the source of purchased goods and how they
    14·2 answers
  • Mark just finished reading the cay and must write a book report comparing events in the book to events in his life. based on eac
    8·1 answer
  • GUYS I NEED HELP!!!! Every time pc resets it clears all of my data files and content how do you fix this. Pls help
    7·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!