Question: #include #include using namespace std; class Restaurant { private : string name; string address; string genre; int numOfRatings; double rating; public : Restaurant() { name=;
#include#include using namespace std; class Restaurant { private: string name; string address; string genre; int numOfRatings; double rating; public: Restaurant() { name=""; address=""; genre=""; numOfRatings=0; rating=0.0; } string getName() { return name; } string getAddress() { return address; } string getGenre() { return genre; } void setName(string newName) { name=newName; } void setAddress(string newLocation) { address=newLocation; } void setGenre(string newGenre) { genre=newGenre; } void rate(int newRating) { rating=((getRating()*numOfRatings)+newRating)/(numOfRatings+1); numOfRatings+=1; } double getRating() { return rating; } void display() { cout << " ----------------------------------------" << endl; cout << "Restaurant Name: " << name << endl; cout << "Address: " << address << endl; cout << "Genre: " << genre << endl; cout << "Rating: " << rating << endl; cout << "Number of Ratings: " << numOfRatings << endl; cout << "----------------------------------------" << endl; }}; int main() { Restaurant r; r.setName("Loving Hut"); r.setAddress("1495 N Van Ness Ave, Fresno, CA 93728"); r.setGenre("Vegan Restaurant"); r.rate(3); r.rate(7); r.rate(5); r.rate(8); r.display(); return 0; }
Here is my class called Restaurant I need to implement these features into the code (It would be helpful if you could // your comments)
1: Create a static member variable that holds the number of Restaurant profiles that have been added into the system. (i.e. The number of instances of the class Restaurant that have been created.)
2: Create a static member function to return the number of Restaurant profiles in the system.
3: Implement a Destructor to remove a Restaurant from the current number of Restaurants in the system.
4: Implement a Custom Constructor that takes three strings and initializes the name, genre, and address of a Restaurant. The Constructor should also increment the Restaurant count.
5: Override the Default Constructor (the one with no parameters) to increment the Restaurant count as well as initializing all fields to zero or the empty string.
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
