Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Yes I always do give a thumbs up. Thanks! (constructors) testAngle.cpp and Angle.h Purpose To create an angle class that can be used for next

Yes I always do give a thumbs up. Thanks!

(constructors)

testAngle.cpp and Angle.h

Purpose

To create an angle class that can be used for next assignment for distance class.

In ocean navigation, locations are measured in DMS (Degrees, Minutes and Seconds) of latitude and longitude coordinates. Thus if youre lying off the mouth of Papeete Harbor in Tahiti, your location is (17 32' 12.498" S, 149 34' 54.717" W). The Google map shows this location as (-17.5368054, -149.5818668) in GPS coordinates.

In the DMS coordinates, there are 60 minutes in a degree, and 60 seconds in a minute (a modern approach is to use decimal minutes instead.) Longitude is measured from 0 to 180 degrees, east or west from Greenwich, England, to the international dateline in the Pacific. Latitude is measured from 0 to 90 degrees, north or south from the equator to the poles. Instead of the N, S, E, or W, the GPS coordinates uses positiveegative number: positive numbers for east and north (where the population are), and negative numbers for west and south.

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)

Test Run Result: 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  

Submit:

  1. testAngle.cpp, Angle.h
  2. Validation Test run result
C:\Users\tony\Downloads\v\Weekoz\degree.exe - Enter GPS-style Coordinates: Lattitude (+/- 8-98.80): 23.4 Longitude (+/- 8-188.00):45.6 Converted from GPS to DMS. 23.4, 45.6 is: 23 23' 60' N. 45 35' 59.99' E execution tine : 11.581 S rocess returned @ (@x@> ress any key to continue. C:\Users\tony\Downloads\v\Weekoz\degree.exe - Enter GPS-style Coordinates: Lattitude (+/- 8-98.80): 23.4 Longitude (+/- 8-188.00):45.6 Converted from GPS to DMS. 23.4, 45.6 is: 23 23' 60' N. 45 35' 59.99' E execution tine : 11.581 S rocess returned @ (@x@> ress any key to continue

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

The Lean Accounting Guidebook

Authors: Steven M. Bragg

1st Edition

1938910028, 9781938910029

Students also viewed these Databases questions

Question

3. Maximize (the agreement function).

Answered: 1 week ago