C++ Program Assignment | Homework For You |

  • by

C++ Program Assignment | Homework For You |

Hello, I just need a quick fix for my C++ program. For the minutes it needs to display 60 instead of 60.00. This error is highlighted in the output screenshot. Thanks.
Angle.h
#pragma once#include <cmath>#include <iostream>#include <sstream>
using namespace std;
class Angle{private:int degrees, minutes;float seconds;char direct;public:
Angle(){degrees = 0;minutes = 0;seconds = 0;direct = ‘N’;}//*******************************************//Lat = 0; Lon = 1;//*******************************************Angle(float gpsVal, bool longitude){degrees = fabs(gpsVal);minutes = ((fabs(gpsVal) – degrees) * 60);seconds = (((fabs(gpsVal) – degrees) * 60) – minutes) * 60;
direct = (!longitude) ? ((fabs(gpsVal) == gpsVal) ? ‘N’ : ‘S’) : ((fabs(gpsVal) == gpsVal) ? ‘E’ : ‘W’);
}
Angle(int d, int m, float s, char di){degrees = d;minutes = m;seconds = s;direct = di;}
void setDegrees(int);void setMinutes(int);void setSeconds(float s);void setDirection(char d);
int getDegrees();int getMinutes();double getSeconds();char getDirection();
void print();string toString();
};
testAngle.cpp
#include “Angle.h”
#include <iomanip>
using namespace std;
void Angle::setDegrees(int d)
{
degrees = d;
}
void Angle::setMinutes(int m)
{
minutes = m;
}
void Angle::setSeconds(float s)
{
seconds = s;
}
void Angle::setDirection(char d)
{
direct = d;
}
int Angle::getDegrees()
{
return degrees;
}
int Angle::getMinutes()
{
return minutes;
}
double Angle::getSeconds()
{
return seconds;
}
char Angle::getDirection()
{
return direct;
}
void Angle::print()
{
cout << degrees << “xF8 ” << fixed << setprecision(2) << minutes << “‘ ” << seconds << “” ” << direct;
}
string Angle::toString()
{
stringstream ss;
ss << degrees << “xF8 ” << minutes << “‘ ” << fixed << setprecision(2) << seconds << “” ” << direct;
return ss.str();
}
int main()
{double lat, lon;Angle latA, lonA;cout << “ntEnter GPS-style coordinates:”<< “nttLatitude: (+/- 0-90.00): “;cin >> lat;cout << “ttLongitude: (+/- 0-180.00): “;cin >> lon;
latA = Angle(lat, 0);lonA = Angle(lon, 1);
cout << “tDMS, (“;latA.print();cout << “, “;lonA.print();cout << “)n”;
// using GPS to DMS constructorcout << “ntEnter GPS-style coordinates:”<< “nttLatitude: (+/- 0-90.00): “;cin >> lat;Angle latC(lat, 0);
cout << “ttLongitude: (+/- 0-180.00): “;cin >> lon;Angle lonC(lon, 1);
cout << “tDMS: (“;latC.print();cout << “, “;//lonC.print();cout << lonC.toString();cout << “)n”;
return 0;
}Get Computer Science homework help today
TOP ACADEMIC WRITER
He has decades of experience in the education field and has served in the examination boards of some of the top Universities within & outside the United States America.

Related

C++ Program Assignment | Homework For You |

 

Homework Nerds have been helping students since 2006. Contact us today, and let us take care of all your academic needs. At Homework Nerds, we can take care of your academic needs. We can write your papers, do your presentations, learning team assignments, Labs, discussion questions and final exams. We also offer an entire week and entire class plans where we login to your classroom and take care of all class activities for you.

Homework Nerds: The #1 Most trusted academic services website.

CLICK HERE TO ORDER NOW – ORIGINAL CONTENT FROM SCRATCH 

OR 

.

 

C++ Program Assignment | Homework For You |

Hello, I just need a quick fix for my C++ program. For the minutes it needs to display 60 instead of 60.00. This error is highlighted in the output screenshot. Thanks.
Angle.h
#pragma once#include <cmath>#include <iostream>#include <sstream>
using namespace std;
class Angle{private:int degrees, minutes;float seconds;char direct;public:
Angle(){degrees = 0;minutes = 0;seconds = 0;direct = ‘N’;}//*******************************************//Lat = 0; Lon = 1;//*******************************************Angle(float gpsVal, bool longitude){degrees = fabs(gpsVal);minutes = ((fabs(gpsVal) – degrees) * 60);seconds = (((fabs(gpsVal) – degrees) * 60) – minutes) * 60;
direct = (!longitude) ? ((fabs(gpsVal) == gpsVal) ? ‘N’ : ‘S’) : ((fabs(gpsVal) == gpsVal) ? ‘E’ : ‘W’);
}
Angle(int d, int m, float s, char di){degrees = d;minutes = m;seconds = s;direct = di;}
void setDegrees(int);void setMinutes(int);void setSeconds(float s);void setDirection(char d);
int getDegrees();int getMinutes();double getSeconds();char getDirection();
void print();string toString();
};
testAngle.cpp
#include “Angle.h”
#include <iomanip>
using namespace std;
void Angle::setDegrees(int d)
{
degrees = d;
}
void Angle::setMinutes(int m)
{
minutes = m;
}
void Angle::setSeconds(float s)
{
seconds = s;
}
void Angle::setDirection(char d)
{
direct = d;
}
int Angle::getDegrees()
{
return degrees;
}
int Angle::getMinutes()
{
return minutes;
}
double Angle::getSeconds()
{
return seconds;
}
char Angle::getDirection()
{
return direct;
}
void Angle::print()
{
cout << degrees << “xF8 ” << fixed << setprecision(2) << minutes << “‘ ” << seconds << “” ” << direct;
}
string Angle::toString()
{
stringstream ss;
ss << degrees << “xF8 ” << minutes << “‘ ” << fixed << setprecision(2) << seconds << “” ” << direct;
return ss.str();
}
int main()
{double lat, lon;Angle latA, lonA;cout << “ntEnter GPS-style coordinates:”<< “nttLatitude: (+/- 0-90.00): “;cin >> lat;cout << “ttLongitude: (+/- 0-180.00): “;cin >> lon;
latA = Angle(lat, 0);lonA = Angle(lon, 1);
cout << “tDMS, (“;latA.print();cout << “, “;lonA.print();cout << “)n”;
// using GPS to DMS constructorcout << “ntEnter GPS-style coordinates:”<< “nttLatitude: (+/- 0-90.00): “;cin >> lat;Angle latC(lat, 0);
cout << “ttLongitude: (+/- 0-180.00): “;cin >> lon;Angle lonC(lon, 1);
cout << “tDMS: (“;latC.print();cout << “, “;//lonC.print();cout << lonC.toString();cout << “)n”;
return 0;
}Get Computer Science homework help today
TOP ACADEMIC WRITER
He has decades of experience in the education field and has served in the examination boards of some of the top Universities within & outside the United States America.

Related

C++ Program Assignment | Homework For You |