title: Rainfall program not accepted in codeLab
body: <p>I am working on an assignment from MyProrammingLab:
  Write a RainFall class  that has the following field:</p>
  
  <p>• an array  of doubles  that stores  the rainfall for each of the 12 months of
  the year (where the first index corresponds with January, the second with
  February, etc.)</p>
  
  <p>The class  should also have the following methods :</p>
  
  <p>• a method  that returns the total rainfall for the entire year
  • a method  that returns the average monthly rainfall for the year
  • a method  that returns the month with the most rain as a string 
  • a method  that returns the month with the least rain as a string </p>
  
  <p>Demonstrate the class  in a program  that takes 12 doubles  from the user (take the 
  doubles  in the order of the months of the year, the first corresponding to the 
  rainfall in January, etc.). Do input validation: if the user inputs a negative
  number, ignore it and continue asking them for input until  you have 12
  nonnegative doubles . </p>
  
  <p>Once the user has given  you all 12 doubles , create an instance of the RainFall
  class  and call its methods , printing out the total rainfall, the average
  monthly rainfall, the month with the most rain, and the month with the least
  rain, each on a separate line. </p>
  
  <p>Here is my program, which is working fine with netbeans but rejected by codeLab:</p>
  
  <pre><code>import java.text.DateFormatSymbols;
  import java.util.Scanner;
  
  public class RainFall {
      final private double[] rainFall;
  
      public RainFall(double[] arr) {
          rainFall = arr;
      }    
      public double getTotalRain() {
          double total = 0;
          for(int i=0;i&lt;rainFall.length;i++)
              total = total + rainFall[i];
          return total;
      }
      public double getAverageRain() {
          double average = 0;
          for(int i=0;i&lt;rainFall.length;i++)
              average = average + rainFall[i];
          return average/rainFall.length;
      }
      public String getHighestRain() {
          int j=0;
          for(int i=0;i&lt;12;i++)
              if(rainFall[i]&gt;rainFall[j])
                  j=i;
          return new DateFormatSymbols().getMonths()[j];
      }
      public String getLowestRain() {
          int j=1;
          for(int i=0;i&lt;12;i++)
              if(rainFall[i]&lt;rainFall[j])
                  j=i;
          return new DateFormatSymbols().getMonths()[j];
      }    
  
      public static void main(String[] args) {
  
          Scanner myScan = new Scanner(System.in);
  
  
          double[] rainfallInput = new double[12];
          for(int i=1;i&lt;=12;i++) {
              System.out.print("Enter rainfall for month " + i + ":");
              rainfallInput[i-1]=myScan.nextDouble();
              myScan.nextLine();
              if(rainfallInput[i-1]&lt;0) {
                  System.out.print("Enter rainfall for month " + i + :");
                  rainfallInput[i-1]=myScan.nextDouble();
                  myScan.nextLine();
              }
          }        
          RainFall rain = new RainFall(rainfallInput);
          System.out.println(rain.getTotalRain());
          System.out.println(rain.getAverageRain());
          System.out.println(rain.getHighestRain());
          System.out.println(rain.getLowestRain());
      }
  }
  </code></pre>
  
  <p>Any help would be appreciated!
  Thank you in advance</p>