Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

Worth 3 Points Write the definition of a public class WeatherForecast that provi

ID: 3910805 • Letter: W

Question

Worth 3 Points Write the definition of a public class WeatherForecast that provides the following behavior (methods) A method called setSkies that has one parameter, a string o A method called setHigh that has one parameter, an int A method called setLow that has one parameter, an int. o A method called getSkies that has no parameters and that returns the value that was last used as an argument in setSkies that was last used as an argument in setHigh was last used as an argument in setLow o A method called getHigh that has no parameters and that returns the value o A method called getLow that has no parameters and that returns the value that No constructor need be defined. Be sure to define instance variables as needed by your "getter"/"setter" methods-initialize all numeric variables to 0 and any String variables to the empty string 1

Explanation / Answer

Hi,

The following are the class definitions for the 3 questions.

If you need any changes or have queries, leave me a comment.

If this answer helps you, please upvote it.

//File: WeatherForecast.java



public class WeatherForecast {
//Instance variables initialized to default values
private String skies = "";
private int high = 0;
private int low = 0;
//Getters and Setters
public void setSkies(String value) {
skies = value;
}
public void setHigh(int value) {
high = value;
}
public void setLow(int value) {
low = value;
}
public String getSkies() {
return skies;
}
public int getHigh() {
return high;
}
public int getLow() {
return low;
}
}

//File: Player.java



public class Player {
//Instance variables initialized to default values
private String name = "";
private int score = 0;
//Getters and Setters
public void setName(String value) {
name = value;
}
public void setScore(int value) {
score = value;
}
public String getName() {
return name;
}
public int getScore() {
return score;
}
}

//File: ContestResult.java


public class ContestResult {
//Instance variables initialized to default values
private String winner = "";
private String secondPlace = "";
private String thirdPlace = "";
//Getters and Setters
public void setWinner(String value) {
winner = value;
}
public void setSecondPlace(String value) {
secondPlace = value;
}
public void setThirdPlace(String value) {
thirdPlace = value;
}
public String getWinner() {
return winner;
}
public String getSecondPlace() {
return secondPlace;
}
public String getThirdPlace() {
return thirdPlace;
}
}

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote