You are required, but not limited, to turn in the following source files:
Assignment9.java
You can look at the Java programs in the text book to see how comments are added to programs.
In addition to what has been covered in previous assignments, the use of the following items, discussed in class, will probably be needed:
Recursion
One-dimensional arrays
Assignment #9 will be the construction of 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). You may assume that there will not be more than 100 numbers.
Then compute the minimum number, compute the smallest even integer, count negative numbers, and compute the sum of the numbers that are divisible by 3 using recursion. Thus, you will create recursive methods findMin, computeSmallestEven, countNegativeNumbers, and computeSumOfNumbersDivisibleBy3 in Assignment9 class and they will be called by a main method.
Specifically, the following recursive methods must be implemented (These methods should not contain any loop):
public static int findMin(int[] numbers, 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)
If these methods are implemented using a Loop or any Static Variable, points will be deducted (from the test cases) even if your program passes test cases. DO NOT use any Static Variables.
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 0
The smallest even integer in the sequence is 0
The count of negative integers in the sequence is 0
The sum of numbers that are divisible by 3 is 0
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.
Delivering a high-quality product at a reasonable price is not enough anymore.
That’s why we have developed 5 beneficial guarantees that will make your experience with our service enjoyable, easy, and safe.
You have to be 100% sure of the quality of your product to give a money-back guarantee. This describes us perfectly. Make sure that this guarantee is totally transparent.
Read moreEach paper is composed from scratch, according to your instructions. It is then checked by our plagiarism-detection software. There is no gap where plagiarism could squeeze in.
Read moreThanks to our free revisions, there is no way for you to be unsatisfied. We will work on your paper until you are completely happy with the result.
Read moreYour email is safe, as we store it according to international data protection rules. Your bank details are secure, as we use only reliable payment systems.
Read moreBy sending us your money, you buy the service we provide. Check out our terms and conditions if you prefer business talks to be laid out in official language.
Read more