The water in the kettle starts at 20 degrees. Each heat(deg) warms it by deg, but it never goes above 100: once it boils, it boils. Fill in heat.
kettle_temp({30, 25})→75kettle_temp({})→20int kettle_temp(const vector<int> &heats)#include <vector>
using namespace std;
class Kettle {
public:
int temp;
Kettle() {
temp = 20;
}
void heat(int deg) {
// your code here: heat it up, but not past 100
}
};
int kettle_temp(const vector<int> &heats) {
Kettle k;
for (int d : heats) {
k.heat(d);
}
return k.temp;
}
Run tries the examples. When they look right, Submit.