Question: Please answer quick! It is due soon! Consider the following class designed to store weather statistics at a particular date and time. public class Weather
Please answer quick! It is due soon!
Consider the following class designed to store weather statistics at a particular date and time. public class Weather Snapshot { private int templnFahrenheit private int humidity, // value of 56 means 56% humidity private int dewpoint, Il in degrees Fahrenheit private Date date: // uses a Date object to store the date private int time; Il in military time, such as 1430 = 2:30 pm private boolean cloudy // true if 25% or more of the sky is covered Il constructor not shown, but it initializes all instance variables Il postcondition: returns temperature public int getTempo { return tempinFahrenheit // postcondition: returns date public Date getDate() return date; } 1/ postcondition: retums true if precipitation is likely, false otherwise public boolean precipitationLikely { // implementation not shown } Il other methods not shown ) Suppose that a client class named Weekly Weather stores Weather Snapshots throughout a week. This class has the following private instance variables: private ArrayList weatherEvents; private Date startDate first Date for the week's weather This class needs a method that creates a subset of all Weather Snapshot objects that match a certain date. How could this method be implemented? Add an accessor method to the Weather Snapshot class that returns true if the Date parameter matches its date instance variable: false otherwise. Add a method to the Weekly Weather class that loops through its ArrayList, and returns an ArrayList of Weather Snapshot objects whose dates match the Date parameter. O Add a method to the Weekly Weather class that loops through its ArrayList, and finds the number of Weather Snapshot objects whose dates match the Date parameter. O Add a method to the Weather Snapshot class that returns an ArrayList of Weather Snapshot objects that have been created whose dates match the Date parameter. O Add an additional class named Weekly WeatherSubset that contains a method that loops through the Weekly Weather ArrayList, and returns an ArrayList of Weather Snapshot objects whose dates match the Date parameter. Consider the following class designed to store weather statistics at a particular date and time. public class Weather Snapshot { private int templnFahrenheit private int humidity, // value of 56 means 56% humidity private int dewpoint, Il in degrees Fahrenheit private Date date: // uses a Date object to store the date private int time; Il in military time, such as 1430 = 2:30 pm private boolean cloudy // true if 25% or more of the sky is covered Il constructor not shown, but it initializes all instance variables Il postcondition: returns temperature public int getTempo { return tempinFahrenheit // postcondition: returns date public Date getDate() return date; } 1/ postcondition: retums true if precipitation is likely, false otherwise public boolean precipitationLikely { // implementation not shown } Il other methods not shown ) Suppose that a client class named Weekly Weather stores Weather Snapshots throughout a week. This class has the following private instance variables: private ArrayList weatherEvents; private Date startDate first Date for the week's weather This class needs a method that creates a subset of all Weather Snapshot objects that match a certain date. How could this method be implemented? Add an accessor method to the Weather Snapshot class that returns true if the Date parameter matches its date instance variable: false otherwise. Add a method to the Weekly Weather class that loops through its ArrayList, and returns an ArrayList of Weather Snapshot objects whose dates match the Date parameter. O Add a method to the Weekly Weather class that loops through its ArrayList, and finds the number of Weather Snapshot objects whose dates match the Date parameter. O Add a method to the Weather Snapshot class that returns an ArrayList of Weather Snapshot objects that have been created whose dates match the Date parameter. O Add an additional class named Weekly WeatherSubset that contains a method that loops through the Weekly Weather ArrayList, and returns an ArrayList of Weather Snapshot objects whose dates match the Date parameter
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
