subject

Question 16(Multiple Choice Worth 1 points) Consider the following class designed to store weather statistics at a particular date and time:

public class WeatherSnapshot
{
private int tempInFahrenheit;
private int humidity; // value of 56 means 56% humidity
private int dewPoint; // in degrees Fahrenheit
private String date; // stores the date as a String
private int time; // in military time, such as 1430 = 2:30 pm
private boolean cloudy; // true if 25% or more of the sky is covered

// constructor not shown, but it initializes all instance variables
// postcondition: returns temperature
public int getTemp()
{
return tempInFahrenheit;
}

// postcondition: returns date
public String getDate()
{
return date;
}
// postcondition: returns true if precipitation is likely; false otherwise
public boolean precipitationLikely()
{
// implementation not shown
}

// other methods not shown
}

Suppose that a client class named WeeklyWeather stores WeatherSnapshots throughout a week. This class has the following private instance variables:
private ArrayList weatherEvents;
private String startDate; // first date for the week's weather

This class needs a method that creates a subset of all WeatherSnapshot objects that match a certain date. How could this method be implemented?

Add an accessor method to the WeatherSnapshot class that returns true if the date passed as a parameter matches its date instance variable; false otherwise.

Add a method to the WeeklyWeather class that loops through its ArrayList weatherEvents, and returns an ArrayList of WeatherSnapshot objects whose dates match the date passed as a parameter.

Add a method to the WeeklyWeather class that loops through its ArrayList weatherEvents, and finds the number of WeatherSnapshot objects whose dates match the date passed as a parameter.

Add a method to the WeatherSnapshot class that returns an ArrayList of WeatherSnapshot objects that have been created whose dates match the date passed as a parameter.

Add an additional class named WeeklyWeatherSubset that contains a method that loops through the WeeklyWeather ArrayList, and returns an ArrayList of WeatherSnapshot objects whose dates match the date passed as a parameter.

ansver
Answers: 1

Another question on Computers and Technology

question
Computers and Technology, 21.06.2019 20:50
Write a method in the heapintpriorityqueue class called merge that accepts another heapintpriorityqueue as a parameter and adds all elements from the other queue into the current queue, maintaining proper heap order such that the elements will still come out in ascending order when they are removed. your code should not modify the queue passed in as a parameter. (recall that objects of the same class can access each other's private fields.)
Answers: 2
question
Computers and Technology, 21.06.2019 21:30
Ajeweler designing a pin has decided to use five stones chosen from diamonds, rubies, and emeralds. in how many ways can the stones be selected?
Answers: 3
question
Computers and Technology, 22.06.2019 17:50
Farah works in an office with two other employees. all three share a printer and an internet connection. the utility that makes this possible is defragger quicktime soho winzip
Answers: 1
question
Computers and Technology, 23.06.2019 03:50
Q-1 which of the following can exist as cloud-based it resources? a. physical serverb. virtual serverc. software programd. network device
Answers: 1
You know the right answer?
Question 16(Multiple Choice Worth 1 points) Consider the following class designed to store weather...
Questions
question
English, 04.07.2019 07:00
question
Mathematics, 04.07.2019 07:00
Questions on the website: 13722360