import java.util.Scanner;
import java.util.Arrays;
/**
This class prints the numeric value of a letter grade given by the user.
*/
public class Numbers
{
int countEven=0;
int countOdd=0;
private int[] digits;
private int[] evenoddCount;
Scanner input = new Scanner(System.in);
/**
Constructs numbers set to 0
@param anEfficiency the fuel efficiency of the car
*/
public Numbers()
{
digits = new int[10];
}
/**
collects 10 numbers from user and places then into array
@return the gradeValue
*/
public void inputArray(int a, int b, int c, int d, int e, int f, int g, int h, int i, int j)
{
digits = {a, b, c, d, e, f, g, h, i, j};
}
/**
counts even and odds
@return numeric grade
*/
public void evenOdds()
{
for(int i=0; i < digits.length; i++)
{
if(digits[i]%2 == 0)
countEven++;
else
countOdd++;
evenoddCount = {countEven, countOdd};
}
}
/**
prints out the array of 10 positive integers
@return numeric grade
*/
public void printArray()
{
System.out.println(Arrays.toString(evenoddCount));
}
}
}
Code is supposed to find even odd numbers using arrays. Comments are messed up though for some reason. I seem to have messed up near line 31 which has pretty much messed up the rest of the program for some reason? I think I messed up my declarations.