The flower shop puts a little card in every pot saying how often to water it. The Plant constructor gets a name n and a number of days d. Fill in the constructor: store them in this plant's name and days. card() is already written.
plant_card("Fern", 3)→'Fern: water every 3 days'plant_card("Cactus", 14)→'Cactus: water every 14 days'string plant_card(string name, int days)#include <string>
using namespace std;
class Plant {
public:
string name;
int days;
Plant(string n, int d) {
name = "?";
days = 0;
// your code here: store n and d in name and days (you can replace the two lines above)
}
string card() const {
return name + ": water every " + to_string(days) + " days";
}
};
string plant_card(string name, int days) {
Plant p(name, days);
return p.card();
}
Run tries the examples. When they look right, Submit.