Question: #include #include using namespace std; class Restaurant { private : string name; string address; string genre; int numOfRatings; double rating; static int numRestaurants; public :

#include  #include  using namespace std; class Restaurant { private: string name; string address; string genre; int numOfRatings; double rating; static int numRestaurants; public: Restaurant() { name = ""; address = ""; genre = ""; numOfRatings = 0; rating = 0.0; numRestaurants++; } Restaurant(string name, string address, string genre) : name(name), address(address), genre(genre) { numRestaurants++; } ~Restaurant() { numRestaurants--; } 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; } int getNumberOfRestaurants() { return numOfRatings; } 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 << "Number of Restaurants: " << numRestaurants << endl; cout << "----------------------------------------" << endl; } }; int Restaurant::numRestaurants = 0; 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 "Restauraunt" I want to create a new subclass called FoodTruck. Looking to include these functions

(// Comments are greatly appreciated as I frequently look back at the program for reference)

1: A private string called currentLocation that holds the current location of the food truck.

2: A private string called nextLocation that holds the next location the food truck will be at.

3: A private string called nextTime that holds the time the food truck will be at its next location.

4: A public function called schedule( ) that takes two string arguments and sets the nextLocation and nextTime fields.

5: A public function called arrive( ) that sets the currentLocation to the value of the nextLocation and then sets both the nextLocation and nextTime to the empty string.

6: Override the display( ) function from the Restaurant class to display all of the normal information for a restaurant, but also all of the location information for a food truck.

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!