Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Use: GO LANG Implement ADT for coordinates on earth A coordinate is composed of a latitude, longitude pair. Make sure that the constructors are variadic,
Use: GO LANG
Implement ADT for coordinates on earth
A coordinate is composed of a latitude, longitude pair.
Make sure that the constructors are variadic, allowing for variable precision, for example: degrees and minutes; or degrees, degrees only, or degrees, minutes and seconds. REQUIRE A COMPASS DIRECTION
Latitude is an angular distance north or south from the Earth's equator measured from degrees to degrees. Each degree is divided into minutes and each minute is divided into seconds. For example, the latitude for the USA is which means the USA is degrees, minutes and seconds of arc north of the equator.
Longitude is an angular distance east or west from the Earth's prime meridian measured from degrees to degrees. Each degree of longitude is divided into minutes, and each minute is further divided into seconds. For example, the longitude of the USA is which means the USA is degrees, minutes and seconds of arc west of the meridian.
The ADT should be able to input, output, compare and handle the coordinates in an appropriate manner.
Consider these errors:
Invalid Input Values:
When creating a new coordinate, validate input values such as degrees, minutes, and seconds. For example, latitude should be between and degrees, and longitude should be between and degrees.
Check if the provided direction is valid example or for latitude, or for longitude
Coordinate Operations:
When performing operations that involve combining or modifying coordinates, check if the resulting values remain within the valid range eg latitude between and degrees, longitude between and degrees
Coordinate Reduction:
Include a Reduce member function to reduce coordinates normalizing minutes and secondsl Make sure that its resulting values are valid.
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started