Implement a method named initialize(). The method takes a two-dimensional square array of integers named arr, as
Question:
Implement a method named initialize(). The method takes a two-dimensional square array of integers named arr, as a parameter. It initializes all of the elements of the array to the sum of their indices except for the major diagonal (upper left to lower right), where each element is initialized to -1.
(For testing, use a 4X4 array and have the application print out the array in 2-dimension format.)
Implement a method named dieStats(). The method takes a two-dimensional array of Die objects, named, dice. The method rolls each die in dice and returns an array of integers, where each integer represents the number of Die objects in each row that land in an even number.
For example, if the rolled dice in a 2x3 array land in [[2,4,6], [3,3,5]], the method would return [2,0]. (For testing, use a 2x3 Die array and print the elements of the returned array)
Then Embed and test all methods above in a program, TestArraysAndRecursion, by using examplesprovided above.
Introduction to Algorithms
ISBN: 978-0262033848
3rd edition
Authors: Thomas H. Cormen, Charles E. Leiserson, Ronald L. Rivest