For java This assignment works with real-world data. Therefore it is messy. You
ID: 647746 • Letter: F
Question
For java
This assignment works with real-world data. Therefore it is messy. You will also be using real-world documentation, so that is even messier.
The web site http://weather.noaa.gov/pub/data/observations/metar/stations/ lists weather stations with currently active forecasts. For example, KSTJ is the code for the St. Joseph, Missouri weather station. weather stations. If you add "KSTJ.TXT" to the first URL it gives you the St. Joseph weather report with the following cryptic data in "Metar" format.
Write a program that does the following.
Build a Station class that holds the city, state abbreviation, country code, and 4-character station code. This list should be comparable based on the 4-character station code.
When you turn in your final code it should read directly from the URL. However, to be kind to the government's websiste you should download the page to a local file and read from the local file during development.
Store the stations in a linked list like we have worked on in class. The Linked List class should be in a separate file.
Create a class called "Report." The class contains the Station class as well as the temperature, dew point, wind direction and speed, visibility, and weather phenomena (-RA BR). It should also report if there is a Tornado, Funnel Cloud, Waterspout or lightning in the report. The class should be comparable based on the 4-digit weather code.
Overachievers may decode the tornado, lightning, and other data and record it.
Read from a file called input.txt. The file consists of a series of 4-character weather station codes, one per line. Read each code. If the code is not already on the list, it should be ADDED IN ORDER BY 4-DIGIT CODE. If the station is already on the list it should be removed.
Print the stations after reading the input file
Explanation / Answer
import de.mbenning.weather.wunderground.api.domain.DataSet; import de.mbenning.weather.wunderground.api.domain.WeatherStation; import de.mbenning.weather.wunderground.api.domain.WeatherStations; import de.mbenning.weather.wunderground.impl.services.HttpDataReaderService; public class weather { public static void main(String[] args) { // create a instance of a wunderground data reader HttpDataReaderService dataReader = new HttpDataReaderService(); // select a wunderground weather station (ID "INORDRHE72" = Dortmund-Mengede) WeatherStation weatherStation = WeatherStations.ALL.get("INORDRHE72"); // KMABOSTO22 is the ID for Boston South end //WeatherStation weatherStation = WeatherStations.ALL.get("KMABOSTO32"); // set selected weather station to data reader dataReader.setWeatherStation(weatherStation); // get current (last) weather data set from selected station DataSet current = dataReader.getCurrentData(); // print selected weather station ID System.out.println(weatherStation.getStationId()); // print city, state and country of weather station System.out.println(weatherStation.getCity() + " " + weatherStation.getState() + " " + weatherStation.getCountry()); //`enter code here` print datetime of measure and temperature ... System.out.println(current.getDateTime() + " " + current.getTemperature()); }
Related Questions
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.