Enter 10 integers, count and output the number of positive, negative, and zero.

Enter 10 integers, count and output the number of positive, negative, and zero.

If # include void main (){ int a [10],i;int positive _ num,negative _ num, zero_ num;positive _ num = negative_ num = zero_ num =0; for (i=0; i0) positive_ num ++; else if (a [i ]<0) negative_ num ++;else zero _...

Write a java program, enter an indefinite number of integers, enter the end of 0. Count the number of positive and negative numbers in these integers, and calculate their sum.

Public static void test (){
Scanner sc = new Scanner (System.in);
Long num =0,negative =0,positive =0, sum =0;
List nums = new ArrayList ();
Do {
System.out.println (" please enter a number:");
Strings = sc.nextLine ();
If (isNumber (s)){
Num = Long.parseLong (s);
If (num! = 0){
Nums.add (num);
Continue;
}
Break;
}
System.out.println (" not number! ");
Break;
} While (true);
For (Long n:nums){
If (n >0){
Positive++;
} Else {
Negative++;
}
Sum += n;
}
System.out.println (" the negative:"+negative);
System.out.println (" the positive:"+ positive);
System.out.println (" the sum:"+ sum);
}
Public static boolean isNumber (Strings){
Try {
Long.parseLong (s);
return true;
} Catch (Exception e){
return false;
}
}
Just call in the main function