Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

// Please follow the instructions and solve it by C++. (Mac) Thank you. Don't give different answer please. Submit: testAngle.cpp, Angle.h Validation Test run result

// Please follow the instructions and solve it by C++. (Mac) Thank you. Don't give different answer please.

Submit:

  1. testAngle.cpp, Angle.h
  2. Validation Test run result

Implementation

  • Create a class angle that includes four member variables: an int for degrees, an int for minutes, and a float for seconds, and a char for the direction letter (N or S of equator, E, or W of Greenwich). This class angle can hold DMS coordinate for either a latitude variable or a longitude variable.
  • Write a default constructor to default value as 0 0' 0" N (not utilized by main).
  • Write an optional four-argument constructor for the DMS coordinate.
  • Write a constructor to take in digital_degree (GPS). Option 1: a TWO-argument constructor for the (double GPS coordinate, longitude/latitude), where the GPS coordinate is a floating number, and the boolean to represent either longitude or latitude is inputed. This TWO-argument constructor shall convert the digital-degree GPS to DMS and initialize the private data of the angle class. Option 2: just write a ONE-argument constructor for GPS coordinate!
  • A main() program is provided below to
  1. prompt for the user's favorite location in the GPS format, e.g. DVC, the Eiffel tower, and the Great Pyramid at Giza... etc.
  2. convert a GPS location to a DMS location,
  3. construct a DMS angle class instances: longitude and latitude with the location value,
  4. retrieve the longitude and latitude instances' values and display on the screen. If you like to make it pretty, you can use the hex character constant \xF8, which usually prints a degree () symbol.
  • Each location coordinate shall contains one latitude angle and one longitude angle in either DMS or GPS format.
  • If you have implemented some of the optional constructors, you will need to modify the test driver main() function accordingly.

Angle Coordinate Tools http://latitude.to (Links to an external site.)

GPS (Decimal Degrees) = Degrees + minutes/60 + seconds/3600 And to convert GPS to DMS coordinates, here is how:
  • The whole units of degrees will remain the same (i.e. in 121.135 longitude, start with 121.) There are many ways to split the whole number and fraction part of a number. One of the easiest method is to use modf function (Links to an external site.) of cmath header.
  • Multiply the decimal by 60 (i.e. .135 * 60 = 8.1).
  • The whole number becomes the minutes (8').
  • Take the remaining decimal and multiply by 60. (i.e. .1 * 60 = 6).
  • The resulting number becomes the seconds (6'). Seconds can remain as a decimal.
  • Take your three sets of numbers and put them together, using the symbols for degrees (), minutes (), and seconds (') (i.e. 1218'6' longitude)

Sample Test Run

image text in transcribed

Starter Kit: The Angle.h (in Github), a class declaration is provided to jump start your development.

Source file for test application:

int main() { double lat, lon; Angle latA, lonA; cout > lat; cout > lon; // The following code are supposed change to a constructor that use GPS angle values // However to simplify this assignment, we skip that step. // It would be a good challenge to create a constructor of such, instead of using the code below. latA = convertGPS(lat, 0); lonA = convertGPS(lon, 1); cout > lat; Angle latC(lat, 0); cout > lon; Angle lonC(lon, 1); cout  

input Enter GPS-style coordinates: Latitude: (+/- 0-90.00): 23.4 Longitude: (+/- 0-180.00): 45.6 DMS: (23 23' 60.0000" N, 45 36' 0.0000" E) Enter GPS-style coordinates: Latitude: (+/- 0-90.00): input Enter GPS-style coordinates: Latitude: (+/- 0-90.00): 23.4 Longitude: (+/- 0-180.00): 45.6 DMS: (23 23' 60.0000" N, 45 36' 0.0000" E) Enter GPS-style coordinates: Latitude: (+/- 0-90.00)

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

Recommended Textbook for

Databases Illuminated

Authors: Catherine M. Ricardo, Susan D. Urban, Karen C. Davis

4th Edition

1284231585, 978-1284231588

More Books

Students also viewed these Databases questions

Question

=+6. What five driving forces make CSR more relevant today?

Answered: 1 week ago

Question

=+4 Develop and deliver the CCT program.

Answered: 1 week ago