Question
Use Speaker Class that prints an error of name InvalidSpeakerNumber if the number of identification is not within the range 0 to 999. Implement a
Use Speaker Class that prints an error of name InvalidSpeakerNumber if the number of identification is not within the range 0 to 999. Implement a main program that shows that the exception class condition it works.
#include
template
class Speaker
{
private:
string name;
string phone;
string topic;
string fee;
string idnum;
public:
//**************************************Constructor**************************************
Speaker();
Speaker(string aName, string aPhone, string aTopic, string aFee, string anIDnum);
~Speaker();
//**************************************Setters******************************************
void setName(string aName);
void setPhone(string aPhone);
void setTopic(string aTopic);
void setFee(string aFee);
void setIDnum(string anIDnum);
//**************************************Getters******************************************
string getName() const;
string getPhone() const;
string getTopic() const;
string getFee() const;
string getID() const;
};
//Cpp
template
Speaker
topic("No Topic"), fee("0.0"), idnum("0")
{
}// end default constructor
template
Speaker
{
setName(aName);
setPhone(aPhone);
setTopic(aTopic);
setFee(afee);
setIDnum(anIDnum);
}
template
void Speaker
{
name = aName;
}
template
string Speaker
return name;
}
template
void Speaker
phone = aPhone;
}
template
string Speaker
return phone;
}
template
void Speaker
topic = aTopic;
}
template
string Speaker
return topic;
}
template
void Speaker
fee = aFee;
}
template
string Speaker
return fee;
}
template
void Speaker
idnum = anIDnum;
}
template
string Speaker
return idnum;
}
#endif
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started