This is my assignment:

Sum the Elements

Complete the following program, called SumElements, so that it computes the sum of all the elements of the array, the sum of the even elements, and the sum of the odd elements. Assume that all the numbers are zero or positive. Even integers can be determined by dividing each number by two. If the remainder is 0, then the integer must be even (eg. if number%2 = 0, it must be even).

I'm falling behind and need to catch up in my computer science online course, so this is my first program im stuck on i have no idea where to start, this is the outline that i was given to complete it with:

// The "SumElements" class.

import java.awt.*;

import hsa.Console;

public class SumElements

{

static Console c; // The output console

public static void main (String[] args)

{

c = new Console ();

int[] sumData = {3, 2, 5, 7, 9, 12, 97, 24, 54};

//declare and initialize three sums

//compute the sums of all the elements

int totalSum = 0;

for (int index = 0 ; index < sumData.length ; index++)

{

totalSum += sumData [index];

c.println (totalSum);

//write out the three sums

}

} // main method

} // SumElements class