Answered step by step
Verified Expert Solution
Link Copied!

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 0 degrees to 90 degrees. Each degree is divided into 60 minutes and each minute is divided into 60 seconds. For example, the latitude for the USA is 4043'50.1960'N which means the USA is 40 degrees, 43 minutes and 50 seconds of arc north of the equator.
Longitude is an angular distance east or west from the Earth's prime meridian measured from 0 degrees to 180 degrees. Each degree of longitude is divided into 60 minutes, and each minute is further divided into 60 seconds. For example, the longitude of the USA is 7356'6.8712'W, which means the USA is 73 degrees, 56 minutes and 6.8 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 -90 and +90 degrees, and longitude should be between -180 and +180 degrees.
Check if the provided direction is valid (example,"N" or "S" for latitude, "E" or "W" for longitude).
Coordinate Operations:
When performing operations that involve combining or modifying coordinates, check if the resulting values remain within the valid range (e.g., latitude between -90 and +90 degrees, longitude between -180 and +180 degrees).
Coordinate Reduction:
Include a Reduce() member function to reduce coordinates (normalizing minutes and seconds)l. Make sure that its resulting values are valid.
image text in transcribed

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Students also viewed these Databases questions

Question

Provide examples of KPIs in Human Capital Management.

Answered: 1 week ago

Question

What are OLAP Cubes?

Answered: 1 week ago