Fill This Form To Receive Instant Help

Help in Homework
trustpilot ratings
google ratings


Homework answers / question archive / Write a class for storing a GPS coordinate, latitude and longitude

Write a class for storing a GPS coordinate, latitude and longitude

Computer Science

Write a class for storing a GPS coordinate, latitude and longitude. Longitude lines are perpendicular to and latitude lines are parallel to the Equator. The latitude of a point on Earth's surface is the angle between the equatorial plane and the straight line that passes through that point and through (or close to) the center of the Earth. The longitude of a point on Earth's surface is the angle east or west of a reference meridian to another meridian that passes through that point.

<a title="Unknown author, Public domain, via Wikimedia Commons" href="https://commons.wikimedia.org/wiki/File:FedStats_Lat_long.svg"><img width="400" alt="FedStats Lat long" src="https://upload.wikimedia.org/wikipedia/commons/thumb/e/ef/FedStats_Lationg.svg/ 360px-FedStats_Lat jong.svg.png"></a>

Details

• Define a class GPS that will store latitude and longitude coordinates  

  • Latitude angle value can only be in range [0. 0, 90.0]  
  • Latitude direction value can only be either Compass: :N or Compass : : S  
  • Longitude angle value can only be in range [0. 0, 180.0]  
  • Longitude direction value can only be either Compass : : W or Compass :E

• Use the provided enum class Compas to specify a coordinate direction

• The class must have following data members

  • latitude for storing the latitude angle value, double type  
  • latitudeDirection for storing the latitude direction, compass type  
  • longitude for storing the longitude angle value, double type  
  • longitudeDirection for storing the longitude direction, Compass type  
  • All data members must have private access

• The class must contain following access or methods that allow read-only access to the encapsulated fields  

  • getLatitude returns the latitude angle, double type  
  • getLatitudeDirection returns the latitude direction, Compass type
  • getLongitude returns the longitude angle, double type
  • gethetitude returns the longitude direction Compass type

Purchase A New Answer

Custom new solution created by our subject matter experts

GET A QUOTE