Problem Statement Consider two locations, an origin and a destination, on the globe identified by their latitude and longitude. The distance between these two locations can be computed using the Spherical Law of Cosines. In particular, the distance d is d = arccos (sin(2) sin(2) + cos(P1)cas(2) cos(A)) - R where • pa is the latitude of location A, 22 is the latit ude of location B • Ais the difference between location B's langitude and location A's longitude Ris the (average) radius of the earth, 6,371 kilometers Write a program that prompts the user to enter the latitude and longitude of two locations and then computes the distance between them using the above formula. Note that latitude inputs will be in degrees and in the range [-90, 90] and longitude will be in degrees in the range [-180, 180 . Negative values correspond to the westem and southem hemispheres. Hack 2.0 - Computer Science I 1/2
Problem Statement Consider two locations, an origin and a destination, on the globe identified by their latitude and longitude. The distance between these two locations can be computed using the Spherical Law of Cosines. In particular, the distance d is d = arccos (sin(2) sin(2) + cos(P1)cas(2) cos(A)) - R where • pa is the latitude of location A, 22 is the latit ude of location B • Ais the difference between location B's langitude and location A's longitude Ris the (average) radius of the earth, 6,371 kilometers Write a program that prompts the user to enter the latitude and longitude of two locations and then computes the distance between them using the above formula. Note that latitude inputs will be in degrees and in the range [-90, 90] and longitude will be in degrees in the range [-180, 180 . Negative values correspond to the westem and southem hemispheres. Hack 2.0 - Computer Science I 1/2
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
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 2 images