The programming term mask refers to an array or 0s and 1s that is built from another

Question:

  1. The programming term mask refers to an array or 0’s and 1’s that is built from another array, such that if any element in the other array satisfies some criterion, the corresponding mask element is 1. Otherwise that corresponding mask element is 0. Suppose each row in a two-dimensional array named births contains the birth years of children in one family. And suppose we want a method named getVotingMask to return a mask whose 1 or 0 elements indicate whether a child is at or above age 18, the legal age to vote in America. The getVotingMask method’s first parameter is a reference to the births array and its second parameter is the current year. We want the method to return a mask whose elements are 0 if the corresponding child is under 18 or a 1 if the corresponding child is 18 or over. Supply the missing code in the following getVotingMask method:

static int[][] getVotingMask( int[][] birth, int currentYear) { int[][] mask = new int[birth.length][]; int[]

Fantastic news! We've Found the answer you've been seeking!

Step by Step Answer:

Question Posted: