subject

In this exercise you will write a program to compute the distance between any two geo locations. In this program you will ask the user for four numbers. starting latitude starting longitude ending latitude ending longitude Then, using the GeoLocation class, compute the distance in miles between the two locations. A sample program run should match exactly as below: 1. starting latitude
2. starting longitude
3. ending latitude
4. ending longitude Doub
Then, using the GeoLocation class, compute the distance in miles between the two locations.
A sample program run should match exactly as below:
Enter the latitude of the starting location: 18.8567 Fara
Enter the longitude of the starting location: 23598
Enter the latitude of the ending location: 53 5872 dist
Enter the longitude of the ending location: 21275
The distance is 280 28639358788545 miles.
How Far Away is ...?
1
2 This class stores information about a location on Earth. Locations are
3 specified using latitude and longitude. The class includes a method for
4 computing the distance between two locations.
5 *
6 This implementation is based off of the example from Stuart Reges at
7 the University of Washington.
8 */
9
10 public class Geolocation
11
12 // Earth radius in miles
13 public static final double RADIUS - 3963.1676;
14
15 private double latitude;
16 private double longitude;
17
18 /** 20 21 22 23
19 /* constructs a geo location object with given latitude and longitude
20 */
21 public GeoLocation(double theLatitude, double theLongitude)
22 {
23 latitude - thelatitude;
24 longitude = theLongitude:
25 }
26
27 */
28 Returns the latitude of this geo location
29 */
30 public double getLatitude
31 {
32 return latitude;
33 )
34
35 /**
36 * returns the longitude of this geo location
37 */
38 public double getLongitude()
39 {
40 return longitude;
41 }
42
43 // returns a string representation of this geo location
44 public String tostring()
45 {
46 return "latitude: " + latitude + " longitude: "longitude;
47
48
49 // returns the distance in miles between this geo location and the given
50 other geo location
51 public double distanceFron(Geolocation other)
52
53 double lati = Math. toRadians(latitude);
54 double longi - Math. to Radians(longitude):
55 double lat2 = Math. toRadians (other. latitude);
How Far Away is ...?
1 import java. util. Scanner;
2
3 public class HowFar Away
4
5 public static void main(String[] args)
6 {
7 // your code here.
8 Scanner scanner = new Scanner(System. in);
9 System. out. println("Enter the latitude of the starting location: ");
10 double myDouble = scanner. nextDouble(); 1
11 System. out. println("Enter the longitude of the starting location: ");
12 double lo scanner. nextDouble();
13 System. out. println("Enter the latitude of the endeing location: ");
14 double la = scanner. nextDouble();
15 system. out. println("Enter the longitude of the ending location: "); 5
16 double end scanner. nextDouble();
17 double di; HowFar Away the = new HowFarAway();
18 di distanceFrom();
19 System. out. println("The distance is" + di + "miles");
20 System. out. print In(d1); } }

ansver
Answers: 3

Another question on Computers and Technology

question
Computers and Technology, 22.06.2019 10:50
Write a 3-4 page apa formatted paper comparing your organization’s it strategy with the best practices outlined in your course text. content should include, but not be limited to: developing and delivering on the it value, developing it strategy for the business value and linking it to business metrics. your paper should include an abstract and a conclusion and a reference page with 3-5 references
Answers: 1
question
Computers and Technology, 22.06.2019 13:30
Write lines of verse that rhyme to remember the following information: acid rain is a type of air pollution caused by chemicals in the air.
Answers: 1
question
Computers and Technology, 22.06.2019 22:30
I'll mark brainliest if answered right! with which feature or menu option of a word processing program can you make an image like this? you can get this image using the option of a word processing program.
Answers: 1
question
Computers and Technology, 23.06.2019 02:30
People with high self-esteem: accept their strengths and weaknesses. believe that failed experiences are failures of their whole self. feel good about who they are only when they reach total success. need positive external experiences to counteract negative feelings that constantly plague them.
Answers: 1
You know the right answer?
In this exercise you will write a program to compute the distance between any two geo locations. In...
Questions
question
Mathematics, 01.11.2019 19:31
Questions on the website: 13722361