Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

#ifndef BAKERCHRISTOPHER_H #define BAKERCHRISTOPHER_H #include <string> using na

ID: 3649146 • Letter: #

Question

#ifndef BAKERCHRISTOPHER_H
#define BAKERCHRISTOPHER_H


#include <string>
using namespace std;

class ResistorClass
{
private:
double nominalResistance;
double tolerance;
string name;

public:
// 0-argument Constructor
ResistorClass::ResistorClass();
{

double nominalResistance = 0;
double tolerance = 0;
string name = "No Resistor";

}
// Parameterized Constructor
ResistorClass::ResistorClass(double initialValue, double initialPercent, string initialName)
{
nominalResistance = initialValue;
tolerance = initialPercent;
name = initialName;

}


// Public methods to change values of data members (mutators)
void setnominalResistance(double newnominalResistance);
void settolerance(double newtolerance);
void setname(string newname);

double maximumR( );
double minimumR( );

double getnominalResistance( ) const;
double gettolerance( ) const;
string getname( ) const;
void displaynominalResistance( );
void displaytolerance( );
void displayname( );
};

#endif



error C2059: syntax error : '{'
error C2334: unexpected token(s) preceding '{'; skipping apparent function body


Explanation / Answer

//first of all, if you are defining class functions inside the class declarations, you do not need to do classname::classfunction public: // 0-argument Constructor ResistorClass::ResistorClass(); // You need to remove this ; { //since you are defining the function here //instead of making a prototype double nominalResistance = 0; double tolerance = 0; string name = "No Resistor"; }