Problem

GPS Unit for HikersGPS has been built into a wide variety of consumer devices. These units...

GPS Unit for Hikers

GPS has been built into a wide variety of consumer devices. These units share many features but differ in details. Here we consider the GPS unit used by hikers and back country explorers. An important feature of such units is the ability to mark waypoints, including the ability to collect them into a path that can be retrieved later. Another important feature is distance and bearing to a waypoint: you have a target waypoint and you want to know what direction it is in and the distance to that target. This last feature is particularly useful in geocaching or locating your starting point, if you are lost.

When queried, the GPS hardware generates the current longitude and latitude: a pair of floating-point values. The range of longitude is −180 degrees to +180 degrees (the reference point, 0, is the meridian through Greenwich, England). The range of latitude is −90 degrees to +90 degrees (the reference point, 0, is the equator with positive values in the northern hemisphere). For example, according to the Farmer’s Almanac the “middle” of the United States is at latitude 39.83333 degrees, longitude −98.5833 degrees. That is near the town of Lebanon, in Smith County, Kansas. We need to simulate that capability in this exercise. Write a method named gps_get_long_lat that returns a longitude and latitude pair. The method uses the Python random module to generate the pair.

A waypoint will be a position, a longitude/latitude pair, with a name.

Implement the following capabilities:

• Your GPS unit should be able to save the current waypoint i.e., save the current position as a waypoint and associate a name with the position.

• Your GPS unit should be able to save and retrieve named paths consisting of a sequence of waypoints.

• It should also be able to find the length of a given path—assuming a straight line between each waypoint.

• Your GPS unit should be able to calculate the distance to a waypoint (from the current location).

Write a main program that loops and prompts the user for functionality provided by the GPS unit. Create a session that tests all methods.

Optional: Add a method to calculate a bearing between the current position and a waypoint. Hint: Use the math inverse tangent (atan) function, but the atan2 function may be slightly easier to work with.

Step-by-Step Solution

Request Professional Solution

Request Solution!

We need at least 10 more requests to produce the solution.

0 / 10 have requested this problem solution

The more requests, the faster the answer.

Request! (Login Required)


All students who have requested the solution will be notified once they are available.
Add your Solution
Textbook Solutions and Answers Search
Solutions For Problems in Chapter 11
ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT