Home / Expert Answers / Computer Science / this-is-a-java-program-declare-and-initialize-two-random-arrays-of-random-numbers-to-the-printarray-pa977

(Solved): This is a java program. Declare and initialize two random arrays of random numbers to the printArray ...



This is a java program. Declare and initialize two random arrays of random numbers to the printArrays method. Implement a method called printTwoArrays that will take two arrays and print them to the console, side by side. Implement a method called compareArrays that will compare two arrays to determine which array had the most "position by position" values that were greater than the other. The program should also provide for ties. Example: Content of array 1: 5,8,13,24,11,56,13 Content of array 2: 7,4,3,6,33,15,5 Array 1 has 5 positions with higher values than array 2, while array 2 has only 2 higher values than array 1. There are no ties. -Declare two arrays of int data type. The size should be declared using a variable called elements. The program should run with thie variable set ti any value. -Initialize each array. The arguments for the limits for the random range should be defined by the variables low_limit and high_limit. These two variables should be passed to the methods to initialize the array. -Implement a new method that takes two arrays as arguments, print them in rows and columns, with all integers right justified so that the units place of all numbers in a column are aligned. The method must be called printTwoArrays(..). -Implementa new method that will count the number of times each array has the higher number when an element by element comparison is done. It will then print out the results of this comparison. The method should be called compareArrays(...) and it should take two arrays of equal length and return nothing. The example below shows the required format of the output given the arguments specified. Elements<--8 low_limit <--40 high_limit <--90 Index 0: 74 86 Index 1: 75 43 Index 2: 53 40 Index 3: 80 46 Index 4: 65 65 Index 5: 87 82 Index 6: 51 83 Index 7: 75 42 Array 1 has 5 highs Array 2 has 2 highs There are 1 ties The program should keep running until there is at least one tie.



We have an Answer from Expert

View Expert Answer

Expert Answer


We have an Answer from Expert

Buy This Answer $5

Place Order

We Provide Services Across The Globe