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

Other questions on the subject: Computers and Technology

image
Computers and Technology, 22.06.2019 17:30, Samsonb
Working on this program in python 3.7: a year in the modern gregorian calendar consists of 365 days. in reality, the earth takes longer to rotate around the sun. to account for the difference in time, every 4 years, a leap year takes place. a leap year is when a year has 366 days: an extra day, february 29th. the requirements for a given year to be a leap year are: 1) the year must be divisible by 42) if the year is a century year (1700, 1800, the year must be evenly divisible by 400some example leap years are 1600, 1712, and 2016.write a program that takes in a year and determines whether that year is a leap year. ex: if the input is 1712, the output is: 1712 is a leap year. ex: if the input is 1913, the output is: 1913 is not a leap year. your program must define and call the function isleapyear(useryear). the function should return true if the input year is a leap year and false otherwise.
Answers: 1
image
Computers and Technology, 22.06.2019 22:30, reinasuarez964
One of your customers wants you to build a personal server that he can use in his home. one of his concerns is making sure he has at least one backup of their data stored on the server in the event that a disk fails. you have decided to back up his data using raid. since this server is for personal use only, the customer wants to keep costs down. therefore, he would like to keep the number of drives to a minimum. which of the following raid systems would best meet the customer's specifications? a. raid 0 b. raid 1 c. raid 5 d. raid 10
Answers: 3
image
Computers and Technology, 23.06.2019 01:20, shiann2002
Me with this program in c++ ! computers represent color by combining sub-colors red, green, and blue (rgb). each sub-color's value can range from 0 to 255. thus (255, 0, 0) is bright red. (130, 0, 130) is a medium purple. (0, 0, 0) is black, (255, 255, 255) is white, and (40, 40, 40) is a dark gray. (130, 50, 130) is a faded purple, due to the (50, 50, 50) gray part. (in other word, equal amounts of red, green, blue yield gray).given values for red, green, and blue, remove the gray part. ex: if the input is 130 50 130, the output is: 80 0 80. thus, find the smallest value, and then subtract it from all three values, thus removing the gray.
Answers: 3
image
Computers and Technology, 23.06.2019 14:30, soapai
Select the correct answer. sean is a computer programmer. he has programmed an application for toddlers that plays nursery rhymes. however, a logic error has occurred in the program. which problem is a likely consequence of the error? a. the program crashes every time the user wants to play the nursery rhymes. b. the program crosses its buffer boundaries and overwrites an adjacent program. c. the program plays a different nursery rhyme than the one the user intended to play. d. the program shows different structures in its programming language code. e. the program introduces new viruses every time the user plays a nursery rhyme.
Answers: 1
You know the right answer?
Question 16(Multiple Choice Worth 1 points) Consider the following class designed to store weather...

Questions in other subjects:

Konu
Mathematics, 26.08.2021 15:50
Konu
Mathematics, 26.08.2021 15:50
Konu
Mathematics, 26.08.2021 15:50
Konu
English, 26.08.2021 15:50