Question: in c++, only solution code pls thank you The SetWeather() mutator sets data member weather to saturdayWeather and the SetTemperature() mutator sets data member temperature
in c++, only solution code pls thank you
The SetWeather() mutator sets data member weather to saturdayWeather and the SetTemperature() mutator sets data member temperature to saturdayTemperature. In main(), call SetWeather() and SetTemperature(), passing arguments inputWeather and inputTemperature, respectively.
Ex: If the input is overcast 60.5, then the output is:
Today's weather is overcast and the temperature is 60.5 degrees Celsius #include #include #include using namespace std; class Saturday { public: void SetWeather(string saturdayWeather); void SetTemperature(double saturdayTemperature); string GetWeather() const; double GetTemperature() const; void Print() const; private: string weather; double temperature; }; void Saturday::SetWeather(string saturdayWeather) { weather = saturdayWeather; } void Saturday::SetTemperature(double saturdayTemperature) { temperature = saturdayTemperature; } string Saturday::GetWeather() const { return weather; } double Saturday::GetTemperature() const { return temperature; } int main() { Saturday weather; string inputWeather; double inputTemperature; cin >> inputWeather; cin >> inputTemperature; /* Your code goes here */ cout << "Today's weather is " << weather.GetWeather(); cout << " and the temperature is " << fixed << setprecision(1) << weather.GetTemperature() << " degrees Celsius" << endl; return 0; } Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
