Problem

Write a method named getMask that receives a single parameter named table which is a two-d...

Write a method named getMask that receives a single parameter named table which is a two-dimensional ar ray of int’ s. The getMask method should create and return an array mask for the passed-in table array. The programming term mask refers to an array that is built from another array and it contains all 0’s and 1’s. For each element in the mask array, if the original array’s corresponding element contains a positive number, the mask array’s element should contain a 1. And if the original array’s corresponding element contains a zero or negative number, the mask array’s element should contain a 0. Note this example:

table parameter

5

−2

3

1

0

14

0

6

3

6

−1

4

returned array

1

0

1

1

0

1

0

1

1

1

0

1

Note:

• Your method should not change the content of the passed-in table array.

• Your method should work with any sized table, not just the 3-row, 4-column table shown in the example.

• Use appropriate access modifiers. Assume that the method should be accessible from outside of its class. In deciding whether the method should be a class method or an instance method, note that the method does not access any instance variables (it only accesses a parameter).

Step-by-Step Solution

Request Professional Solution

Request Solution!

We need at least 10 more requests to produce the solution.

0 / 10 have requested this problem solution

The more requests, the faster the answer.

Request! (Login Required)


All students who have requested the solution will be notified once they are available.
Add your Solution
Textbook Solutions and Answers Search
Solutions For Problems in Chapter 10
ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT