Latitude and longitude are measured in degrees, minutes and seconds. As with time measurements, there are 60 seconds to a minute, and 60 minutes to a degree. Many GIS (Geographical Information System) programs express latitude and longitude in degrees only, with the minutes and seconds converted to fractional degrees. For example,
Latitude 40°15'30" can also be expressed as Latitude 40.25833333333333Implement a method
decimalDegreesto carry out this conversion. Note that degrees may be negative. Use the
abswhen computing the decimal degrees. Use the
signumas a multiplier so that the decimal degrees have the same sign as the degrees.