Question: A logging system writes weather data to a file and you are to read the file and return specified data from it (if it exists).
A logging system writes weather data to a file and you are to read the file and return specified data from it (if it exists).
The file contains a number of records on individual lines, with values on a line separated by commas (a .csv file).
The data is location, temperature, rainfall, visibility, windspeed.
These are of types String, double, int, String, double respectively.
Write a method readRainfall() that takes one argument representing the filename. Any potential exceptions must be caught, including on closing the file.
If no exception occurs, the method should return a SortedMap containing the location and rainfall for each record in the file. If an exception occurs, the method should return an empty map.
This is what I have so far
/** *This method takes a filename as an argument. *The file contains records consisting of:- * location - String * temperature - double * rainfall - int * visibility - String * windspeed - double * * It reads those and writes location and temperature into a sortedMap which it returns. The remianing data is discarded. */ public SortedMap
}
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
