Question: In the class definition, initialize the data members, integer rating, string state, and integer numEmployees, with the default values 0, Unspecified, and 0, respectively. Ex:
In the class definition, initialize the data members, integer rating, string state, and integer numEmployees, with the default values 0, "Unspecified", and 0, respectively.
Ex: If the input is 5 OH 17, then the output is:
Rating: 0, State: Unspecified, Number of employees: 0 Rating: 5, State: OH, Number of employees: 17
Note: The class's print function is called first after the default constructor, then again after the inputs are passed to the setters.
#include
class Eatery { public: void SetRating(int eateryRating); void SetState(string eateryState); void SetNumEmployees(int eateryNumEmployees); void Print();
private:
/* Your code goes here */
};
void Eatery::SetRating(int eateryRating) { rating = eateryRating; }
void Eatery::SetState(string eateryState) { state = eateryState; }
void Eatery::SetNumEmployees(int eateryNumEmployees) { numEmployees = eateryNumEmployees; }
void Eatery::Print() { cout << "Rating: " << rating << ", State: " << state << ", Number of employees: " << numEmployees << endl; }
int main() { int newRating; string newState; int newNumEmployees; Eatery eatery1;
eatery1.Print();
cin >> newRating; cin >> newState; cin >> newNumEmployees;
eatery1.SetRating(newRating); eatery1.SetState(newState); eatery1.SetNumEmployees(newNumEmployees);
eatery1.Print();
return 0; }
c++ and please please make it correct
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
