Create a class named module containing the data members and


Assignment

Create a class named Module4 containing the following data members and methods (note that all data members and methods are for objects unless specified as being for the entire class)

1) Data members: none

2) Methods:

a. A method named displayContent the accepts an array of type int and prints their values to the console, with each array element on a separate line

b. A method named removeNegatives that accepts an array of type int, copies all its non-negative values into a new int array (and maintains their sequence), and returns the new array. Note that the new array should be the exact size required to hold all the non-negatives values of the parameter array.

c. A method named arrayProduct that accepts two arrays of type int named x and y and returns a two-dimensional array. Each element in the two-dimensional array should hold the product of the corresponding x and y elements, i.e., 2dArray[x_index][y_index] = x[x_index]*y[y_index]
When submitted, this class should not have a main method. If you wish to test your methods, you might write a simple class that creates a Module4 object and creates & receives arrays and displays their contents.

To avoid the tedium of entering array values by hand, you might also find is useful to create arrays in your code using contents in braces, which builds an array with the exact number of elements in the sequence you provide, such as:

int x = {0, 1, 2, 3} or int[] y = {-1, -2 0, -3, 5, 7, 13}; Additional Constraints

The program should be implemented as a single file holding the public class Module4. Comments should be provided at the start of the class file (Le., above the class definition) giving the class author's name and the date the program was finished.

Solution Preview :

Prepared by a verified Expert
JAVA Programming: Create a class named module containing the data members and
Reference No:- TGS02709870

Now Priced at $10 (50% Discount)

Recommended (98%)

Rated (4.3/5)