Question: C++ Define the Restaurant class's GetName() accessor that gets data member name and the GetEmployees() accessor that gets data member employees. Ex: If the input

C++

Define the Restaurant class's GetName() accessor that gets data member name and the GetEmployees() accessor that gets data member employees.

Ex: If the input is Jen 15, then the output is:

Restaurant: Jen's Delicatessen Total: 15 employees

#include #include #include using namespace std;

class Restaurant { public: void SetName(string restaurantName); void SetEmployees(int restaurantEmployees); string GetName() const; int GetEmployees() const; private: string name; int employees; };

void Restaurant::SetName(string restaurantName) { name = restaurantName + "'s Delicatessen"; }

void Restaurant::SetEmployees(int restaurantEmployees) { employees = restaurantEmployees; }

/* Your code goes here */

int main() { Restaurant restaurant; string inputName; int inputEmployees;

cin >> inputName; cin >> inputEmployees; restaurant.SetName(inputName); restaurant.SetEmployees(inputEmployees);

cout << "Restaurant: " << restaurant.GetName() << endl; cout << "Total: " << restaurant.GetEmployees() << " employees" << endl;

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!