Program that reads in a sequence of integers from standard input
a program that reads in a sequence of integers from standard input until 0 is read, and store them in an array (including 0). This is done using iteration (choose one of for, while, or do while loop).
-compute the minimum number
-compute the smallest even integer
-compute count negative numbers
-compute the sum of the numbers that are divisible by 3 using recursion.
Use recursive methods:
-findMin
-computeSmallestEven
-countNegativeNumbers
-computeSumOfNumbersDivisibleBy3
the following recursive methods must be implemented (These methods should not contain any loop):
public static int findMin(int[] elements, int startIndex, int endIndex)
public static int computeSmallestEven(int[] elements, int startIndex, int endIndex)
public static int countNegativeNumbers(int[] elements, int startIndex, int endIndex)
public static int computeSumOfNumbersDivisibleBy3(int[] elements, int startIndex, int endIndex)
DO NOT use any Static Variables.
You will need to use InputStreamReader and BufferedReader (they are in java.io package) to process input and also take care of IOException.
The program should output the results of those calculations to standard output. 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 number is
The smallest even integer in the sequence is
The count of negative integers in the sequence is
The sum of numbers that are divisible by 3 is
Note that the result values will be different depending on test cases (not always 0).
Do not output a prompt to query for the numbers. The number 0 is included in the sequence of numbers and should be included in all of your calculations.