Computers and Technology

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.

answer
Answers: 1

Other questions on the subject: Computers and Technology

image
Computers and Technology, 22.06.2019 09:30, eiza666
My mom and i are moving and we don’t have wifi for the next week, i want to know if using a using a hotspot with unlimited data is better than using regular wifi. i’m considering cost, speed, and data sacrifices.
Answers: 1
image
Computers and Technology, 22.06.2019 16:00, sdonachy7
You have inserted new slides based on a word outline. how do you format these new slides to match the powerpoint presentation formatting? a. select all slides in the presentation and click format on the home tab. b. select the new slides and click reset on the home tab. c. select all slides in the presentation and click reset on the home tab. d. select the new slides and click format on the home tab.
Answers: 3
image
Computers and Technology, 23.06.2019 02:30, chaaaa
People with high self-esteem: accept their strengths and weaknesses. believe that failed experiences are failures of their whole self. feel good about who they are only when they reach total success. need positive external experiences to counteract negative feelings that constantly plague them.
Answers: 1
image
Computers and Technology, 23.06.2019 18:30, sawyerfauver
The computers in the sales department did not have enough data storage capacity to contain all the information the department needed to store, and it was taking a long time for team members to access the data they needed. to fix the problem, the technician installed new, larger hard drives on all the computers.
Answers: 1
Do you know the correct answer?
Question 16(Multiple Choice Worth 1 points) Consider the following class designed to store weather...

Questions in other subjects:

Konu
Biology, 01.08.2019 18:30