# Thread: Need help with assignment

1. Member
Join Date
Mar 2012
Posts
3
Rep Power
0

## Need help with assignment

I cant wrap my head around this assignment. All I have accomplished to this point is to determine wether the integer entered is even or odd. Can someone please break it down for me how I would go about this. Here is the assignment:

Write a program that reads in a set of integer numbers. While reading the input stream, the program should determine if each item integer item in the input stream is an odd or even number. If the number is odd it should be added to an odd number accumulator, if the number is even it should be added to an even number accumulator. The program should then print the total for the number of even numbers entered and the total for the number of odd numbers entered. The program should also keep count of the number of odd numbers in the input stream and the count of the number of even numbers in the input stream. The program should additionally print out the count of the odd numbers entered and the count for even numbers even. Format the numeric output. Place the appropriate labels in the output to identify the information.

2. ## Re: Need help with assignment

Ok, so whats the difference between an even and an odd number? How do you as a human know whether a number is even or odd?

Once you answer that question, how might you reproduce the same even/odd test in code?

3. Member
Join Date
Mar 2012
Posts
3
Rep Power
0

## Re: Need help with assignment

I should have been more specific. Im not having trouble determining wether the number is even or odd. The issue Im having is adding the numbers to an accumulator. I dont know how to make the program determine how many values we're inputed. Confused by the input stream.

4. ## Re: Need help with assignment

Well, you could count the numbers as they are added, or if your accumulator is based on an array or list of some type, you have methods that can be used to get the current size of the list!