5. Write a program that computes the spherical distance between two points on the surface of the Earth, given their latitudes and longitudes. This is a useful operation because it tells you how far apart two cities are if you multiply the distance by the radius of the Earth, which is roughly 6372.795 km. Let v1, A1, and 42, d2 be the latitude and longitude of two points, respectively. AX, the longitudinal difference, and AO, the angular difference/distance in radians, can be determined as follows from the spherical law of cosines: Ao = arccos(sing¡sino2 + cosY2cosY>COs AX) For example, consider the latitude and longitude of two major cities: • Nashville, TN: N 36°7.2/, W 86°40.2/ • Los Angeles, CA: N 33°56.4/, W 118°24.0/ You must convert these coordinates to radians before you can use them effectively in the formula. After conversion, the coordinates become • Nashville: p = 36. 12° = 0.6304 rad, A¡ = -86. 67° = -1.5127 rad • Los Angeles: 2 = 33.94° = 0.5924 rad, A2 = -118. 40° = -2.0665 rad Using these values in the angular distance equation, you get rAo = 6372.795 × 0.45306 = 2887.259 km Thus, the distance between these cities is about 2887 km, or 1794 miles. (Note: To solve this problem, you will need to use the Math.acos method, which returns an arccosine angle in radians.)
5. Write a program that computes the spherical distance between two points on the surface of the Earth, given their latitudes and longitudes. This is a useful operation because it tells you how far apart two cities are if you multiply the distance by the radius of the Earth, which is roughly 6372.795 km. Let v1, A1, and 42, d2 be the latitude and longitude of two points, respectively. AX, the longitudinal difference, and AO, the angular difference/distance in radians, can be determined as follows from the spherical law of cosines: Ao = arccos(sing¡sino2 + cosY2cosY>COs AX) For example, consider the latitude and longitude of two major cities: • Nashville, TN: N 36°7.2/, W 86°40.2/ • Los Angeles, CA: N 33°56.4/, W 118°24.0/ You must convert these coordinates to radians before you can use them effectively in the formula. After conversion, the coordinates become • Nashville: p = 36. 12° = 0.6304 rad, A¡ = -86. 67° = -1.5127 rad • Los Angeles: 2 = 33.94° = 0.5924 rad, A2 = -118. 40° = -2.0665 rad Using these values in the angular distance equation, you get rAo = 6372.795 × 0.45306 = 2887.259 km Thus, the distance between these cities is about 2887 km, or 1794 miles. (Note: To solve this problem, you will need to use the Math.acos method, which returns an arccosine angle in radians.)
Database System Concepts
7th Edition
ISBN:9780078022159
Author:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Chapter1: Introduction
Section: Chapter Questions
Problem 1PE
Related questions
Question
How do you do this? JAVA. Comment everything out. Prompt the user for input and use a scanner object to read the input. Program should read input as decimal degrees and assume that all latitudes and longitudes are positive numbers.
Expert Solution
This question has been solved!
Explore an expertly crafted, step-by-step solution for a thorough understanding of key concepts.
This is a popular solution!
Trending now
This is a popular solution!
Step by step
Solved in 2 steps with 1 images
Knowledge Booster
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.Recommended textbooks for you
Database System Concepts
Computer Science
ISBN:
9780078022159
Author:
Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:
McGraw-Hill Education
Starting Out with Python (4th Edition)
Computer Science
ISBN:
9780134444321
Author:
Tony Gaddis
Publisher:
PEARSON
Digital Fundamentals (11th Edition)
Computer Science
ISBN:
9780132737968
Author:
Thomas L. Floyd
Publisher:
PEARSON
Database System Concepts
Computer Science
ISBN:
9780078022159
Author:
Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:
McGraw-Hill Education
Starting Out with Python (4th Edition)
Computer Science
ISBN:
9780134444321
Author:
Tony Gaddis
Publisher:
PEARSON
Digital Fundamentals (11th Edition)
Computer Science
ISBN:
9780132737968
Author:
Thomas L. Floyd
Publisher:
PEARSON
C How to Program (8th Edition)
Computer Science
ISBN:
9780133976892
Author:
Paul J. Deitel, Harvey Deitel
Publisher:
PEARSON
Database Systems: Design, Implementation, & Manag…
Computer Science
ISBN:
9781337627900
Author:
Carlos Coronel, Steven Morris
Publisher:
Cengage Learning
Programmable Logic Controllers
Computer Science
ISBN:
9780073373843
Author:
Frank D. Petruzella
Publisher:
McGraw-Hill Education