Question: II . The ArrayProcessor Class The ArrayProcessor class contains three methods. One prints the contents of an array, another sorts the contents of an array,
II The ArrayProcessor Class
The ArrayProcessor class contains three methods. One prints the contents of an array, another sorts the contents of an array, and the third reverses the contents. The class is meant to process arrays of three ints For example, if:
anArray
Then the sorted version of anArray would be:
sortedArray
And reversing the sorted array would be:
reversedSorted
Using the IDE of your choice JGrasp is strongly recommended create the java class depicted in the below UML diagram. Refer to CS lectures or the book for details about methods that receive an argument andor return a reference variable to an array. UML diagrams are explained in lecture of my cs course. Helpful video regarding UML diagrams
tableArrayProcessor sortThreeIntArray anArray : int : int reverseThreeIntArray anArray : int : int printThreeIntArray anArray : int : void
Each of the three methods receives as an argument a reference variable to an array of integers. Two of the methods return a reference variable to an array object. The method
sortThreeIntArray returns a reference to an int array that contains the sorted, from smallest to largest, entries in the receiving anArray.
Hint : for each of the methods sortThreeIntArray and reverseThreeIntArray, create an int array for use in that method, and populate it with entries that you retrieve from the receiving anArray object.
Hint : there are many ways to sort an array, which you'll learn about in CS and CS However, you don't need a fancy algorithm to sort a small array; it can be done using a brute force approach, especially in this case because the input array that you'll be creating will have only entries. You can enumerate all of the possible combinations of entries in anArray using an ifelse loop. For example, if the input array has entries then you'd check whether and then whether and perform swapping when necessary to rearrange the entries to You are not allowed to use the Sort method.
II The ArrayProgram class
Write a class, ArrayProgram, with a main routine that has the below pseudocode. You'll need to import the Random class and generate numbers with an upper bound.III. Sample Invocation
Three sample invocations of the program are shown below.
tableThe original arrayEntry is Entry is Entry is The sorted arrayEntry is Entry is Entry is The sorted reversed arrayEntry is Entry is Entry is
tableThe original arrayEntry is Entry is Entry is The sorted arrayEntry is Entry is Entry is The sorted reversed arrayEntry is Entry is Entry is
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
