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, 23.06.2019 01:30
For a typical middle-income family, what is the estimated cost of raising a child to the age of 18? $145,500 $245,340 $304,340 $455,500
Answers: 2
question
Computers and Technology, 23.06.2019 09:00
Before you record your own voice, you should a. record other people's voices b. warm up and practice difficult names c. listen to your favorite songs d. read a transcript of a good radio news segment
Answers: 1
question
Computers and Technology, 24.06.2019 22:10
Function name: poly parameters: int returns: int description: a polynomial of degree n with coefficients a0,a1,a2,a3, . . ,an is the function p(x) = a0+a1x+a2x2+a3 ∗ x3+ . . +an ∗ xn this function can be evaluated at different values of x. for example, if: p(x) = 1+2x+ x2, then p(2) = 1+2 ∗ 2+22 = 9. if p(x) = 1+x2+x4, then p(2) = 21 and p(3) = 91. write a function poly() that takes as input a list of coefficients a0, a1, a2, a3, . . , an of a polynomial p(x) and a value x. the function will return poly(x), which is the value of the polynomial when evaluated at x.
Answers: 3
question
Computers and Technology, 25.06.2019 11:10
1. when you see a sign colored yellow, you should: o a. adjust your driving for the condition indicated b. figure out if you're nearing your destination o c. obey the prohibition indicated on the sign
Answers: 1
You know the right answer?
Question 16(Multiple Choice Worth 1 points) Consider the following class designed to store weather...
Questions
question
Biology, 29.11.2019 09:31
question
Mathematics, 29.11.2019 09:31
Questions on the website: 13722363