Question: ( a ) Remove rows where at least a given fraction f of the values are negative ( b ) Replace negatives in

(a) Remove rows where at least a given fraction "f" of the values are negative
(b) Replace negatives in each of the remaining rows with average value of non-negative (greater than
or equal to 0) numbers in the same column; if there are no non-negative values in the column,
replace it with 0.
As an example, if we are given the following 2D array (56) :
-1,4,3,2,-3,2
-2,3,5,-4,0,1
-1,-3,-4,1,-1,0
-1,2,-3,6,5,3
-3,2,-3,-5,0,0
Step (a) will produce the following if the given fraction f=12 :
-1,4,3,2,-3,2
-2,3,5,-4,0,1
-1,2,-3,6,5,3
Step (b) will produce the following:
0,4,3,2,2.5,2
0,3,5,4,0,1
0,2,4,6,5,3
You are given a starter Java file where you need to complete the code in the 2 functions
extract() and replace() which correspond to the 2 steps (a) and (b).
You are encouraged to test with other examples.
 (a) Remove rows where at least a given fraction "f" of

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 Databases Questions!