import java.io.FileNotFoundException; import java.io.IOException; import java.util.ArrayList; /** * * @author CS2334. Modified by: ????? *

* Date: 2015-09-10
* Project 1 *

* This class represents the data for a set of months * */ public class DataSet { /** Monthly data: one entry for each month. */ private ArrayList months; /** Average rainfall over all months. */ private double rainAverage; /** Minimum rainfall over all months. */ private double rainMin; /** The month in which the minimum rainfall occurred */ private MonthlyData rainMinMonth; /** The maximum rainfall across all months. */ private double rainMax; /** The month in which the maximum rainfall occurred */ private MonthlyData rainMaxMonth; /** Average temperature across the months. */ private double temperatureAverage; /** Minimum temperature across the months. */ private double temperatureMin; /** The month in which the minimum temperature occurred. */ private MonthlyData temperatureMinMonth; /** The maximum temperature across the months */ private double temperatureMax; /** The month in which the maximum temperature occurred. */ private MonthlyData temperatureMaxMonth; /** * DataSet constructor *

* Specific steps: *

* * @param fileNames Array of strings, each of which encodes the file name for a single month * * @throws IOException * @throws NumberFormatException * @throws FileNotFoundException */ public DataSet(String[] fileNames) throws IOException, NumberFormatException, FileNotFoundException{ // TODO: complete implementation } /** * Compute the rain-related statistics given that all of the months have * been loaded. Specifically: rainAverage, rainMin, rainMinMonth, rainMax, and * rainMaxMonth; */ private void computeRainStats(){ // TODO: complete implementation } /** * Compute the temperature-related statistics assuming that all of the months * have already been loaded. Specifically: temperatureAverage, temperatureMin, * temperatureMinMonth, temperatureMax, and temperatureMaxMonth */ private void computeTemperatureStats(){ // TODO: complete implementation } /** * Describe the data set * * @return String that describes the summary statistics for the DataSet */ public String toString(){ String out = ""; out += "Rain Average: " + rainAverage + "\n"; out += "Rain Min: " + rainMin + " in " + rainMinMonth.getMonth() + "/" + rainMinMonth.getYear() + "\n"; out += "Rain Max: " + rainMax + " in " + rainMaxMonth.getMonth() + "/" + rainMaxMonth.getYear() + "\n"; out += "Temperature Average: " + temperatureAverage + "\n"; out += "Temperature Min: " + temperatureMin + " in " + temperatureMinMonth.getMonth() + "/" + temperatureMinMonth.getYear() + "\n"; out += "Temperature Max: " + temperatureMax + " in " + temperatureMaxMonth.getMonth() + "/" + temperatureMaxMonth.getYear() + "\n"; return out; } // TODO: add getters }