28.1k views
5 votes
define the yesterday class's setweather() mutator that sets data member weather to yesterdayweather and the sethumidity() mutator that sets data member humidity to yesterdayhumidity.

User Antonina
by
7.9k points

1 Answer

1 vote

Final answer:

The question asks to define mutator methods for a class that set the weather and humidity data members based on yesterday's values.

Step-by-step explanation:

The question is related to programming and involves defining mutator methods for a class. The mutator methods, setWeather() and setHumidity(), are responsible for setting the values of the data members weather and humidity respectively. These mutator methods should be implemented in a class that has these data members. Here is an example of how these methods can be defined in a class:

class MyClass {
private int weather;
private int humidity;

public void setWeather(int yesterdayWeather) {
weather = yesterdayWeather;
}

public void setHumidity(int yesterdayHumidity) {
humidity = yesterdayHumidity;
}
}

In the example above, the setWeather() method takes an integer parameter yesterdayWeather and sets the value of the weather data member to this parameter. Similarly, the setHumidity() method takes an integer parameter yesterdayHumidity and sets the value of the humidity data member to this parameter.

User Barani R
by
7.9k points