How to summarize numbers entered by user?
<p>I am doing an assignment and have most of what i think will work down, i have to promt the user for random numbers, then display how many negatives as well as positives then sum and average, can anyone help me as i cannot get my code to display the correct amount of values for negative or positive or get it to sum. Here is what i have so far( i also added the break in the end , otherwise it went to an infinate loop)</p>

<pre><code>//Random number evaluation
package chapter_4;

import java.util.Scanner;


public class Four_One {

    public static void main(String[] args) {

       int positive = 0;
       int negative = 0;
       int sum = 0;
       int count = 0;

       Scanner input = new Scanner(System.in);

       System.out.print("Enter in a value, if 0 is entered program stops: ");
       int data = input.nextInt();


       while (data != 0) {
            sum += data;

            if (data &lt; 0)
               negative++;

            else if (data &gt; 0)
               positive++;

           count++;

        System.out.println("The number of positives is: " + positive);
        System.out.println("The number of negatives is:" + negative);
        System.out.println("The total is: " + sum);
        System.out.println("The average is: " + sum / data); 

        break; }

       }   

} 
</code></pre>
