I HAVE THE FOLLOWING:

1.MONTH ENUM
2.RAINFALLYEAR CLASS
3.TEST CLASS
4. THE TEST FAILURE

it must be able to take the Month enumeration type and convert this to return the mean rainfall for the correct month.

I NEED TO CONVERT THE ENUM IN THE GET METHOD public double getRainfallMonth(Month month) { return 0;
}

1. THE ENUM MONTH

package org.com1027.cw2.me00086;
public enum Month {

JANUARY ( ),
FEBRUARY,
MARCH,
APRIL,
MAY,
JUNE,
JULY,
AUGUST,
SEPTEMBER,
OCTOBER,
NOVEMBER,
DECEMBER ;



}


2. THE CLASS RAINFALLYEAR


package org.com1027.cw2.me00086;
public class RainfallYear {


private int year ;
double []rainfallMonths=new double[12];
private static final double TOTALMONTHS=(0 + 1 + 2 + 3 + 4 + 5 + 6 + 7 + 8 + 9 + 10 + 11);
private static final double NUMBEROFMONTHS=12;




public int getYear() {
return year;


}

public RainfallYear(int year, double rainfallMonths[] ) {

super();
this.year=year;
this.rainfallMonths=rainfallMonths;
}

public double getRainfallMonth(Month month) {






return 0;
}





public double calculateMeanRainfall() {

return TOTALMONTHS/NUMBEROFMONTHS;
}


}

3. THE TEST


package org.com1027.cw2.me00086;

/**
* RainfallTest.java
*/



import static org.junit.Assert.assertEquals;

import org.junit.Test;

/**
* Tests for the <code>RainfallYear</code> class.
*
* @author Matthew Casey
*/
public class RainfallYearTest {

/**
* Test object construction.
*/
@Test
public void testConstruction() {
// Create an object with a line to parse.
RainfallYear rainfallYear = new RainfallYear(2009, new double[] { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11 });

// Test that the correct values have been extracted.
assertEquals("Incorrect year", 2009, rainfallYear.getYear());

for (int i = 0; i < 12; i++) {
assertEquals("Incorrect rainfall", i, rainfallYear.getRainfallMonth(Month.values()[i]), 0);
System.out.println(Month.values()[i] + ": " + i + " == " + rainfallYear.getRainfallMonth(Month.values()[i]));
}
}

/**
* Test calculation of the mean rainfall.
*/
@Test
public void testMeanRainfall() {
// Create an object with a line to parse.
RainfallYear rainfallYear = new RainfallYear(2009, new double[] { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11 });

// Test that the mean is correct.
double expectedMean = (0 + 1 + 2 + 3 + 4 + 5 + 6 + 7 + 8 + 9 + 10 + 11) / (double) 12;
assertEquals("Incorrect mean", expectedMean, rainfallYear.calculateMeanRainfall(), 0);
}
}

4- THE TEST FAILURE NOT LOOPING??

java.lang.AssertionError: Incorrect rainfall expected:<1.0> but was:<0.0>
at org.junit.Assert.fail(Assert.java:91)
at org.junit.Assert.failNotEquals(Assert.java:645)
at org.junit.Assert.assertEquals(Assert.java:441)
at org.com1027.cw2.me00086.RainfallYearTest.testConst ruction(RainfallYearTest.java:32)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Nativ e Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknow n Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Un known Source)
at java.lang.reflect.Method.invoke(Unknown Source)
at org.junit.runners.model.FrameworkMethod$1.runRefle ctiveCall(FrameworkMethod.java:44)
at org.junit.internal.runners.model.ReflectiveCallabl e.run(ReflectiveCallable.java:15)
at org.junit.runners.model.FrameworkMethod.invokeExpl osively(FrameworkMethod.java:41)
at org.junit.internal.runners.statements.InvokeMethod .evaluate(InvokeMethod.java:20)
at org.junit.runners.BlockJUnit4ClassRunner.runNotIgn ored(BlockJUnit4ClassRunner.java:79)
at org.junit.runners.BlockJUnit4ClassRunner.runChild( BlockJUnit4ClassRunner.java:71)
at org.junit.runners.BlockJUnit4ClassRunner.runChild( BlockJUnit4ClassRunner.java:49)
at org.junit.runners.ParentRunner$3.run(ParentRunner. java:193)
at org.junit.runners.ParentRunner$1.schedule(ParentRu nner.java:52)
at org.junit.runners.ParentRunner.runChildren(ParentR unner.java:191)
at org.junit.runners.ParentRunner.access$000(ParentRu nner.java:42)
at org.junit.runners.ParentRunner$2.evaluate(ParentRu nner.java:184)
at org.junit.runners.ParentRunner.run(ParentRunner.ja va:236)
at org.eclipse.jdt.internal.junit4.runner.JUnit4TestR eference.run(JUnit4TestReference.java:50)
at org.eclipse.jdt.internal.junit.runner.TestExecutio n.run(TestExecution.java:38)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRu nner.runTests(RemoteTestRunner.java:467)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRu nner.runTests(RemoteTestRunner.java:683)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRu nner.run(RemoteTestRunner.java:390)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRu nner.main(RemoteTestRunner.java:197)