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 attribute of the image tag specifies the URL of an image
DedPeter [7]

Answer:

src attribute of image tag specifies the url of an image.

7 0
3 years ago
A terrible new disease, HORSEVID, has begun to spread among horses worldwide. Stable manager Jimmy is trying to take as many pre
tresset_1 [31]

Answer:

Explanation:

Well here you only have to add 2 new horses .... so simply what you can do is find 2 slots where the gap is maximum ... lets take the given example in detail to understand the same.... here 10001001000010 here you can observe that the difference between the first two filled slots is 3 then 2 then 4 then 1....... make it a separate array ...... now as i said that we just need to place two new horses so we just need two of the biggest numbers from this array and place the new horses at the center of the corresponding slots ... like here 3 and 4 are greatest ... so one horse is placed in between the gap corresponding to 3  while other at 4 ..... after making the new array answer can be find in linear time itself... I hope this makes sense ....

Now lets understand how to program it easily so firstly after scanning all stuff ..... we will make a gap array .... then just think now what we will do is find the greatest two numbers then again putting the horses and then find our answers .... so now an easy approach is that instead of making the string again and again searching for answer .... what we do is just do half of the two greatest ones and again find the greatest one in array....

6 0
3 years ago
I'll pay 50 dollars to anyone who can do this leave your snap after answering doing it and ill cash app it
gladu [14]

Well for must cases it is the Ram of the system and the processor I will show you how you can get rid of slow processing

  1. Run the task manager then try to stop some running programs
  2. the antivirus sometimes slows the computer due to the processing power it takes.
  3. I would recommend that all program should be closed from the task manager and close some running apps in the system settings go to start up and then close it now you are good to go.

5 0
3 years ago
It is used to select specific menu options, drag and drop options and to draw something on screen.
Novay_Z [31]

Answer:

A mouse.

Explanation:

An input device can be defined as any device that is typically used for sending data to a computer system.

Generally, all of the output and input device of a computer are known as peripheral (external) devices and they provide data (informations) to the end users in various formats such as video, audio, texts, images etc.

Since input devices are peripheral (external) devices, they can be connected to the computer system wirelessly or through a wired-connection (cable).

Some examples of peripheral (external) devices are monitor, speakers, keyboard, printer, scanner, projector, mouse, etc.

A mouse is an input device that is designed and used to select specific menu options, drag and drop options and to draw something on screen.

8 0
2 years ago
PLEASE HELPPPPPPP What should you always disconnect before installing hardware inside a computer’s case?
Ad libitum [116K]

Answer:

a) all cabling hope it helps

3 0
2 years ago
Other questions:
  • In Linux Operating System, what file extension is used forexecutable files?
    6·1 answer
  • A job application is a form used to make a job request.<br> True<br> False
    8·2 answers
  • What will be the output of the following Python code? class A: def test1(self): print(" test of A called ") class B(A): def test
    15·1 answer
  • You are to create a program using Python that asks the user for a nonnegative number, then computes the mean and variance using
    15·1 answer
  • Create a class named Invoicing that includes three overloaded computeInvoice() methods for a book store: see pages 196 for examp
    7·1 answer
  • Aside from human user types, there are non human user groups. Known as account types, __________ are implemented by the system t
    10·1 answer
  • The graph shows households in the world with internet access from 2003 to 2019. A graph titled Percentage of Households with Int
    6·2 answers
  • Paul wants to store addresses and phone numbers for clients. Paul wants to use this information to send form letters. Paul shoul
    5·1 answer
  • Type the correct answer in the box
    13·1 answer
  • Can anyone figure this out???? I need help ASAP!
    8·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!