Weather Data

In the United States, the NOAA collects weather data and issues official weather forecasts. They have data from all weather stations in the country posted and freely available online. This data is provided by an agency of the US Federal Government: National Centers for Environmental Information (NCEI), a part of the National Oceanic and Atmospheric Administration (NOAA).

http://www.ncdc.noaa.gov/data-access/quick-links#loc-clim

Here is an example of some temperature data from a weather station near Pittsburgh, PA.

20180101, 11, 2, 7, -22.6
20180102, 12, 5, 9, -20.5
20180103, 13, 2, 13, -16.4
20180104, 17, 3, 10, -19.3
20180105, 9, -3, 3, -26.2
20180106, 11, -1, 5, -24.1
20180107, 27, -5, 11, -18
20180108, 34, 27, 31, 2.1

We would like to do some analysis on this data. The daily data for 1 weather reporting station in Pennsylvania during 2018 has been captured from the NOAA website and loaded into a Java class. This class is called TemperatureData.

Create a new Bluej project called Lab5-YOUR NAME. This project will contain at least 3 java classes.

The first class is called Temperature Data and has already been written. It is available on the Lab Canvas site, in the Assignments section (Lab 05 assignment). You should download this class and add it to your Lab5 project. You may not modify this class in any way. Just use its 2 public static methods to load the weather data into your program. The 2 methods are:

boolean hasNextTempRecord()
This static method returns true if there is more data to read and false when the end of data is reached. Once you have read the false value from hasNextTempRecord, you may not call either of these TemperatureData methods again.

String getNextTempRecord()
This static method returns a string containing 1 temperature record. You will need to divide each of these strings into the following 5 data elements.

YearMonthDay is the date (Year, Month, and Day in 1 8-digit integer as shown above) when the temperature data in this record was captured.

Tmax is the maximum temperature for the indicated day in Fahrenheit degrees as an integer.

Tmin is the minimum temperature for the indicated day in Fahrenheit degrees as an integer.

Tavg is the average temperature for the indicated day in Fahrenheit degrees as an integer.

Tdif is the Daily departure from the normal average temperature for this day. This is a floating-point number (so it contains a decimal point) and can be either positive or negative.

The TemperatureData class also contains a static method that returns the name of the weather station that reported the above data. All the data in this class comes from the same station. This method can be called multiple times, and will return the same string each time. The getStation Name method returns the weather station name as a string.

The second class in your program should be called Station Record. It defines the objects that contain the weather data. Each TemperatureData record should be converted into separate Station Record object.

The third class contains your main method. The main method should create an ArrayList of Station Records. Then read the weather data from the TemperatureData class and store it in an ArrayList of Station Records. Then use the ArrayList data to produce the following 5 reports. Provide a nicely formatted statement of each question followed by the answer. You will not need to read any inputs from the keyboard for this program, just write methods for each of the 5 reports listed below.

1. What is the maximum temperature reported by the Station during 2018. List the temperature, the date (or dates if more than 1) formatted like August 1, 2018, and the station name.

2. What is the minimum temperature reported by the Station during 2018. List the temperature, the date (or dates if more than 1) formatted like August 1, 2018, and the station name.

3. What is the average average (Tavg) temperature for this Station during 2018.

4. What is the percentage of days this year so far with above average temperatures. Also calculate and print the average amount of this increase per day.

5. What is the percentage of days this year so far with below average temperatures. Also calculate and print the average amount of this decrease per day.

Academic Honesty!
It is not our intention to break the school's academic policy. Posted solutions are meant to be used as a reference and should not be submitted as is. We are not held liable for any misuse of the solutions. Please see the frequently asked questions page for further questions and inquiries.
Kindly complete the form. Please provide a valid email address and we will get back to you within 24 hours. Payment is through PayPal, Buy me a Coffee or Cryptocurrency. We are a nonprofit organization however we need funds to keep this organization operating and to be able to complete our research and development projects.