• Register
Welcome to Kodlogs, programming questions and answer website.
0 votes
53 views

Problem:

I have receive this as my assignment which needs to be sorted out quickly, please help?

write the definition of a class weatherforecast that provides the following behavior (methods):

A method called set_skies that has one parameter, a String.

A method called set_high that has one parameter, an int.

A method called set_low that has one parameter, an int.

A method called get_skies that has no parameters and that returns the value that was last used as an argument in set_skies .

A method called get_high that has no parameters and that returns the value that was last used as an argument in set_high .

A method called get_low that has no parameters and that returns the value that was last used as an argument in set_low 

No constructor need be defined. Be sure to define instance variables as needed by your “get”/”set” methods — initialize all numeric variables to 0 and any String variables to the empty string .

Some one please give me the code in Python please?

by (1.6k points)  
edited by

1 Answer

0 votes

Solution:

public class WeatherForecast 

private String skies = ""; private int high; private int low;

public void setSkies(String skies) {

this.skies = skies;

}

public void setHigh(int high) {

this.high = high;

}

public void setLow(int low) {

this.low = low;

}

public String getSkies() {

return skies;

}

public int getHigh() {

return high;

}

public int getLow() {

return low;

}

}`

by (5.3k points)  
...