Working out the odd/even problem in steps

=====Sum and average all of the odd and even numbers entered by the user.
When the program runs it should look like this:

How many numbers will you enter? 3
Enter number 1: 20
Enter number 2: 25
Enter number 3: 44

The odd numbers are 25
The total of the odd numbers is 25, the average is 25

The even numbers are 20 44
The total of the even numbers is 64, the average is 32

Step #3

Each time a number is entered 2 things happen

1. It is added to a running sum DEPENDING on whether it's odd or even
      if(num % 2 == 0 ) 
          sumEven = sumEven + num;
else sumOdd = sumOdd + num;
2. It is added to a number string (concatenation) DEPENDING on whether it's odd or even
      if(num % 2 == 0 ) 
          numberStringEven = numberStringEven + num;
else numberStringOdd = numberStringOdd + num;

But remember, the variables must be created before you can add anything to them.

   int sumEven = 0;
   int sumOdd = 0;
   String numberStringEven = "";
   String numberStringOdd = ""; 

 

<-- Previous