Trouble implementing a solution plz help
First of all I would like to say I've spent about 2 hours trying to solve this on my own and I failed. I'm not just asking for you to do my work for me. I tried one implementation using an ArrayList and another using two scanner objects , but both attempts were unsuccessful.
I have the following assignment
Assignment #2 will be the construction of a program that reads in an unspecified number of integers from standard input, performs some calculations on the inputted numbers, and outputs the results of those calculations to standard output. The numbers could be delimited by any kind of whitespace, i.e. tabs, spaces, and lines (Note that if you use the Scanner class, you do not have to worry about these delimiters. They will be taken care of). Your program will continue to read in numbers until the number 0 is entered. At this point, the calculations will be outputted in the following format:
The minimum integer is 0
The sum of the positive integers is 0
The sum of the even integers is 0
The number of negative integers in the sequence is 0
This means that using all numbers your program reads (including the last number 0), you need to compute the minimum, the sum of only positive integers (integers that are greater than 0), the sum of even integers (integers that can be divided by 2, you can use "number%2 == 0"), and count how many negative integers (integers that are less than 0) in the sequence.
Note that the above is an output for the first test case. For other test cases, you will have different numbers.
Do not output a prompt to query for the numbers. The number 0 is included in the sequence of integers and should be included in all of your calculations.
As I briefly mentioned, I tried to accept the numbers from the user as one long string and then construct an array from that using a scanner object. I also tried storing the values in an ArrayList (my first experience with ArrayLists) and then using the x.toArray() method to construct an int array. Both techniques led to the compiler regurgitating countless error messages my way.
What's the best way to implement this?