0

I am writing a little program to create an array and then to sum the integers in the array. I am also suffering a stomach flu, and I don't have the brainpower to figure out how to call the two methods I wrote to create the array and then sum the array. I would really appreciate some help -- even just a few pointed hints.

LGK

```
class SumIntegers { //define class
// private variables to be used by this class
private int n; // number of integers in the array
private int array[]; // the array to hold the integers to be summed
private int x; // the lower bound of the integer array
private int y; // the upper bound of the integer array
int sum; // sum of the array's integers
// constructor
public SumIntegers(){
x = 12;
y = 23;
n = y - x + 1;
}
//main method
public void main(String[] args){
System.out.println("This program sums a range of integers.");
//todo call createArray method
//todo call sumArray method
System.out.println("The sum of the elements in the array is: " + sum);
}
//method to create the array
public void createArray(){
int i;
array[0] = x;
for (i = 1; i < n; i++){
array[i] = array[i-1] + 1;
}
//print elements of the array
for (int j = 0; j < array.length; j++) {
System.out.println("The array includes these integers: " + array[i]);
} //end method to populate array
}
//sum the elements of the array
public int sumArray(){
int k;
int sum = 0;
for(k = 0; k < n; k++){
sum = sum + array[k];
}
return sum;
}
}
```