Write The Definition Of A Class Weatherforecast That Provides The Following Behavior (Methods ):

(Correct Answer Below)

Reveal the answer to this question whenever you are ready.

Write The Definition Of A Class Weatherforecast That Provides The Following Behavior (Methods ):

A method called setSkies that has one parameter , a String . A method called setHigh that has one parameter , an int . A method called setLow that has one parameter , an int . A method called getSkies that has no parameters and that returns the value that was last used as an argument in setSkies. A method called getHigh that has no parameters and that returns the value that was last used as an argument in setHigh. A method called getLow that has no parameters and that returns the value that was last used as an argument in setLow. 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 .
Front

Advertisement

public class WeatherForecast{ private String skies = ""; private int high = 0; private int low = 0; public void setSkies(String theSkies){ skies = theSkies; } public void setHigh(int theHigh){ high = theHigh; } public void setLow(int theLow){ low = theLow; } public String getSkies(){ return skies; } public int getHigh(){ return high; } public int getLow(){ return low; } }

About the flashcard:

This flashcard is meant to be used for studying, quizzing and learning new information. Many scouting web questions are common questions that are typically seen in the classroom, for homework or on quizzes and tests. Flashcards vary depending on the topic, questions and age group. The cards are meant to be seen as a digital flashcard as they appear double sided, or rather hide the answer giving you the opportunity to think about the question at hand and answer it in your head or on a sheet before revealing the correct answer to yourself or studying partner. Some questions will include multiple choice options to show you the options involved and other questions will just have the questions and corrects answers. Simply reveal the answer when you are ready to check your work. Absolutely no cheating is acceptable.