$25
Java Application A19005 The purpose of this assignment is to demonstrate the creation of a class called NWSFB05 that will be subordinate to your main program. This class will contain methods that will handle all of the string processing for the Winds Aloft data from the National Weather Service including the exceptions for high altitude and winds over 100 knots. Java Application A19005: In general, you will: Open a file for output called FBOUT.txt Read the FBIN.txt file line by line and for each station after skipping the first seven lines: Instantiate the NWSFB object with the station weather Call the fmtWeatherReport() method and append the formatted string to the output file. Don't forget to close both your input and output files when you are done. Subordinate Class NWSFB05: We will be adding to this code in later assignments so it is important to get the concepts down correctly. Here you are constructing a class with several methods. Each one has a specific set of tasks to do and will fit into the larger mosaic later in the course. Thus, do not combine the methods or functionality except as stated below. Create a class level private string variable called strWeather. Create a constructor that will accept a string called strVar and assign it to strWeather. Create a method called getStationID() that returns the first three letters of the strWeather variable as a string. Create a method called getPos(strAlt) that accepts a string representing the altitude in thousands and returns an integer representing a position in the string (see tutorial link above). Create a method called getAltitudeWeather(strAlt) that accepts a two character string representing the altitude in thousands and returns a seven character string representing the Altitude Weather. Create a method called getWindDirection(strAlt) that accepts a two character string representing the altitude and returns the wind direction as a string. Here we must apply our exceptions: If the first two characters are blanks, return "N/A" If the first four characters of the altitude weather are "9900" then return "Calm" If the first two characters of the Altitude Weather are greater than 36 then subtract 50. This happens when the wind is blowing over 100 knots and the NWS needed a condition to indicate that. For example, 7715-12 would indicate that the wind is coming from 270 degrees at 115 knots at -12C. (77-50 = 27). Because the two characters represent the wind direction, and something like 27 actually means 270 degrees, there is no such thing as 39 or 390 degrees. Thus, the National Weather Service will use 01 - 36 and 51 - 86 only, they do not code it with numbers that start with anything between 37 and 49 inclusive. Otherwise just return the first two characters with a "0" appended to it. Create a method called getWindSpeed(strAlt) that accepts a two character string representing the altitude in thousands and returns the wind speed as a string. Again we must apply some exceptions: If the third and fourth characters of the altitude weather are blanks, return "N/A" If the first four characters of the altitude weather are "9900" then return "Calm" If the first two characters of the Altitude Weather are greater then 36 then you will need to add 100 to your returned speed. Extract the wind speed (the second two characters) and add 100 if necessary. Otherwise just return the second two characters of the altitude weather. Create a method called getWindTemp(strAlt) that accepts a two character string representing the altitude and returns the wind temperature as a string. The exceptions are: If the fifth character is a blank, return "N/A" If the altitude is over 24000 feet, add a "-" as a prefix. Otherwise just return the last three characters. Create a public method called fmtWeatherReport(). Build a formatted string that will be returned to the calling program. The main program will be responsible for appending it to disk so all you have to do in this method is return the formatted string. An example of the formatted string is as follows, note that you need to return all nine altitudes. To get the carriage returns and line feeds, remember to put in \r\n in your string. Station ID: SAN The Altitude Weather for 3000 feet is: 3106 Wind Direction: 310 degrees Wind Speed: 06 knots Wind Temperature: n/a