I have a problem on line 29 //On GLasses.cpp #include "Glasses.h" Glasses::Glasses() { color = "unknonw"; prescription = 0.0f; } Glasses::Glasses(string color, float prescription) { setColor(color);...


I have a problem on line 29


//On GLasses.cpp
#include "Glasses.h"



Glasses::Glasses()
{
color = "unknonw";
prescription = 0.0f;




}


Glasses::Glasses(string color, float prescription)
{
setColor(color);
setPrescription(prescription);
}
Glasses::~Glasses(void) {


}


// behaviors
string Glasses::toString(void)
{
string strPrescription = to_string(prescription);
strPrescription = strPrescription.substr(0, 4);


return "Color: " + (color) + ", Prescription: " + (prescription);
}


// accessors and mutators
string Glasses::getColor(void)
{
return color;
}
void Glasses::setColor(string color)
{
if (color.length() > 0)
this -> color = color;
else
this->color = "unknown";
}


float Glasses::getPrescription(void)
{
return prescription;
}
void Glasses::setPrescription(float prescription)
{
if (prescription > 0.0f)
this->prescription = prescription;


else
this->prescription = 0.0f;
}



Jun 08, 2022
SOLUTION.PDF

Get Answer To This Question

Related Questions & Answers

More Questions »

Submit New Assignment

Copy and Paste Your Assignment Here