Class DMSConverter

Object
DMSConverter
All Implemented Interfaces:
Converter

public class DMSConverter extends Object implements Converter
This class converts DMSCoordinate objects to DecimalCoordinate objects. This class should be constructed with a DMSCoordinate object. Once that object is set, convert() can be called to convert the DMSObj to a DecimalCoordinate object and set it appropriately.
  • Field Details

    • DMSObj

      The DMSCoordinate object to be converted.
    • convertedObj

      DecimalCoordinate convertedObj
      Once convert() is called, this convertedObj is set to the correct DecimalCoordinate.
  • Constructor Details

    • DMSConverter

      public DMSConverter()
      Default constructor to assign DMSObj to 0.
    • DMSConverter

      public DMSConverter(DMSCoordinate DMSObj)
      Overloaded constructor that takes in a pre-existing DMSCoordinate object and sets DMSObj equal to it.
      Parameters:
      DMSObj - DMSCoordinate object with values already set.
  • Method Details

    • getConvertedObj

      public DecimalCoordinate getConvertedObj()
      Returns convertedObj.
    • convert

      public void convert()
      Implements the convert() method from the Converter interface. Should take the DMSObj and convert that to a DecimalCoordinate, once converted, set convertedObj to the new DecimalCoordinate. Remember all of the useful getters included with the DMSCoordinate class.

      When creating and setting the convertedObj, I would recommend to use the DecimalCoordinate(double, double) constructor. A helpful graphic of the formula in action is in the GitHub README, and a link to an explanation is available in the README.

      Specified by:
      convert in interface Converter