Explore BrainMass

C++: Write a Class Coord that Includes Degrees

This content was STOLEN from BrainMass.com - View the original, and get the already-completed solution here!

In ocean navigation, locations are measured in degrees and minutes of latitude and longitude. For example, 149 degrees 34.8 minutes west longitude, and 17 degrees 31.5 minutes south latitude, to be written as 149°34.8' W, 17°31.5' S. There are 60 minutes in a degree. Longitudes are measured from 0 to 180 degrees, east or west from Greenwich, England. Latitude is measured from 0 to 90 degrees, north or south from the equator to the poles.

Write a class Coord that includes the members: degrees (int), minutes (float), and the direction character (N, S, E, or W) to represent both latitude and longitude (altogether 6 members). The class must have a constructor accepting 6 parameters and a toString() method that returns a string representation of the coordinate as a C++ string (not C string).

The main () program must allow the user to enter the coordinates one-by-one, create the Coord object, and apply its toString() method for displaying. You can use hex character constant 'xB0' for printing the degree symbol (°).

© BrainMass Inc. brainmass.com October 25, 2018, 12:47 am ad1c9bdddf

Solution Preview

Please see the attachment.

// Navigation.cpp

#include <iostream>
#include <sstream>
#include <string>
using namespace std;

class Coord {
int longtitude_degree;
float longtitude_minute;
char longtitude_direction;
int latitude_degree;
float latitude_minute;
char latitude_direction;
Coord(int, float, char, int, float, char); // Constructor to accept 6 parameters
string toString(); // method for ...

Solution Summary

The solution writes a class Coord that includes degrees and minutes of latitudes and longitudes.

See Also This Related BrainMass Solution

Detail the following career choice - computer engineering

Please assist so that I can write this assignment:

Write a research project detailing one of the following career choice:
o Computer engineer (software or hardware)

Your research should provide insight into this career field for a population of high school
seniors. Your research will potentially be published in an online careers magazine.

Ensure your research includes the following elements:
o A short proposal that includes:
· What you are proposing to write about
· Your background and how it has led you to pursue this type of career
· The specific elements of the career you will focus on in your final project (This
may include salary, job requirements, physical labor, and other characteristics of
the job.)
· The benefits of having this job
· Anything you hope to learn more about through your research
o An abstract (See Ch. 15.)
o The Microsoft® Visio or ConceptDraw? diagram (even if it is hypothetical)

View Full Posting Details