Question: C++ Mutators, accessors, and private helpers. Define the Eatery class's SetName() mutator that sets data member name to eateryName, followed by 's Deli, and the

C++

Mutators, accessors, and private helpers.

Define the Eatery class's SetName() mutator that sets data member name to eateryName, followed by "'s Deli", and the SetCity() mutator that sets data member city to eateryCity.

Ex: If the input is:

Mel Hartford

then the output is:

Eatery: Mel's Deli City: Hartford

#include #include #include using namespace std;

class Eatery { public: void SetName(string eateryName); void SetCity(string eateryCity); void Print() const; private: string name; string city; };

/* Your code goes here */

void Eatery::Print() const { cout << "Eatery: " << name << endl; cout << "City: " << city << endl; }

int main() { Eatery restaurant; string inputName; string inputCity;

cin >> inputName; cin >> inputCity; restaurant.SetName(inputName); restaurant.SetCity(inputCity);

restaurant.Print();

return 0; }

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!