Question: You will implement a ping - pong array class for this assignment. The general principle of the array should follow the lectures. The terms used

You will implement a ping-pong array class for this assignment.
The general principle of the array should follow the lectures. The terms used in describing this data structure will be explained in the lectures. Your implementation should provide the following: The Driver see the details later in this document. The ping-pong arrays should properly allocate for and assign the references to Live- and Next- arrays properly. Pay particular attention to how Java uses assignment by reference and parameter passing by value, and how arrays though passed by value, behave differently when passed as arguments. The class should implement at least the following public You can implement any other methods as needed: A constructor that takes two integer arguments: for the number of rows and number of columns. This should initialize the cells with a random integer between {0,1}. Notice that this could be implemented in terms of a call to the other constructor mentioned below. Unfortunately, Java does not allow for default arguments to function parameters. A constructor that takes three integer arguments: number of rows, number of columns, and the value for the uniform initialization of all the cells. A Constructor that takes four integer arguments: number of rows and columns, and the last two arguments that give the lower and upper bounds for random numbers to be generated for each cell of the array. void set(int my_arg) and int get() methods for the specified elements of the Live-array. You will need the set() method for both the Live- and the Next- arrays. It is up to you to implement them either as a single method with an extra parameter or as two separate methods. (Array elements should not be accessible directly i.e. they should be private/protected.) A method to swap the Live-Array and Next-Array. (Personally, I do not recommend bending the rules of the language to use Collections::swap(...) method as it seems to be intended for swapping elements within collections and not collections themselves. Besides, it is a three line code to do it directly.) A method to count the nearest neighbor counts of a cell specified. A method to count the next-nearest neighbor counts of a cell. (The above two methods should use the compact way of finding the neighbors of boundary cells using the modulus operator.) A method that takes two integer arguments and resets the board to a random number between those two integer values both inclusive. A method that takes no arguments and resets the board 0 or 1. A method to print the Live-Array. This should print the board to standard out, as outlined below for printing. Notice Your implementation should provide the following:
1. The Driver - see the details later in this document.
2. The ping-pong arrays should properly allocate for and assign the references to Live- and Next- arrays properly. Pay particular attention to how Java uses assignment by reference and parameter passing by value, and how arrays though passed by value, behave differently when passed as arguments.
3. The class should implement at least the following public You can implement any other methods as needed:
A. A constructor that takes two integer arguments: for the number of rows and number of columns. This should initialize the cells with a random integer between \(\{0,1\}\). Notice that this could be implemented in terms of a call to the other constructor mentioned below. Unfortunately, Java does not allow for default arguments to function parameters.
B. A constructor that takes three integer arguments: number of rows, number of columns, and the value for the uniform initialization of all the cells.
C. A Constructor that takes four integer arguments: number of rows and columns, and the last two arguments that give the lower and upper bounds for random numbers to be generated for each cell of the array.
D. void set(int my_arg) and int get() methods for the specified elements of the Live-array. You will need the set() method for both the Live- and the Next- arrays. It is up to you to implement them either as a single method with an extra parameter or as two separate methods. (Array elements should not be accessible directly i.e. they should be private/protected.)
E. A method to swap the Live-Array and Next-Array. (Personally, I do not recommend bending the rules of the language to use Collections::swap(...) method as it seems to be intended for swapping elements within collections and not collections themselves. Besides, it is a three line code to do it directly.)
F. A method to count the nearest neighbor counts of a cell specified.
G. A method to count the next-nearest neighbor counts of a cell. (The above two methods should use the compact way of finding the neighbors of boundary cells using the modulus operator.)
H. A method that takes two integer arguments and resets the board to a random number between those two integer values - both inclusive.
I. A method that takes no arguments and resets the board 0 o What the driver should do:
The Driver object shou
You will implement a ping - pong array class for

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Programming Questions!