Question: Define the Wednesday class's GetWeather() accessor that gets data member weather and the GetHumidity() accessor that gets data member humidity. Ex: If the input is
Define the Wednesday class's GetWeather() accessor that gets data member weather and the GetHumidity() accessor that gets data member humidity.
Ex: If the input is sunny 62.0, then the output is:
Wednesday: sunny Humidity: 62.0%
#include
class Wednesday { public: void SetWeather(string wednesdayWeather); void SetHumidity(double wednesdayHumidity); string GetWeather() const; double GetHumidity() const; private: string weather; double humidity; };
void Wednesday::SetWeather(string wednesdayWeather) { weather = wednesdayWeather; }
void Wednesday::SetHumidity(double wednesdayHumidity) { humidity = wednesdayHumidity; }
/* Your code goes here */
int main() { Wednesday weather; string inputWeather; double inputHumidity;
cin >> inputWeather; cin >> inputHumidity; weather.SetWeather(inputWeather); weather.SetHumidity(inputHumidity);
cout << "Wednesday: " << weather.GetWeather() << endl; cout << "Humidity: " << fixed << setprecision(1) << weather.GetHumidity() << "%" << endl;
return 0; }
c++ and please please make it correct
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
