Answered step by step
Verified Expert Solution
Question
1 Approved Answer
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
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started