Im trying tog et this simple program to output the percentage of elements in an array but, cannot figure it out for the life of me. I know its something really freaking obvious... but, WHAT IS IT?? ITS KILLING ME!!!! ARRGGGGGGGGGGGGG!!!!!!!!

=)

Thanks to whoever can fill me in.

CODE:

import java.util.*;

public class ArrayDemo {

public static void main(String[] args) {

Scanner keyboard = new Scanner(System.in);

System.out.println("How many numbers will you enter?");

int amountOfIntegers = keyboard.nextInt();

int[] a = new int[amountOfIntegers];

int index, sum;

sum = 0;

System.out.println("Enter " + a.length + " integers, one per line: ");

for(index = 0; index < a.length; index++) {

a[index] = keyboard.nextInt();

sum = sum + a[index];

}

System.out.println("The sum is " + sum + ".");

System.out.println("The numbers are:");

double percent;

for(index = 0; index < a.length; index++) {

percent = (a[index]/sum) * 100;

System.out.println(a[index] + " " + percent + "% of the sum.\n");

}

}

}

OUTPUT:

How many numbers will you enter?

5

Enter 5 integers, one per line:

1

2

3

4

5

The sum is 15.

The numbers are:

1 0.0% of the sum.

2 0.0% of the sum.

3 0.0% of the sum.

4 0.0% of the sum.

5 0.0% of the sum.