Advanced Programming

PA2 - Let it Rain

Software Requirements Specification

Due Wednesday February 12, 2014 11:59pm

Introduction

Purpose: The National Oceanic and Atmospheric Administration (NOAA) collects weather data from stations around the county. Your job is to build a class that will store and then produce data about rainfall from a particular weather station. This data consists of daily rainfall totals.

Objectives - At the conclusion of this exercise the student will demonstrate that they can:

Deadlines

Program Structure

You will write code in a single class, the Rainfall class. This class will contain the following attributes:

    1. A 3 dimensional matrix of rainfall data. The first dimension is the year of the data, the second is the month, and the third the rainfall for the day. Rainfall data is stored as double values representing rainfall in inches.
    2. An integer variable that represents the starting year for the data.
    3. A String, which contains the station for this rainfall data.

This class will contain the following methods (See the documentation for the Rainfall class for more detail about the method requirements.:

    1. A constructor that takes in a 3 dimensional array of rainfall data along with a beginning year and station name.
    2. An accessor method, getYear, to get the starting year value.
    3. A public met hod averageRainfall that takes in no parameters and returns the average annual rainfall for all of the years in the rainfall array.
    4. A public method averageRainfall that takes in an integer parameter representing a month and returns the average monthly rainfall for that month across all years. January would be entered as month 1.
    5. A public method recordHigh that returns a String representing the date of the highest rainfall amount and that amount.
    6. A public method totalRainfall that takes in no parameters and returns an array of the total rainfall in inches by year starting with beginYear.
    7. A public method getRainfall that takes in a month, day, and year, and returns the total rainfall for that day in inches.
    8. A toString method that takes in no parameters and returns a String representing a list of each year and the days with rain.

We are providing a Rainfall.java starter and RainfallDriver.java program to help you get started. One set of data is found in the file Rainfall.csv. For Eclipse, this data file should be placed at the top level of the project folder. Note that the incoming data file name is entered as an argument to the main method. For Eclipse, you can go to Project/Preferences/Run/Debug and update the arguments in the run settings or simply run the program from the Command Line..

Output and Error Handling

See each method documentation for appropriate error handling.

Additional Application Requirements

  1. Any additional methods that you add should be made private.
  2. Your program must conform to standard Java programming standards and the additional standards for this class. See the Style Guide for your class.
  3. You should, for your own benefit, write a tester that will test the various methods that you are building and the classes that you are using. This would be a good chance to practice using JUnit testing within Eclipse.
  4. You are NOT required to submit a tester program. All testing will be done by the instructor reference tests.
  5. You must submit your Rainfall.java and ack.txt to the submit system as 'submit pa2'

Honor Code

This work must conform to the JMU Honor Code and the specific requirements of this class. NO help may be provided by any student to another student. Authorized help is limited to your textbook, the TAs for any CS159 section, and the professor for your section. Be sure to acknowledge any help that you do receive from a TA or internet sources (like StackOverflow).

Grading

HINTS

Last updated: 02/04/2014