Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

The SetGreeting() mutator sets data member greeting to Hello, this is , followed by voicemailGreeting, and the SetAreaCode() mutator sets data member areaCode to voicemailAreaCode.

The SetGreeting() mutator sets data member greeting to "Hello, this is ", followed by voicemailGreeting, and the SetAreaCode() mutator sets data member areaCode to voicemailAreaCode. In main(), call SetGreeting() and SetAreaCode(), passing arguments inputGreeting and inputAreaCode, respectively. Ex: If the input is Dan 463, then the output is: Voicemail: Hello, this is Dan at area code 463

#include #include #include using namespace std; class Voicemail { public: void SetGreeting(string voicemailGreeting); void SetAreaCode(int voicemailAreaCode); string GetGreeting() const; int GetAreaCode() const; void Print() const; private: string greeting; int areaCode; }; void Voicemail::SetGreeting(string voicemailGreeting) { greeting = "Hello, this is " + voicemailGreeting; } void Voicemail::SetAreaCode(int voicemailAreaCode) { areaCode = voicemailAreaCode; } string Voicemail::GetGreeting() const { return greeting; } int Voicemail::GetAreaCode() const { return areaCode; } int main() { Voicemail voicemail; string inputGreeting; int inputAreaCode; cin >> inputGreeting; cin >> inputAreaCode; cout << "Voicemail: " << voicemail.GetGreeting(); cout << " at area code " << voicemail.GetAreaCode() << endl; return 0;

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image_2

Step: 3

blur-text-image_3

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Real Time Database And Information Systems Research Advances

Authors: Azer Bestavros ,Victor Fay-Wolfe

1st Edition

1461377803, 978-1461377801

More Books

Students also viewed these Databases questions

Question

What must a creditor do to become a secured party?

Answered: 1 week ago

Question

When should the last word in a title be capitalized?

Answered: 1 week ago