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
Is there a way to earn free robux
worty [1.4K]

Answer:

not really

explanation:

there isnt a way to get it for free alone. if a friend has robux, they can give/trade you

8 0
3 years ago
Read 2 more answers
Decisions 1 and 3 are both ____________ decisions because ____________________.
Hoochie [10]

The Question given is incomplete so from the internet the complete question is as follows:

Health Day Regional Medical center's management team has several decisions to make. They are attempting to sort out what to do first. The decisions are as follows:

1. Determine which patients to be admitted for the next day.

2. Decide weather or not to purchase the only other medical center in their          region.

3. Decide which candidates will meet the requirements for the nursing training program.

4. Determine weather the medical center should diversify into more advanced (and substantially more costly ) technologies.

Decisions 1 and 3 are both ____________ decisions because ____________________.

A. Programmed decisions; they are novel and complex

B. Non programmed decisions; they are novel and complex  

C. Programmed decisions; they are can be solved using rules and procedures

D. Non programmed decisions; they are novel and complex

E. None of the above is correct

Answer:

Option C is the correct answer.

Decisions 1 and 3 are both Programmed decisions because they can be solved using rules and procedures .

Explanation:

Programmed Decisions can be defined as the ones that are specified and developed for routine problems that are repetitive. These decisions deal with certainty.

Now from the given list of decisions, it is obvious that the decision 1 and 3 are programmed.

  • Patients that are to be admitted must undergo through the rules and regulations so that a decision may be taken.
  • Similarly in the case of nurses, proper testing must be conducted and candidates are selected upon this criteria.

<h2>I hope it will help you!</h2>

5 0
3 years ago
Which of the following is NOT a best practice to protect data on your mobile computing device?
OleMash [197]

<u>Lock your device screen when not in use and require a password to reactivate</u> is not a best practice to protect data on your mobile computing device.

<h3>What is a mobile computing device?</h3>

Any device that was built using mobile parts, such as mobile hardware and software, is referred to as a mobile computing device. Portable devices that can function like a typical computing device in terms of operation, execution, and provision of services and applications are known as mobile computing devices.

Portable and handheld computing devices are other names for mobile computing devices.

Modern handheld devices that have the hardware and software needed to run common desktop and Web applications are generally referred to as mobile computing devices. Similar hardware and software elements found in personal computers, such as processors, random memory and storage, Wi-Fi, and an operating system, are also found in mobile computing devices. They are made specifically for mobile architecture and portability, which sets them apart from PCS.

Learn more about mobile computing devices

brainly.com/question/8189998


#SPJ1

4 0
1 year ago
Which term collectively describes hard disks, CDs, and flash drives?
N76 [4]
Hard disks, CDs, and flash drives are all storage mediums.
8 0
3 years ago
Read 2 more answers
Henry must choose which type of smart speaker to use in his home. He asked you to help him decide which one will best suit his n
ch4aika [34]

Answer:

(B) Home

Explanation:

Echo is an Amazon product.

Home is a smart speaker developed by Google.  

Cortana is a product of Microsoft.

HomePod is developed by Apple.

If Henry wants to be connected to his Google account, you would recommend him to buy Home, because it is a Google product.

4 0
3 years ago
Other questions:
  • This is the main work area of your computer.
    7·1 answer
  • Where can you check effective access on a shared folder? answer?
    11·1 answer
  • What are the main types of computer software?
    5·2 answers
  • How to select the entire table in microsoft excel
    11·1 answer
  • Technician A says that front and rear U-joints on a RWD axle should operate at different angles to prevent vibration. Technician
    10·1 answer
  • Eye wash stations should contain enough water to provide ______ minutes of continuous use
    5·2 answers
  • I’m turning my Pinterest into a professional account what should be my user name please try to think of a good name and not just
    11·2 answers
  • James has a USB flash drive that he has used at work. The drive needs to be thrown away, but James wants to make sure that the d
    12·1 answer
  • NEED HELP ASAP!!!!!!
    7·2 answers
  • Consider the following method, which is intended to count the number of times the letter "A" appears in the string str.
    13·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!