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 is an IF statement used for?
kiruha [24]

The IF statement is a decision-making statement that guides a program to make decisions based on specified criteria. The IF statement executes one set of code if a specified condition is met (TRUE) or another set of code evaluates to FALSE.

8 0
3 years ago
Name at least three real-life objects that are instances of each of the following classes:
DENIUS [597]

The three real-life objects that are instances of each of the following classes are given below:

a.<u> Song:</u>

The song Believe in yourself is an instance of song class

The song Where do broken hearts go is an instance of song class.

The song Ambition is an instance of song class

b. <u>CollegeCourse</u>

The College course Engineering is an instance of College course class

The College course Accounting is an instance of College course class

The College course Medicine is an instance of College course class

c. <u>Musician:</u>

The musician Rihanna is an instance of musician class.

The musician Sean Paul is an instance of musician class.

The musician Wyclef is an instance of musician class.

Real-life objects refer to the things that are characterized together as they share common qualities. The assignment simply wants you to name examples under the categories given.

Read related link on:

brainly.com/question/16699733

7 0
2 years ago
Consider the graph of the function f(x) = 2(x + 3)2 + 2. Over which interval is the graph decreasing? (–∞, –3) (–∞, 2) (–3, ∞) (
Vaselesa [24]

Answer:

The interval over which the graph is decreasing is;

(-∞, -3)

Explanation:

The given function is f(x) = 2·(x + 3)² + 2

By expanding the function, we have;

2·x² + 12·x + 20

From the characteristics of a quadratic equation, we have;

The shape of a quadratic equation = A parabola

The coefficient of x² = +2 (positive), therefore the parabola opens up

The parabola has a minimum point

Points to the left of the minimum point are decreasing

The minimum point is obtained as the x-coordinate value when f'(x) = 0

∴ f'(x) = d(2·x² + 12·x + 20)/dx = 4·x + 12

At the minimum point,  f'(x) = 4·x + 12 = 0

∴ x = -12/4 = -3

Therefore;

The graph is decreasing over the interval from -infinity (-∞) to -3 which is (-∞, -3)

Please find attached the graph of the function created with Microsoft Excel

The graph is decreasing over the interval (-∞, -3).

6 0
3 years ago
Read 2 more answers
What are the steps to add a bibliography to a document? 1. Create a using the proper steps. 2. Go to the tab on the ribbon. 3. I
olasank [31]

Answer:

The steps required to add a bibliography after adding the sources of the information contained in the document and marking the references made in the text, are;

1. Click to select insertion point of the bibliography

2. Select the Reference tab by clicking on the Reference tab in the ribbon

3. Within the Citations & Bibliography group, select Bibliography to open  a dropdown list of bibliography format

4. Select the applicable format

5. By selecting the desired bibliography format, the bibliography is inserted at the selected insertion point of the document

Explanation:

6 0
3 years ago
Changing how information is represented so that it can be read by a person is called
Usimov [2.4K]

Answer:

Decode. To change how information is represented so that it can be read by a person.

Explanation:

Decoding is the ability to apply your knowledge of letter-sound relationships, including knowledge of letter patterns, to correctly pronounce written words. Understanding these relationships gives children the ability to recognize familiar words quickly and to figure out words they haven't seen before.

4 0
3 years ago
Other questions:
  • PPPLLLLEEEEAAASSSSEEEEE HHELLP me.Does anyone know how to copy an image onto a thing so i can post a real question on brainly. b
    8·2 answers
  • PLEASE HELP ITS DRIVERS ED
    8·2 answers
  • 3. Of the following pieces of information in a document, for which would you most likely insert a mail merge field? A. First nam
    13·2 answers
  • Why are advanced features helpful when businesses use spreadsheets
    5·1 answer
  • What is seven times seven divided by 49
    14·2 answers
  • What statement best decribes the relashionship bewteen science and technoligy?
    11·2 answers
  • If an M/M/1 queue in a server has task arrivals at a rate of 30 per second and serves at a rate of 50 per second, how many tasks
    10·1 answer
  • Information about hardware engineers?
    9·1 answer
  • 13) An-Excel-file-is-generally called-a-l-an:
    6·1 answer
  • When dividing it’s total debt by total equity what’s a company trying to measure
    9·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!