Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Please solve using Java eclipse No stack over flow!! code make run In the box provided to answer this question, write the code for the

Please solve using Java eclipse

No stack over flow!!

image text in transcribed
code
image text in transcribed
make run
In the box provided to answer this question, write the code for the method categorize, a method that returns a reference to an array of int variables whose length is 3. The method receives a single argument numbers that's a reference to an array of int values. The method assigns values to the elements of the return result as per the following scheme: Element 0 holds the count of the number of elements in numbers that are non-positive, element 1 holds the count of positive odd-numbered elements in numbers, and element 2 holds the count of the positive even-numbered elements in numbers. Five sample runs with different array inputs are given on the Sheet for this Question. Note that showArray (again) simply displays the elements of the input array. 1estion 10 Sample arrays with sample Calls int [ ] numbers 1={0,1,2,2,6}; result = categorize(numbers1); showArray("Run 1 result:", result); int [] numbers 2={1,5,3,7,2,1,0,8}; result = categorize(numbers2); showArray ("Run 2 result:", result); int[ ] numbers 3={4,0,3}; result = categorize(numbers3); showArray ("Run 3 result:", result); int [ ] numbers 4={7,6,4,4,6,3,9}; result = categorize(numbers4); showArray ("Run 4 result:", result); int [ ] numbers 5={0,1,5,0,3}; result = categorize(numbers5); showArray ("Run 5 result:", result); private static void showArray(String explanation, int[ ] array) \{ int len = array.length; int indx; System.out.println(explanation); for (indx =0; ind

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image_2

Step: 3

blur-text-image_3

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Students also viewed these Databases questions